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?

DVD起動のブートセクタが何処に読み込まれるか検証

0
Last updated at Posted at 2026-05-07

初めに

DVDから自作のブートローダを起動する時、El Toritono-emulation形式を使用した場合は0x7C00に読み込まれるとは限らないらしい。
そこで実際にCDから自作ブートローダを起動してCS:IPの値を表示してみる。

ブートローダソース

boot.asm
BITS 16
ORG 0

start:
    cli

    ; STACK
    xor ax, ax
    mov ss, ax
    mov sp, 0x9000

    push cs
    pop ds

    ; VRAM(ES : DI)
    mov ax, 0xB800
    mov es, ax
    xor di, di

    ; CS表示
    mov ax, cs
    call print_hex16

    mov al, ':'
    call putc

    ; IP表示
    call here          ; CALL=PUSH IP + JMP
here:
    pop ax              ; AX = 現在IP

    call print_hex16

.hang:
    cli
    hlt
    jmp .hang

; =========================================
; putc
; AL = 文字
; =========================================
putc:
    mov ah, 0x0C ; 赤 
    mov [es:di], ax
    add di, 2
    ret

; =========================================
; print_hex16
; AXを16進4桁で表示
; =========================================
print_hex16:
    push ax
    push bx
    push cx
    push dx

    mov bx, ax
    mov cx, 4 ; 2バイトの16進数表記は4文字

.loop:
    rol bx, 4

    mov dl, bl
    and dl, 0x0F

    cmp dl, 9
    jbe .num

    add dl, 'A' - 10
    jmp .out

.num:
    add dl, '0'

.out:
    mov al, dl
    call putc

    loop .loop

    pop dx
    pop cx
    pop bx
    pop ax
    ret

times 2048-($-$$) db 0

検証

ISOの作成

nasm -f bin boot.asm -o boot.bin

mkdir iso
cp boot.bin iso/

xorriso -as mkisofs \
  -o os.iso \
  -b boot.bin \
  -c boot.cat \
  -no-emul-boot \
  -boot-load-size 4 \
  iso

DVDへ書き込む

 linuxlite  ~  kaihatsu  1  sudo growisofs -dvd-compat -Z /dev/sr0=os.iso
[sudo] password for linuxlite: 
Executing 'builtin_dd if=os.iso of=/dev/sr0 obs=32k seek=0'
/dev/sr0: "Current Write Speed" is 2.0x1352KBps.
builtin_dd: 192*2KB out @ average infx1352KBps
/dev/sr0: flushing cache
/dev/sr0: updating RMA
/dev/sr0: closing disc
/dev/sr0: reloading tray
 linuxlite  ~  kaihatsu  1  

QEMU

qemu-system-i386 -cdrom os.iso -m 512
image

DELL

機種 : VOSTRO 1540
CPU : Intel(R) Celeron(R) CPU P4600 @ 2.00GHz
fa1a640653acc

NEC

機種 : PC-VK20HHZNX
CPU : Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz
d7b4c9d2bccd1

自作PC20260508追加実証)

機種 : 2013年自作PC
CPU : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
8928f6a08c04

ThinkPad X280(20260510追記))

c9c2e4a1a449d8

PPM1011L2JS1Q(dybabook SS M10 11L/2)(20260510追記)

93404a2b14bee8

最後に

どの場合も0x7C00に読み込まれた

開発環境

機種 : VOSTRO 1540
CPU : Intel(R) Celeron(R) CPU P4600 @ 2.00GHz
MEM : 1.8Gi
OS : Linux Lite 6.6
NASM : 2.15.05

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?