Stage 1 and Stage 2 have embedded variables whose locations are well-defined, so that the installation can patch the binary file directly without recompilation of the stages.
In Stage 1, these are defined:
See the file stage1/stage1.S, for more information.
In the first sector of Stage 1.5 and Stage 2, the block lists are
lastlist. The address of
lastlist is determined when assembling the file
The trick here is that it is actually read backward, and the first 8-byte block list is not read here, but after the pointer is decremented 8 bytes, then after reading it, it decrements again, reads, and so on, until it is finished. The terminating condition is when the number of sectors to be read in the next block list is zero.
The format of a block list can be seen from the example in the code just
firstlist label. Note that it is always from the
beginning of the disk, but not relative to the partition
In the second sector of Stage 1.5 and Stage 2, these are defined:
0x12+ the length of the version string
See the file stage2/asm.S, for more information.