I am trying to read disk sectors by the following code:
disk_load :
push dx
mov ah , 0x02 ; BIOS read sector function
mov al , dh ; Read DH sectors(dh is initialized before calling the routine)
mov ch , 0x01 ;
mov dh , 0x00 ; Select head 0
mov cl , 0x02 ; Start reading from second sector ( i.e.
; after the boot sector )
mov dl,0x80 (tried with 0x00 as well)
int 0x13 ; BIOS interrupt
pop dx ; Restore DX from the stack
jc cset
cmp dh,al ; if AL ( sectors read ) != DH ( sectors expected )
jne disk_error ;
Problem is ,Carry flag is set every time denoting an error. Initially I tried boot disk 0x00 which when I checked AL register afterwards found out that no sectors are being read. Then I changed to 0x80 ,now AL register would have the exact number of sectors requested but still Carry flag is being set!
So what could be the problem here? Carry seems to be set always after int 0x13!
I am running an iso file in Virtual Box if that matters.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…