diff --git a/kernel/diskio.asm b/kernel/diskio.asm index 45d7631..a634e86 100644 --- a/kernel/diskio.asm +++ b/kernel/diskio.asm @@ -7,6 +7,13 @@ chssiz: equ 8 chstab: resw (4*chssiz) + ; Disk access packet for EBIOS extensions +dapps: equ 0 ; byte packet size +dapnum: equ 2 ; word number of sectors to transfer +dapbuf: equ 4 ; dword transfer buffer +dapsec: equ 8 ; qword absolute sector number +dapsiz: equ 16 + section .text ; Convert between drive number and BIOS dl @@ -80,30 +87,59 @@ adisk: push bp push ds push es mov bp, sp + + push ax + cmp cx, 0xFFFF - je .islrg + je .lrg - ; build a disk access packet on the stack - push ds ; dword transfer buffer - push bx - push cx ; word number of sectors - push cs ; dword starting sector number (CS always 0) + ; build ebios DAP from registers supplied + ; qword sector number + push cs + push cs + push cs push dx + ; dword target buffer + push ds + push bx + ; word number of sectors + push cx + jmp .psz - ; set our freshly created dap as DS:BX - mov bx, sp +.lrg: ; build ebios DAP from int 25h DAP + ; qword sector number + push cs + push cs + mov ax, [bx+2] + push ax + mov ax, [bx] + push ax + ; dword target buffer + mov ax, [bx+8] + push ax + mov ax, [bx+6] + push ax + ; word number of sectors + mov ax, [bx+4] + push ax +.psz: ; word packet size + mov ax, dapsiz + push ax + + ; DS:SI = SS:SP (ptr to dap) push ss pop ds + mov si, sp -.islrg: mov dl, al - call fndchs - call calchs + ; set up int 13h subfunction number + mov ax, [si+dapsiz] + add ah, 0x40 + + ; get BIOS drive number mov dl, al - mov al, [bx+4] - mov es, [bx+8] - mov bx, [bx+6] + call dnconv + int 0x13 - jc .ret .ret: mov sp, bp pop es