Skip to navigation

Aviator on the BBC Micro

Graphics: xLookupHi

Name: xLookupHi [Show more] Type: Variable Category: Graphics Summary: Lookup table for converting pixel x-coordinate to high byte of screen address
Context: See this variable in context in the source code References: This variable is used as follows: * DrawCanopyLine (Part 1 of 9) calls xLookupHi * DrawVectorLine (Part 3 of 3) calls xLookupHi

Each character block contains 8 bytes, so this lookup table lets us convert a pixel x-coordinate to a 16-bit address offset from the beginning of the character row. We could achieve the same effect by simply multiplying the pixel x-coordinate by 8, but using a lookup table is quicker than doing the multiplication.
.xLookupHi FOR I%, 0, 39 EQUB HI(I% * 8) NEXT