Prev: 83B5 Up: Map Next: 8401
83CD: Bootstrap / Über main loop
This is the true start and main loop of the game. It's called once the memory map is set up. It builds a table of 256 flipped bytes at $EF00 then starts attract mode. When the player causes attract mode to yield, the overtaking bonus, the score and the retry count are reset as are the wanted stage number and the number of credits. The main loop is then called to run the game. Then when the main loop yields it will start the 128K animated title screen, or just loop if we're running on a 48K machine.
Used by the routine at E839.
Build a table of flipped bytes at $EF00.
bootstrap 83CD LD HL,$EF00 Point HL at $EF00
bs_flip_table_loop 83D0 LD B,$08 8 iterations
83D2 LD A,L A is the index into the table
bs_flip_byte_loop 83D3 RLCA Shift a bit out of A leftwards and into C rightwards
83D4 RR C
83D6 DJNZ bs_flip_byte_loop Loop for 8 bits
83D8 LD (HL),C Write C out and advance
83D9 INC L
83DA JR NZ,bs_flip_table_loop Loop for 256 iterations (until L overflows)
Start attract mode.
83DC CALL attract_mode_hook Call attract_mode_hook
When attract mode yields then we set up the game.
83DF XOR A Reset overtake_bonus
83E0 LD ($A13C),A
Clear score_bcd and retry_count.
83E3 LD HL,$8002
83E6 LD B,$05
bs_clear_loop 83E8 LD (HL),A
83E9 INC HL
83EA DJNZ bs_clear_loop
Reset wanted_stage_number and credits.
83EC INC A wanted_stage_number = 1
83ED LD (HL),A
83EE INC A credits = 2
83EF LD ($A13D),A
83F2 CALL main_loop Call the main loop
Call the 128K/bank 3 ?bootstrap routine.
83F5 LD A,($A139) Check for 128K mode
83F8 AND A
83F9 LD HL,$C003 Entry point for ?bootstrap
83FC CALL NZ,$81AA Call relocated call_bank_3_128k if in 128K mode
83FF JR bootstrap Loop
Prev: 83B5 Up: Map Next: 8401