diff --git a/kernel/drive.asm b/kernel/drive.asm index d7beb84..72742e0 100644 --- a/kernel/drive.asm +++ b/kernel/drive.asm @@ -18,7 +18,8 @@ drive_table: resb (drives * drive_size) section .text -drives_init: int 0x11 +drives_init: ; CX = number of floppy drives in the system + int 0x11 mov cl, 6 shr ax, cl inc ax @@ -31,16 +32,20 @@ drives_init: int 0x11 .loop: push cx push dx mov [bx+drive.biosnum], dl - ; defaults if 13h,AH=8 fails (XT 360kb) - les di, [0x1e * 4] - mov cx, 0x2709 ; 40 cylinders, 9 sectors - mov dh, 1 ; 2 heads - ; ask bios - push bx + ; query bios for floppy format mov ah, 8 + push bx int 0x13 pop bx - ; copy dpt + ; set up defaults if invalid data or fail + jc .defs + test cx, cx + jnz .load +.defs: ; use defaults: 360k, 40 cyl, 9 sects + les di, [0x1e * 4] + mov cx, 0x270 + mov dh, 1 +.load: ; copy dpt push es push ds pop es