![]() |
Routines |
| Prev: D69A | Up: Map | Next: D6A0 |
|
Used by the routine at main.
Fills reverse_bits_tbl and the fourteen pages above it at start-up with tables the drawing code needs every frame and would otherwise have to compute. At reverse_bits_tbl itself is the bit-reversal of every byte value. Reversing bits is how a sprite is mirrored horizontally, which is how the game gets a knight facing west out of one facing east.
The fourteen pages from shift_tbls up are the shifted bytes, in pairs: for each shift s from 1 to 7, page $F0 + 2s holds every byte shifted right s places, and the page above it the bits that fall out into the next byte. Both are stored complemented. sprite_row_jump uses one value from such a table to do two jobs: ANDed with the background it clears the bits under the mask, and XORed with the result and then complemented it adds the image.
|
||||
| build_lookup_tbls | D69E | LD L,$00 | every byte value, L from 0 | |
| Prev: D69A | Up: Map | Next: D6A0 |