Code: Select all
LoadPVD:
push cx ; store registers
push bx
push es
mov cx, 4 ; We want one sector
mov eax, 0x10 ; At block 10 - 0-F are reserved
mov bx, PVD_SEG ; Reading to segment 50
mov es, bx
xor bx, bx ; Offset 0
.loop:
inc eax
call ReadSectors
jc .done
mov bx, 0x50
mov es, bx
xor bx, bx
cmp byte [es:bx], 1
jne .loop
.done:
pop es
pop bx ; restore registers and return
pop cx
ret
Code: Select all
ReadSectors:
.MAIN:
push edx
mov di, 5
.SECTORLOOP:
push ds
push dword 0 ;Block number
push eax
push bx ; Read to es:bx
push es
push word cx ; Read in 1 block
push word 10h ; Size: 10h
mov ah, 42h
mov dl, [bsDriveNumber]
push ss
pop ds
mov si, sp
push cx
int 13h ; IBM/MS INT 13 Extensions - EXTENDED READ
pop cx
pop edx
pop bx
pop dx
pop edx
pop edx
pop ds
jc .CONTINUE ; test for read error
cmp ax, 0
je .SUCCESS
.CONTINUE:
dec di ; decrement error counter
jnz .SECTORLOOP ; attempt to read again
.SUCCESS:
pop edx
ret