I'm writing a boot loader which will be hosted on a FAT32 filesystem. I am finding that Int13, AX=42 is succeeding (not setting CF), but the destination buffer is all zeroes after the call. I've reduced the code to something simple enough to post that still exhibits the problem -- so there's no BIOS Parameter Block, no checking for Int13 extensions (running Int13, AH=41 returns CX=7 in my install of VMWare), drive hard-coded to $80, etc in this post.
The code just tries to load the MBR into a buffer and check that the buffer's first word is not 0. Unfortunately, it is zero.
I'm running this in VMWare Player 3.0.0. It gives the same result in Bochs. (It prints 'a'.)
I'm assuming CS=DS=$07c0 because I read in a post somewhere that some BIOSes don't like DS=0. I'm setting up SS/SP, DS, ES, FS, and GS inside CLI/STI because I'm not sure how atomic the startup has to be wrt interrupts. Wikipedia's INT13 page tells me that the first sector is 0. This code is in FASM.
Thanks for the help.
Code: Select all
format binary
use16
org $0000
jmp $07c0:Start
Start:
cli
mov ax, $0050
mov ss, ax
mov sp, $0100
mov ax, $07c0
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
sti
mov ah, $42
mov dl, $80
mov si, DAP
int $13
jc Failed2
mov ax, word [Buffer]
test ax, ax
jnz Success
Failed1:
mov al, 'a'
jmp ShowResult
Failed2:
mov al, 'b'
jmp ShowResult
Success:
mov al, 'c'
ShowResult:
mov ah, $0e
int $10
Halt:
jmp Halt
DAP:
.Size db 16
.Reserved1 db 0
.Count db 1
.Reserved2 db 0
.BufSeg dw $07c0
.BufOfs dw Buffer
.LBA dq 0
times (510 - ($ - $$)) db 0
dw $aa55
Buffer: rb 512