Extended read problem
Posted: Tue May 11, 2010 4:04 pm
I'm trying to recursively read this program from the first sector of a floppy disk but it's making no sense. When I boot, it gives me a blank screen when it should at least get to the first print. I tried enabling and disabling interrupts but it ignores that, too. I'm beyond confused, I can't even tell where the problem is :( Can anyone tell me what I'm doing wrong?
Thanks in advance!
Code: Select all
[bits 16]
section .data
alert db "test ",0
section .text
xor ax,ax
mov ax,ds
cmp ax,0x1000 ;check for first iteration
je start ;if so, just start
mov ax,0x7c00 ;otherwise set up
mov ds,ax
start:
mov si,alert ;generic print function
print:
lodsb
cmp al,0x00
je read
mov ah,0x0e
xor bh,bh
mov bl,0x07
int 0x10
jmp print
dap: ;hopefully this is correct?
db 0x10 ;16 bytes
db 0x00 ;unused
dw 0x01 ;read one sector
dw 0x00 ;offset
dw 0x1000 ;segment 0x1000:0x00
dq 0x00 ;start from the first sector. dq means quadruple word right? I couldn't find much documentation on it :(
read:
xor ax,ax
int 0x13
mov ah,0x42 ;extended read
xor dx,dx
mov dl,0x00 ;floppy drive index
mov si,dap
reread:
int 0x13
jc reread
recurse:
mov ax,0x1000
mov ds,ax ;reset ds to the new location
jmp 0x1000:0x00 ;jump there
db 0x55aa