Floppy Disk
Posted: Tue Jan 21, 2003 11:09 am
Hi,
I have already posted this to alt.os.development but i thought I would post it here as well as I just joined the forum yesterday and wanted to say hi. I only recognise Tim Robinson from a.o.d so far, any others? Ok here goes...
I am trying to load my kernel into memory from my FAT12 formatted floppy. This shouldnt be a problem though. The problem is that when I try to read the disk it wont stop reading. The green light stays on and it keeps reading the sector. After running it through bochsdbg and checking the error code it show up as a controller failure. My code then attempts to read the disk again. I would appreciate it if someone could take a look at my disk reading code and see what they think.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
resetFloppy:
xor ax, ax ; Puts the disk into a known state.
int 13h ;
readSectors:
mov ax, 020Eh ; ah = 02h, al = 0Eh (14 sectors to load).
mov cx, 0013h ; cl = sector_number, ch = cylinder_number.
mov dx, 0000h ; dh = head_number, dl = drive_number.
mov bx, 800h ; Setup buffer es:bx to 800:0000h.
mov es, bx ;
xor bx, bx ;
int 13h ; Start reading.
jc readSectors ; Whoops, didn't manage it this time. Lets try again.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Can anyone take a stab at it for me? Im compiling with nasm.
Thanks :)
Chris Hodgins
I have already posted this to alt.os.development but i thought I would post it here as well as I just joined the forum yesterday and wanted to say hi. I only recognise Tim Robinson from a.o.d so far, any others? Ok here goes...
I am trying to load my kernel into memory from my FAT12 formatted floppy. This shouldnt be a problem though. The problem is that when I try to read the disk it wont stop reading. The green light stays on and it keeps reading the sector. After running it through bochsdbg and checking the error code it show up as a controller failure. My code then attempts to read the disk again. I would appreciate it if someone could take a look at my disk reading code and see what they think.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
resetFloppy:
xor ax, ax ; Puts the disk into a known state.
int 13h ;
readSectors:
mov ax, 020Eh ; ah = 02h, al = 0Eh (14 sectors to load).
mov cx, 0013h ; cl = sector_number, ch = cylinder_number.
mov dx, 0000h ; dh = head_number, dl = drive_number.
mov bx, 800h ; Setup buffer es:bx to 800:0000h.
mov es, bx ;
xor bx, bx ;
int 13h ; Start reading.
jc readSectors ; Whoops, didn't manage it this time. Lets try again.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Can anyone take a stab at it for me? Im compiling with nasm.
Thanks :)
Chris Hodgins