0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[8086実機実験] CFカードから起動するブートセクタを自作する(備忘録)

Posted at

やりたいこと

CompactFlash(CF)カードのブートセクタに自作のプログラムを書き込み、
それをPocket8086(実際のIntel 8086を搭載した復刻PC)上で起動させる。

ブートセクタへ書き込むプログラム

以下は、画面に "Hello, Pocket8086!" と表示するだけの簡単なブートローダーです。

boot.asm
[bits 16]
[org 0x7C00]

mov si, msg
call print_string
jmp $

print_string:
  lodsb
  or al, al
  jz .done
  mov ah, 0x0E
  int 0x10
  jmp print_string
.done:
  ret

msg db "Hello, Pocket8086!", 0

times 510-($-$$) db 0
dw 0xAA55

Ubuntsu上で作業

Windowsでrufus等を試したがうまく書き込めなかった。
以下のコマンドを実行して、コンパイル後CFへ書き込む

nasm boot.asm -f bin -o boot.bin       # コンパイル
lsblk                                   # CFカードの名前確認
sudo umount /media/ubuntu/cf1 #lsblkの結果に合わせて
sudo dd if=boot.bin of=/dev/sdc bs=512 count=1 conv=notrunc
sync

image.png

結果

無事に起動し、Pocket8086の画面に設定した文言が表示された。
image.png

環境

Ubuntsu 22.04.5

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?