flat assembler
Message board for the users of flat assembler.

Index > OS Construction > CHS to LBA translation question

Author
Thread Post new topic Reply to topic
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73 01 Jun 2004, 17:56
Does anybody know the proper way to translate from CHS to LBA?

I was looking the code for the dos UDMA drivers(http://linux.tu-varna.acad.bg/~lig/freedos/) and the translation kind of confused me.

Basically he called int 13, ah=8 to get the drive parameters.
Anded the sectors with 3fh to make sure it was less than 64, which made sense since sectors usually max out at 63, and start with sector 1.

But for the heads, he increase a byte by 1 and then multiplies by the sectors to get the number of sectors per cylinder.

I thought the max number of heads would be 256(o-255) rather than 255 indicated by this algorithm. This would be due to the fact that if int 13,8 returned 255 for heads, it would increase this value to 0 and then the multiplication would fail. Hale Landis' site shows for CHS max heads should be 256 and max sectors should be 63.

My drive showed up with 254 heads returned from the int13,8 call, so no problem. Was wondering if anybody could clarify this for me.

Thanks in advance,

...Gomer73
Post 01 Jun 2004, 17:56
View user's profile Send private message Reply with quote
neonz



Joined: 02 Aug 2003
Posts: 62
Location: Latvia
neonz 01 Jun 2004, 19:52
Post 01 Jun 2004, 19:52
View user's profile Send private message Visit poster's website Reply with quote
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73 01 Jun 2004, 20:30
Yep, that was the Hale Landis site I was talking about which says 256 is the maximum number of heads.

Hale knows what he is talking about, and yet the UDMA driver works awesome with maximum heads set to 255. Just trying to clear up the conflict. CHS port mode obviously won't help us out since maximum heads are set to 16.
Post 01 Jun 2004, 20:30
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.