Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
earlz
Member
Posts: 1546 Joined: Thu Jul 07, 2005 11:00 pm
Contact:
Post
by earlz » Thu Sep 08, 2005 11:00 pm
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
Osbios
Member
Posts: 116 Joined: Fri Jun 10, 2005 11:00 pm
Post
by Osbios » Fri Sep 09, 2005 11:00 pm
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!!!
dw 0xAA55
earlz
Member
Posts: 1546 Joined: Thu Jul 07, 2005 11:00 pm
Contact:
Post
by earlz » Fri Sep 09, 2005 11:00 pm
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)
Last edited by
earlz on Fri Sep 09, 2005 11:00 pm, edited 1 time in total.
Osbios
Member
Posts: 116 Joined: Fri Jun 10, 2005 11:00 pm
Post
by Osbios » Fri Sep 09, 2005 11:00 pm
dw 0xAA55
earlz
Member
Posts: 1546 Joined: Thu Jul 07, 2005 11:00 pm
Contact:
Post
by earlz » Fri Sep 09, 2005 11:00 pm
thanks, looks promising