Use ebios extensions if enabled
This commit is contained in:
parent
2d97bb57e5
commit
af5df85c16
@ -13,9 +13,11 @@ dsknum: resb 1
|
||||
; bios drive we end up using
|
||||
biosnum: resb 1
|
||||
|
||||
dap: resw 2
|
||||
.buf: resw 2
|
||||
; current sector number
|
||||
; absolute, ignores partition
|
||||
dskseek: resd 1
|
||||
dskseek: resd 2
|
||||
|
||||
; bit 0 (1) - dirty flag for dskbuf
|
||||
; bit 1 (2) - controller configured
|
||||
@ -69,7 +71,10 @@ int13: ; debug output
|
||||
; read BIOS int13h/AH=8 values
|
||||
; DPT data gets copied over our dpt
|
||||
; CHS data gets inserted into our bpb
|
||||
getprm: mov ah, 8
|
||||
getprm: test byte [dskflag], 4
|
||||
jnz .nodpt
|
||||
; do the query
|
||||
mov ah, 8
|
||||
mov dl, [biosnum]
|
||||
call int13
|
||||
; bail out if error
|
||||
@ -159,9 +164,26 @@ loghdd: sub dl, 2
|
||||
cmp dl, 4
|
||||
jnc logerr
|
||||
push dx
|
||||
mov byte [biosnum], 0x80
|
||||
mov dl, 0x80
|
||||
mov byte [biosnum], dl
|
||||
; test for ebios extensions
|
||||
mov ah, 0x41
|
||||
mov bx, 0x55AA
|
||||
call int13
|
||||
sbb bx, 0xAA55
|
||||
jnz .chs
|
||||
; enable ebios and assume controller is configured
|
||||
or byte [dskflag], (2+4)
|
||||
; initialize DAP
|
||||
mov word [dap], 0x1000
|
||||
mov word [dap+2], 1
|
||||
mov word [dap+4], dskbuf
|
||||
xor ax, ax
|
||||
mov word [dap+6], ax
|
||||
mov word [dap+12], ax
|
||||
mov word [dap+14], ax
|
||||
; get chs data (needed or we cant load vbr)
|
||||
call getprm
|
||||
.chs: call getprm
|
||||
; read mbr
|
||||
xor ax, ax
|
||||
xor dx, dx
|
||||
@ -244,9 +266,15 @@ _read: mov ch, 2
|
||||
db 0x3D ; cmp ax, imm16: causes next instr to be skipped
|
||||
_write: mov ch, 3
|
||||
mov cl, 1 ; read len
|
||||
; TODO: do ebios i/o
|
||||
; check if ebios supported
|
||||
test byte [dskflag], 4
|
||||
jz .l00
|
||||
mov ax, cx
|
||||
or ah, 0x40
|
||||
mov si, dap
|
||||
jmp .do
|
||||
; check if we can skip controller reset
|
||||
test byte [dskflag], 2
|
||||
.l00: test byte [dskflag], 2
|
||||
jnz .l01
|
||||
; do controller reset
|
||||
mov dl, [biosnum]
|
||||
@ -280,8 +308,8 @@ _write: mov ch, 3
|
||||
xchg ax, cx
|
||||
xchg cx, dx
|
||||
xchg dh, dl
|
||||
mov dl, [biosnum]
|
||||
mov bx, dskbuf
|
||||
.do: mov dl, [biosnum]
|
||||
; ah: subfunction selected via cx previously
|
||||
; al: 1 = reading 1 sector
|
||||
; cx: sector and cylinder number
|
||||
|
Loading…
Reference in New Issue
Block a user