Prev: 5B7A Up: Map Next: 5B99
5B80: Move the game block down and undo its nibble shift
The tape's BASIC calls this once the game block has loaded, 512 bytes above where it runs. It ran during loading, which the build does not see, so it is described from reading alone. loader_copy, the copy routine the earlier PIC block left at the top of memory, moves the block down 512 bytes to game_entry; then an RRD walk down from the block's top moves every byte's nibbles along by one -- the tape holds the game four bits out of step -- and the game starts at game_entry.
After the game starts these 25 bytes are dead: the view's page's collision-box list (see ground_cell_top_left_rest) is written over them, and the stack grows down from just below them.
loader_entry 5B80 LD SP,loader_leftover_charset Stack under the copy routine's home; interrupts off for good
5B83 DI
5B84 CALL loader_copy Move the block down 512 bytes to game_entry (loader_copy)
5B87 LD HL,shift_tables From the top of the block down, 158 times 256 bytes; A starts at 0, so the top byte's high nibble becomes a zero
5B8A XOR A
5B8B LD BC,$9E00
loader_entry_0 5B8E RRD RRD: (HL)'s low nibble to A, A's old low nibble to (HL)'s high nibble, (HL)'s high nibble to its low nibble
5B90 DEC HL Down a byte, for every byte of the block: the whole block and the system variables under it, all but their first byte (hence the nonsense in them)
5B91 DEC C
5B92 JR NZ,loader_entry_0
5B94 DJNZ loader_entry_0
5B96 JP game_entry Start the game
Prev: 5B7A Up: Map Next: 5B99