RealMode Drive Detection Routine Using BIOS [Problems]
Posted: Tue Oct 06, 2009 6:00 pm
I have a drive number detection routine that works fine on every computer I have tried it on except one. Here is the code:
Before, calling this code I set up the total number of drives (from BIOS) in the byte variable [count] and zero out dl.
The problem computer is a gateway, sorry don't know the model, but it has a AMD Athlon Thunderbird at 1.2Ghz and on it the code just goes into an infinite loop. Like I said this is the only computer it does that on. At first I suspected that the BIOS was giving me an incorrect number of drives, but I found this to be false.
Any ideas would be appreciated. Thanks in advance,
cr0PE
Code: Select all
drivedet: ;Detect the number of floppy and hard drives present and save their numbers
mov ah, 0x15 ;INT 0x13 AH=0x15: get disk type
int 0x13
jc .next
cmp ah, 0 ; ah=0: no disk present
jz .next
cmp ah, 02 ; ah=1: floppy without change-line. ah=2: floppy with change-line
jnbe .drv3
dec byte [count]
inc byte [floppies] ;increment the total floppy count
push bx
xor bx, bx
mov byte bl , [floppies]
dec bl
mov byte [fd0+bx], dl ;save drive number in dl to proper drive number variable
pop bx
jmp .next
.drv3:
dec byte [count]
inc byte [hds] ;ah=3: hard disk
push bx
xor bx, bx
mov byte bl, [hds]
dec bl
mov byte [hd0+bx], dl ;save drive number in dl to proper drive number variable
pop bx
.next:
inc dl
cmp byte [count], 0 ;some retarded BIOSs report duplicate high number drives
jz .end
jmp drivedet
The problem computer is a gateway, sorry don't know the model, but it has a AMD Athlon Thunderbird at 1.2Ghz and on it the code just goes into an infinite loop. Like I said this is the only computer it does that on. At first I suspected that the BIOS was giving me an incorrect number of drives, but I found this to be false.
Any ideas would be appreciated. Thanks in advance,
cr0PE