Prev: 34864 Up: Map Next: 35151
34876: Handler: Sub-Game
Used by the routine at Handler_LocationChoice.
Handler_SubGame 34876 POP DE Discard the last entry on the stack.
34877 LD HL,(61426) Loads a pointer to the current players score and cash balance into HL. The active player reference is via *Pointer_ActivePlayer.
34880 LD DE,10
34883 ADD HL,DE
34884 LD DE,61428 Copy the 0005 bytes of data for the score and cash balance from *HL to *ActivePlayerScore/ *ActivePlayerCash_01.
34887 LD BC,5
34890 LDIR
34892 EX DE,HL Exchange the DE and HL registers.
34893 LD (HL),0 Write 0 to *HL.
34895 LD HL,61439 Write 0 to *61439.
34898 LD (HL),0
34900 CALL Initialise_SubGame Call Initialise_SubGame.
34903 LD HL,61439 Write 1 to *61439.
34906 LD (HL),1
34908 LD IX,(61426) IX=Pointer_ActivePlayer.
34912 LD A,(61428) Copy the three bytes of *ActivePlayerScore to the current players score storage.
34915 LD (IX+10),A
34918 LD A,(61429)
34921 LD (IX+11),A
34924 LD A,(61430)
34927 LD (IX+12),A
34930 LD HL,(61426) Loads a pointer to the current players cash balance into HL.
34933 LD DE,13
34936 ADD HL,DE
34937 LD DE,61431 DE=ActivePlayerCash_01.
34940 LD BC,(61431) Stash *ActivePlayerCash_01 on the stack.
34944 PUSH BC
34945 LD B,2 B=2.
34947 CALL SpendMoney Call SpendMoney.
34950 POP BC Restore BC from the stack.
34951 LD (IX+13),C Write C to *IX+13.
34954 LD (IX+14),B Write B to *IX+14.
34957 JR C,Handler_SubGame_0 Jump to Handler_SubGame_0 if A is lower.
34959 LD BC,(61431) Jump to Handler_SubGame_0 if *ActivePlayerCash_01 is zero.
34963 LD A,B
34964 OR C
34965 JR Z,Handler_SubGame_0
34967 LD DE,65531 HL+=65531.
34970 ADD HL,DE
34971 LD DE,61431 DE=ActivePlayerCash_01.
34974 EX DE,HL Exchange the DE and HL registers.
34975 LD B,3 B=3.
34977 CALL AddMoney Call AddMoney.
34980 LD HL,61434 HL=GameState_1.
34983 SET 1,(HL) Set bit 1 ("Has Bonus Points?") of *HL.
34985 RES 0,(HL) Reset bit 0 of *HL.
Handler_SubGame_0 34987 LD HL,61434 HL=GameState_1.
34990 BIT 4,(HL) Test bit 4 of *HL.
34992 CALL Z,Check_AffordToFly Call Check_AffordToFly zero.
34995 LD A,(HL) A=*HL.
34996 AND %00111100 Keep only bits 2-5.
34998 JR Z,Handler_SubGame_2 Jump to Handler_SubGame_2 if A is zero.
35000 AND %00000100 Keep only bits 2.
35002 JR NZ,Handler_SubGame_1 Jump to Handler_SubGame_1 if A is not zero.
35004 RES 7,(IX+15) Reset bit 7 of *IX+15.
35008 JR Handler_SubGame_5 Jump to Handler_SubGame_5.
Handler_SubGame_1 35010 LD BC,36482 BC=London_Location.
35013 LD (IX+8),C Write C to *IX+8.
35016 LD (IX+9),B Write B to *IX+9.
35019 JR Handler_SubGame_5 Jump to Handler_SubGame_5.
Handler_SubGame_2 35021 LD A,(IX+15) A=*IX+15.
35024 AND %00000011 Keep only bits 0-1.
35026 LD L,(IX+8) L=*IX+8.
35029 LD H,(IX+9) H=*IX+9.
35032 LD BC,16 HL+=0016.
35035 ADD HL,BC
35036 LD C,A C=A.
35037 XOR (HL) Flip the bits according to *HL.
35038 LD (HL),A Write A to *HL.
35039 LD HL,36498 HL=London_State.
35042 LD DE,17 DE=0017.
35045 LD B,14 B=14.
Handler_SubGame_3 35047 LD A,C A=C.
35048 AND (HL) Merge the bits from *HL.
35049 JR Z,Handler_SubGame_5 Jump to Handler_SubGame_5 if A is zero.
Handler_SubGame_4 35051 INC HL Increment HL by one.
35052 BIT 7,(HL) Test bit 7 of *HL.
35054 JR Z,Handler_SubGame_4 Jump to Handler_SubGame_4 if HL is zero.
35056 ADD HL,DE HL+=DE.
35057 DJNZ Handler_SubGame_3 Decrease counter by one and loop back to Handler_SubGame_3 until counter is zero.
35059 LD HL,61434 HL=GameState_1.
35062 SET 6,(HL) Set bit 6 of *HL.
35064 RES 7,(IX+15) Reset bit 7 of *IX+15.
Handler_SubGame_5 35068 POP HL Restore HL from the stack.
35069 CALL Print_WorldMap Call Print_WorldMap.
35072 CALL Print_Header Call Print_Header.
This entry point is used by the routine at ChooseLocationOrTakeJob.
Handler_SubGame_6 35075 CALL Messaging_GenerateTicker Call Messaging_GenerateTicker.
Handler_SubGame_7 35078 LD B,1 Call 32853 with a count of 1.
35080 CALL 32853
35083 LD HL,61435 HL=GameState_2.
35086 BIT 0,(HL) Test bit 0 ("Ticker On/ Off") of *HL.
35088 JR NZ,Handler_SubGame_7 Jump to Handler_SubGame_7 if HL is not zero.
35090 LD IX,(61426) IX=Pointer_ActivePlayer.
35094 BIT 7,(IX+15) Call HighScoreTable if bit 7 of *IX+15 is zero.
35098 CALL Z,HighScoreTable
35101 CALL Toggle_Players Call Toggle_Players.
35104 JP NZ,GameLoop Jump to GameLoop if HL is not zero.
35107 CALL Toggle_Players Call Toggle_Players.
35110 JP NZ,GameLoop Jump to GameLoop if HL is not zero.
35113 LD HL,61435 HL=GameState_2.
35116 BIT 6,(HL) Test bit 6 of *HL.
35118 CALL Z,HighScoreTable_6 Call HighScoreTable_6 zero.
35121 CALL ClearMenuScreenAreas Call ClearMenuScreenAreas.
Prints "Change of control".
35124 LD HL,36404 HL=Messaging_ChangeControls.
35127 LD DE,20585 DE=20585 (screen buffer location).
35130 CALL Print_String Call Print_String.
Prints "or players reqd.".
35133 LD HL,36421 HL=Messaging_ChangePlayers.
35136 LD DE,20617 DE=20617 (screen buffer location).
35139 CALL Print_String Call Print_String.
35142 CALL Select_Yes/No Call Select_Yes/No.
35145 JP C,ShowMenu Jump to ShowMenu if HL is lower.
35148 JP NewGame Jump to NewGame.
Prev: 34864 Up: Map Next: 35151