Error with LBA to CHS conversion

Feedback? Questions? Comments? All discussions on the articles and tutorials hosted or developed by us go in here.

Moderator: Moderators

Error with LBA to CHS conversion

Postby Andyhhp » Sun Dec 09, 2007 11:03 pm

Im sorry to moan but I hope you dont mind having errors pointed out :oops:

in the OS series, in, and in the comments in the downloadable source code, the following is written about converting an LBA address to a CHS one:

absolute sector = (logical sector / sectors per track) + 1
absolute head = (logical sector / sectors per track) MOD number of heads
absolute track = logical sector / (sectors per track * number of heads)

after spending 2 weeks trying to find out why my bootloader wasn't working, I found that the formula for Absolute Sector should be
absolute sector = (logical sector MOD sectors per track) + 1

The actual source code itself in the download is correct but the comment is the same as above.

The reason I got so stuck on this is because, rightly or wrongly, I dont copy source code - I try to write it myself so I fully understand what is going on (I still have much to learn about assembly).

Anyway, I hope you dont mind a constructive criticism.

Posts: 387
Joined: Tue Oct 23, 2007 10:05 am

Postby Mike » Tue Dec 11, 2007 3:34 pm


The comments from the source code were copied directly from the tutorial when it was originally written. So, while the code was correct, the comment contained the same formula noted from the tutorials.

Thanks for letting us know about the error :) We are going to fix that in the next series upgrade (Which will include [so far] two new tutorials.)

Thanks again! :D
Lead Programmer for BrokenThorn Entertainment, Co.
User avatar
Site Admin
Posts: 463
Joined: Sat Oct 20, 2007 7:58 pm

Postby Andyhhp » Wed Dec 12, 2007 11:00 pm

Having read both of the new tutorials, ive noticed that the same error occurs when you are rewriting the FAT12 driver for the second stage. I assume this is for the same reason :wink:
Posts: 387
Joined: Tue Oct 23, 2007 10:05 am

Return to Article Feedback

Who is online

Users browsing this forum: No registered users and 1 guest