Prev: 8003 Up: Map Next: 8055
803A: Initialise Location States
Used by the routine at GameInitialise.
Start with Madrid, as it's the first location in the table Trashman can travel to (London doesn't count, that's the first game!)
Initialise_LocationStates 803A LD HL,$8EAA Set a pointer in HL for the first location state: Madrid_State.
803D LD DE,$0011 Set 0011 in DE, which is the count of data before the location name starts. The location names vary in length but the data for them does not.
8040 LD B,$0D Set a counter in B of the number of locations which have a playable level for Trashman (0D - one less than the total which includes London).
Initialise_LocationState 8042 LD (HL),$00 Mark this location as: "Not visited".
Keep moving forward one byte until the termination bit is found, signifying the final character of the location name.
FindEndCharacter_Loop 8044 INC HL Increment HL by one.
8045 BIT 7,(HL) Jump to FindEndCharacter_Loop if the terminator bit is not set.
8047 JR Z,FindEndCharacter_Loop
8049 ADD HL,DE Move HL to point to the next location state.
804A DJNZ Initialise_LocationState Decrease the location counter by one and loop back to Initialise_LocationState until all of the location states have been processeed.
804C LD A,($EFFB) Reset all the bits in *GameState_2 except for the 1UP/ 2UP choice.
804F AND %00100000
8051 LD ($EFFB),A
8054 RET Return.
Prev: 8003 Up: Map Next: 8055