The starting cluster number is used as an index into the FAT. Since it is FAT12, every 2 clusters correspond to 3 bytes.
ax has the 2 bytes from the root directory and its lower 12 bits can be used directly. But that is not being done.
The whole 16 bits of ax are used. Since the higher 4 bits of ax will be 0 from the starting cluster number, that is equivalent to using only the lower 12 bits (unless there is a corrupted directory entry, which could make you index into nowhere).
Also, how is the vwX uYZ format being parsed here ?
That is better put as vw Xu YZ
. Recall that x86 is little-endian. When you read 2 bytes in x86, and they are stored as vw Xu
, the actual number read is Xuvw
. Mask to only keep the lower 12 bits and you get uvw
. Similarly, when you read Xu YZ
, the actual number read is YZXu
. Shift right and you get YZX
. Which, incidentally means that the actual format is likely to be vw Zu XY
.