I am guessing that your LBA value is being stored in AX
as you are performing division on some value.
As some pre-information for you, the absoluteSector
is the CHS sector number, absoluteHead
is the CHS head number, and absoluteTrack
is the CHS cylinder number. Cylinders and tracks are the exact same thing, just a different name.
Also, the DIV
operation for your code in 16-bit will take whatever is in the DX:AX
register combination and divide it by some value. The remainder of the division will be in the DX
register while the actual result will be in the AX
register.
Next, the *X
registers are 16-bit registers, where *
is one of ABCD
. They are made up of a low and high component, both referred to as *H
and *L
for high and low, respectively. For example, the DX
register has DH
for the upper 8 bits and DL
for the lower 8 bits.
Finally, as the BYTE
and WORD
modifiers simply state the size of the data that will be used/transferred.
The first value you must extract is the sector number, which is obtained by diving the LBA value by the number of sectors per track. The DL
register will then contain the sector number minus one. This is because counting sectors starts at 1, which is different than most values, which start at zero. To fix this, we add one to the DL
register get the correct sector value. This value is stored in memory at absoluteSector
.
The next value you must extract is the head number, which is obtained by dividing the result of the last DIV
operation by the number of heads per cylinder. The DL
register will then contain the head number, which we store at absoluteHead
.
Finally, we get the track number. With the last division we already obtained the value, which is in the AL
register. We then store this value at absoluteTrack
.
Hope this cleared things up a little bit.
-Adrian