Prev: F7EB Up: Map Next: F86B
F856: Build the bit-reversed table at bit_reverse_table
Used by the routine at sprite_buffer_two.
Jumped to at the end of build_shift_tables, after build_shifted_pieces has run: bit_reverse_table + n gets n with its bits in the opposite order, for mirroring graphics: the ship when it faces left, the landscape's left-climbing pieces (blit_mirror_two, blit_mirror_one), and the sprite routines mirror_ship_sprite, draw_ship, blit_mirrored_left_clip and others. It overwrites the start-up routines from bit_reverse_table to shift_slope_piece's end, which are done with by then; the code map shows them because the snapshot was taken before the game ran.
build_bit_reverse F856 LD C,$00 From bit_reverse_table, for n = 0 to 255
F858 LD HL,bit_reverse_table
build_bit_reverse_0 F85B LD B,$08 Shift n's bits out of the top of D and into the top of A
F85D LD D,C
F85E XOR A
build_bit_reverse_1 F85F SLA D
F861 RR A
F863 DJNZ build_bit_reverse_1
F865 LD (HL),A Store, and the next
F866 INC HL
F867 INC C
F868 JR NZ,build_bit_reverse_0
F86A RET
Prev: F7EB Up: Map Next: F86B