Skip to navigation


Drawing pixels: ylookupl

[Commodore 64 version]

Name: ylookupl [Show more] Type: Variable Category: Drawing pixels Summary: Lookup table for converting a pixel y-coordinate to the low byte of a screen address (within the 256-pixel-wide game screen)
Context: See this variable in context in the source code References: This variable is used as follows: * CPIX2 uses ylookupl * HLOIN uses ylookupl * LOIN (Part 3 of 7) uses ylookupl * LOIN (Part 4 of 7) uses ylookupl * LOIN (Part 5 of 7) uses ylookupl * PIXEL uses ylookupl * TT66simp uses ylookupl

The address returned is indented by four character blocks from the edge of the screen (that's the $20 part, as each character is 8 bytes, and 4 * 8 = $20). This is because the first four characters of every character line are blank, so the 256-pixel-wide game screen is centred in the Commodore 64's screen width of 320 pixels.
.ylookupl FOR I%, 0, 255 EQUB LO(SCBASE + $20 + ((I% AND $F8) * 40)) NEXT