Page 1 of 1
help with some math
Posted: Thu Sep 08, 2005 11:00 pm
by earlz
I need some help with a bit of math, i just really dont know where to start in the eqaution
i want to convert lba to chs
here is the only formula i could find but it is for chs to lba
Code: Select all
DOS_sector_num = BIOS_sector_num - 1 + Head_num*Sectors_per_track
+ Track_num*Sectors_per_track*Total_heads
if anyone could help me it would greatly be appreciated
Re: help with some math
Posted: Fri Sep 09, 2005 11:00 pm
by Osbios
This is my code for 1440KB floppys:
Code: Select all
;LBA2CHS
;C=LBA/36
;H=(LBA mod 36)/18
;S=((LBA mod 36)mod 18)+1
mov eax,[LBA] ;eax=LBA(0..2879)
xor edx,edx
mov ecx,36
div ecx
mov [floppy_c],al
mov eax,edx
mov ecx,18
div cl
mov [floppy_h],al
inc ah
mov [floppy_s],ah
But this is
only for 1440KB floppys!!!
Re: help with some math
Posted: Fri Sep 09, 2005 11:00 pm
by earlz
thanks a lot, couldnt it be made for anyting if u change some values to the spt and tph and heads per drive
too bad i cant use this right now though(decided to switch to pmode so im not even close to fdd stuff yet)
edit:
(i mean i just decided to switch to pmode last night, about 3 hours after posting this)
Re: help with some math
Posted: Fri Sep 09, 2005 11:00 pm
by Osbios
Re: help with some math
Posted: Fri Sep 09, 2005 11:00 pm
by earlz
thanks, looks promising