Improve support for auto-selecting LBA addressing
This commit is contained in:
parent
1c6268798c
commit
e34accfcff
@ -54,7 +54,39 @@ readp: ; read sector DX:AX from partition
|
|||||||
add ax, word [bp+bpb_po]
|
add ax, word [bp+bpb_po]
|
||||||
adc dx, word [bp+bpb_po+2]
|
adc dx, word [bp+bpb_po+2]
|
||||||
jc dskerr
|
jc dskerr
|
||||||
jmp [bp-2]
|
|
||||||
|
; This jump is overwritten with NOP's if LBA support
|
||||||
|
dskjmp: jmp rchs
|
||||||
|
|
||||||
|
rebios: ; read sector DX:AX from disk
|
||||||
|
; this uses the EBIOS extensions
|
||||||
|
; qword sector number DX:AX
|
||||||
|
push cs
|
||||||
|
push cs
|
||||||
|
push dx
|
||||||
|
push ax
|
||||||
|
|
||||||
|
; dword target buffer: BX:0
|
||||||
|
push bx
|
||||||
|
push cs
|
||||||
|
|
||||||
|
; word sector number
|
||||||
|
push cx
|
||||||
|
|
||||||
|
; size & passing
|
||||||
|
mov di, 0x10
|
||||||
|
push di
|
||||||
|
|
||||||
|
mov si, sp
|
||||||
|
mov ah, 0x42
|
||||||
|
mov dl, [bp+bpb7_dn]
|
||||||
|
stc
|
||||||
|
int 0x13
|
||||||
|
jc dskerr
|
||||||
|
|
||||||
|
add sp, di
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
rchs: ; read sector DX:AX from disk
|
rchs: ; read sector DX:AX from disk
|
||||||
; uses basic CHS disk IO
|
; uses basic CHS disk IO
|
||||||
@ -98,36 +130,6 @@ chslp: push ax
|
|||||||
loop chslp
|
loop chslp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
rebios: ; read sector DX:AX from disk
|
|
||||||
; this uses the EBIOS extensions
|
|
||||||
; qword sector number DX:AX
|
|
||||||
push cs
|
|
||||||
push cs
|
|
||||||
push dx
|
|
||||||
push ax
|
|
||||||
|
|
||||||
; dword target buffer: BX:0
|
|
||||||
push bx
|
|
||||||
push cs
|
|
||||||
|
|
||||||
; word sector number
|
|
||||||
push cx
|
|
||||||
|
|
||||||
; size & passing
|
|
||||||
mov di, 0x10
|
|
||||||
push di
|
|
||||||
|
|
||||||
mov si, sp
|
|
||||||
mov ah, 0x42
|
|
||||||
mov dl, [bp+bpb7_dn]
|
|
||||||
stc
|
|
||||||
int 0x13
|
|
||||||
jc dskerr
|
|
||||||
|
|
||||||
add sp, di
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
; error handling for disk errors
|
; error handling for disk errors
|
||||||
dskerr: call errcll
|
dskerr: call errcll
|
||||||
|
|
||||||
@ -231,23 +233,28 @@ lloop: call readc
|
|||||||
jne lloop
|
jne lloop
|
||||||
ret
|
ret
|
||||||
|
|
||||||
main: mov bp, bpb
|
main: ; Set up BP to point to BPB
|
||||||
|
; Relative addressing saves one instruction byte per access
|
||||||
|
mov bp, bpb
|
||||||
|
; Save DL contents
|
||||||
mov [bp+bpb7_dn], dl
|
mov [bp+bpb7_dn], dl
|
||||||
|
|
||||||
; check if EBIOS is supported
|
; EBIOS is ignored for floppies (dl < 80h)
|
||||||
|
test dl, 0x80
|
||||||
|
jz noebio
|
||||||
|
|
||||||
|
; check for EBIOS support
|
||||||
mov bx, 0x55AA
|
mov bx, 0x55AA
|
||||||
mov ah, 0x41
|
mov ah, 0x41
|
||||||
|
; set carry to assume failure if int didnt do anything
|
||||||
stc
|
stc
|
||||||
int 0x13
|
int 0x13
|
||||||
; default: use CHS read
|
|
||||||
mov ax, rchs
|
|
||||||
jc noebio
|
jc noebio
|
||||||
; if EBIOS: use LBA read
|
|
||||||
mov ax, rebios
|
|
||||||
noebio: lea di, [bp-2]
|
|
||||||
stosw
|
|
||||||
|
|
||||||
; load root directory
|
; disable CHS routine, fall into LBA routine instead
|
||||||
|
mov word [dskjmp], 0x9090
|
||||||
|
|
||||||
|
noebio: ; load root directory
|
||||||
call loadr
|
call loadr
|
||||||
; search for first system directory
|
; search for first system directory
|
||||||
mov ah, 0x14
|
mov ah, 0x14
|
||||||
|
Loading…
Reference in New Issue
Block a user