Prev: 8830 Up: Map Next: 894F
883C: Handler: Sub-Game
Used by the routine at Handler_LocationChoice.
Handler_SubGame 883C POP DE Discard the last entry on the stack.
883D LD HL,($EFF2) Loads a pointer to the current players score and cash balance into HL. The active player reference is via *Pointer_ActivePlayer.
8840 LD DE,$000A
8843 ADD HL,DE
8844 LD DE,$EFF4 Copy the 0005 bytes of data for the score and cash balance from *HL to *ActivePlayerScore/ *ActivePlayerCash_01.
8847 LD BC,$0005
884A LDIR
884C EX DE,HL Exchange the DE and HL registers.
884D LD (HL),$00 Write 00 to *HL.
884F LD HL,$EFFF Write 00 to *EFFF.
8852 LD (HL),$00
8854 CALL Initialise_SubGame Call Initialise_SubGame.
8857 LD HL,$EFFF Write 01 to *EFFF.
885A LD (HL),$01
885C LD IX,($EFF2) IX=Pointer_ActivePlayer.
8860 LD A,($EFF4) Copy the three bytes of *ActivePlayerScore to the current players score storage.
8863 LD (IX+$0A),A
8866 LD A,($EFF5)
8869 LD (IX+$0B),A
886C LD A,($EFF6)
886F LD (IX+$0C),A
8872 LD HL,($EFF2) Loads a pointer to the current players cash balance into HL.
8875 LD DE,$000D
8878 ADD HL,DE
8879 LD DE,$EFF7 DE=ActivePlayerCash_01.
887C LD BC,($EFF7) Stash *ActivePlayerCash_01 on the stack.
8880 PUSH BC
8881 LD B,$02 B=02.
8883 CALL SpendMoney Call SpendMoney.
8886 POP BC Restore BC from the stack.
8887 LD (IX+$0D),C Write C to *IX+0D.
888A LD (IX+$0E),B Write B to *IX+0E.
888D JR C,Handler_SubGame_0 Jump to Handler_SubGame_0 if A is lower.
888F LD BC,($EFF7) Jump to Handler_SubGame_0 if *ActivePlayerCash_01 is zero.
8893 LD A,B
8894 OR C
8895 JR Z,Handler_SubGame_0
8897 LD DE,$FFFB HL+=FFFB.
889A ADD HL,DE
889B LD DE,$EFF7 DE=ActivePlayerCash_01.
889E EX DE,HL Exchange the DE and HL registers.
889F LD B,$03 B=03.
88A1 CALL AddMoney Call AddMoney.
88A4 LD HL,$EFFA HL=GameState_1.
88A7 SET 1,(HL) Set bit 1 ("Has Bonus Points?") of *HL.
88A9 RES 0,(HL) Reset bit 0 of *HL.
Handler_SubGame_0 88AB LD HL,$EFFA HL=GameState_1.
88AE BIT 4,(HL) Test bit 4 of *HL.
88B0 CALL Z,Check_AffordToFly Call Check_AffordToFly zero.
88B3 LD A,(HL) A=*HL.
88B4 AND %00111100 Keep only bits 2-5.
88B6 JR Z,Handler_SubGame_2 Jump to Handler_SubGame_2 if A is zero.
88B8 AND %00000100 Keep only bits 2.
88BA JR NZ,Handler_SubGame_1 Jump to Handler_SubGame_1 if A is not zero.
88BC RES 7,(IX+$0F) Reset bit 7 of *IX+0F.
88C0 JR Handler_SubGame_5 Jump to Handler_SubGame_5.
Handler_SubGame_1 88C2 LD BC,$8E82 BC=London_Location.
88C5 LD (IX+$08),C Write C to *IX+08.
88C8 LD (IX+$09),B Write B to *IX+09.
88CB JR Handler_SubGame_5 Jump to Handler_SubGame_5.
Handler_SubGame_2 88CD LD A,(IX+$0F) A=*IX+0F.
88D0 AND %00000011 Keep only bits 0-1.
88D2 LD L,(IX+$08) L=*IX+08.
88D5 LD H,(IX+$09) H=*IX+09.
88D8 LD BC,$0010 HL+=0010.
88DB ADD HL,BC
88DC LD C,A C=A.
88DD XOR (HL) Flip the bits according to *HL.
88DE LD (HL),A Write A to *HL.
88DF LD HL,$8E92 HL=London_State.
88E2 LD DE,$0011 DE=0011.
88E5 LD B,$0E B=0E.
Handler_SubGame_3 88E7 LD A,C A=C.
88E8 AND (HL) Merge the bits from *HL.
88E9 JR Z,Handler_SubGame_5 Jump to Handler_SubGame_5 if A is zero.
Handler_SubGame_4 88EB INC HL Increment HL by one.
88EC BIT 7,(HL) Test bit 7 of *HL.
88EE JR Z,Handler_SubGame_4 Jump to Handler_SubGame_4 if HL is zero.
88F0 ADD HL,DE HL+=DE.
88F1 DJNZ Handler_SubGame_3 Decrease counter by one and loop back to Handler_SubGame_3 until counter is zero.
88F3 LD HL,$EFFA HL=GameState_1.
88F6 SET 6,(HL) Set bit 6 of *HL.
88F8 RES 7,(IX+$0F) Reset bit 7 of *IX+0F.
Handler_SubGame_5 88FC POP HL Restore HL from the stack.
88FD CALL Print_WorldMap Call Print_WorldMap.
8900 CALL Print_Header Call Print_Header.
This entry point is used by the routine at ChooseLocationOrTakeJob.
Handler_SubGame_6 8903 CALL Messaging_GenerateTicker Call Messaging_GenerateTicker.
Handler_SubGame_7 8906 LD B,$01 Call 8055 with a count of 01.
8908 CALL $8055
890B LD HL,$EFFB HL=GameState_2.
890E BIT 0,(HL) Test bit 0 ("Ticker On/ Off") of *HL.
8910 JR NZ,Handler_SubGame_7 Jump to Handler_SubGame_7 if HL is not zero.
8912 LD IX,($EFF2) IX=Pointer_ActivePlayer.
8916 BIT 7,(IX+$0F) Call HighScoreTable if bit 7 of *IX+0F is zero.
891A CALL Z,HighScoreTable
891D CALL Toggle_Players Call Toggle_Players.
8920 JP NZ,GameLoop Jump to GameLoop if HL is not zero.
8923 CALL Toggle_Players Call Toggle_Players.
8926 JP NZ,GameLoop Jump to GameLoop if HL is not zero.
8929 LD HL,$EFFB HL=GameState_2.
892C BIT 6,(HL) Test bit 6 of *HL.
892E CALL Z,HighScoreTable_6 Call HighScoreTable_6 zero.
8931 CALL ClearMenuScreenAreas Call ClearMenuScreenAreas.
Prints "Change of control".
8934 LD HL,$8E34 HL=Messaging_ChangeControls.
8937 LD DE,$5069 DE=5069 (screen buffer location).
893A CALL Print_String Call Print_String.
Prints "or players reqd.".
893D LD HL,$8E45 HL=Messaging_ChangePlayers.
8940 LD DE,$5089 DE=5089 (screen buffer location).
8943 CALL Print_String Call Print_String.
8946 CALL Select_Yes/No Call Select_Yes/No.
8949 JP C,ShowMenu Jump to ShowMenu if HL is lower.
894C JP NewGame Jump to NewGame.
Prev: 8830 Up: Map Next: 894F