Prev: F856 Up: Map Next: F880
F86B: Build the shift tables
Used by the routine at start.
Called once by the start (start). Makes three pairs of pages: for a shift of 2 pixels, shift_tables + n is n shifted right two bits and the next page's byte n the two bits that fall off the right, at the top of a byte; for 4, loader_copy and the page after it; for 6, loader_leftover_charset and the page after it. A byte drawn shifted is then two lookups: the left-hand screen byte gets the high page, the right-hand one the low page. These pages overwrite the end of the loaded block, the loader's copy routine at loader_copy and the loader's stack below loader_leftover_charset among it. Then the landscape pieces are shifted with them (build_shifted_pieces) and the bit-reversed table made (build_bit_reverse).
The tables are used afterwards too: toggle_carried_part reads the loader_copy page, clamp_climb and clamp_object_speed the page after it.
build_shift_tables F86B LD HL,shift_tables From shift_tables; two bits first
F86E LD B,$02
This entry point is used by the routine at sprite_buffer_two.
build_shift_tables_0 F870 LD C,$00 DE = n shifted right B bits, across two bytes
This entry point is used by the routine at sprite_buffer_two.
build_shift_tables_1 F872 LD D,C
F873 LD E,$00
F875 LD A,B
build_shift_tables_2 F876 SRL D
F878 RR E
F87A DEC A
F87B JR NZ,build_shift_tables_2 }
F87D LD (HL),D The high part in this page, the low part in the next
F87E INC H
F87F LD (HL),E
Prev: F856 Up: Map Next: F880