![]() |
Routines |
| Prev: 8666 | Up: Map | Next: 8824 |
|
Used by the routine at GameInitialise.
|
||||
| Handler_LocationChoice | 8749 | LD A,($7811) | A=*TemporaryScreenLocation. | |
| 874C | OR %00001000 | Set bit 3. | ||
| 874E | LD C,A | C=A. | ||
| 874F | LD A,$88 | Initialise *TemporaryScreenLocation with 88. | ||
| 8751 | LD ($7811),A | |||
| 8754 | PUSH BC | Stash BC on the stack. | ||
| 8755 | CALL Print_ArrowSymbol | Call Print_ArrowSymbol. | ||
| 8758 | CALL PauseCheck | Call PauseCheck. | ||
|
Loop round until player input is detected.
|
||||
| Handler_LocationChoice_InputLoop | 875B | LD B,$0A | Call 8055 with a count of 0A. | |
| 875D | CALL $8055 | |||
| 8760 | CALL Handler_Controls | Call Handler_Controls. | ||
| 8763 | LD A,E | Jump to ProcessLocationChoiceInput_Up if "up" was pressed. | ||
| 8764 | CP $18 | |||
| 8766 | JP Z,ProcessLocationChoiceInput_Up | |||
| 8769 | CP $08 | Jump to ProcessLocationChoiceInput_Down if "down" was pressed. | ||
| 876B | JP Z,ProcessLocationChoiceInput_Down | |||
| 876E | CP $20 | Jump to Handler_LocationChoice_InputLoop if anything other than "fire" was pressed. | ||
| 8770 | JR NZ,Handler_LocationChoice_InputLoop | |||
|
Process the player pressing "fire".
|
||||
| 8772 | LD IX,($EFF2) | IX=*Pointer_ActivePlayer. | ||
| 8776 | LD L,(IX+$08) | Fetch the players current location and store it in HL. | ||
| 8779 | LD H,(IX+$09) | |||
| 877C | LD BC,$0004 | Set the increment between destinations in BC. | ||
| 877F | LD A,($7811) | Set the selected position from *TemporaryScreenLocation in E. | ||
| 8782 | LD E,A | |||
| 8783 | LD A,$88 | Set the position of the top destination in A. | ||
|
With the selected position being in E, start with A being the position of the top entry (88) and check if the values match, if they don't - loop back round adding 20 to the checking value in A until a a match is found (and the destination will be in HL).
|
||||
| CalculateSelectedDestination_Loop | 8785 | ADD HL,BC | Move HL to the next destination. | |
| 8786 | CP E | Jump to FoundSelectedDestination if A is equal to the selected position. | ||
| 8787 | JR Z,FoundSelectedDestination | |||
| 8789 | ADD A,$20 | Move down one line. | ||
| 878B | JR CalculateSelectedDestination_Loop | Jump to CalculateSelectedDestination_Loop. | ||
|
Destination has been found.
|
||||
| FoundSelectedDestination | 878D | LD C,(HL) | C=*HL. | |
| 878E | INC HL | Increment HL by one. | ||
| 878F | LD A,$60 | Jump to Handler_SubGame if *HL is lower than 60. | ||
| 8791 | CP (HL) | |||
| 8792 | JP NC,Handler_SubGame | |||
| 8795 | LD B,(HL) | B=*HL. | ||
| 8796 | INC HL | Increment HL by one. | ||
| 8797 | LD E,(HL) | Stash the pointer to the cost on the stack. | ||
| 8798 | PUSH HL | |||
| 8799 | INC HL | Load the cost of this trip into DE. | ||
| 879A | LD D,(HL) | |||
| 879B | LD L,(IX+$0D) | Load the players cash balance into HL. | ||
| 879E | LD H,(IX+$0E) | |||
| 87A1 | AND A | Jump to NotEnoughMoneyToFly if the players cash balance is lower than the cost of this trip. | ||
| 87A2 | SBC HL,DE | |||
| 87A4 | JR C,NotEnoughMoneyToFly | |||
|
The player can afford the trip, so continue.
|
||||
| 87A6 | LD (IX+$08),C | Update the players current destination with the new destination. | ||
| 87A9 | LD (IX+$09),B | |||
| 87AC | LD HL,$0002 | Move HL to point to the co-ordinates of the destination. | ||
| 87AF | ADD HL,BC | |||
| 87B0 | LD C,(HL) | Load the map co-ordinates into BC. | ||
| 87B1 | INC HL | |||
| 87B2 | LD B,(HL) | |||
| 87B3 | LD ($7807),BC | Write the map co-ordinates to *DestinationLocationCoordinates. | ||
|
Spent the money on the air fare.
|
||||
| 87B7 | LD HL,($EFF2) | Store a pointer to the players cash balance in DE. | ||
| 87BA | LD DE,$000D | |||
| 87BD | ADD HL,DE | |||
| 87BE | EX DE,HL | |||
| 87BF | POP HL | Restore the pointer to the cost of this trip from the stack into HL. | ||
| 87C0 | LD B,$02 | Call SpendMoney with 02 digits to process. | ||
| 87C2 | CALL SpendMoney | |||
|
Print the updated cash balance to the screen.
|
||||
| 87C5 | DEC DE | Decrease the cash balance pointer by one to point to the correct starting position (the print call moved it). Move this to HL. | ||
| 87C6 | EX DE,HL | |||
| 87C7 | LD DE,$403B | DE=403B (screen buffer location). | ||
| 87CA | LD BC,$0202 | BC=0202. | ||
| 87CD | CALL PrintNumbers | Call PrintNumbers. | ||
| 87D0 | POP HL | Restore HL from the stack (housekeeping, this is immediately thrown away). | ||
| 87D1 | LD HL,$EFFA | Set bit 7 ("Flying To New Destination") of *GameState_1. | ||
| 87D4 | SET 7,(HL) | |||
| 87D6 | CALL Messaging_GenerateTicker | Call Messaging_GenerateTicker. | ||
| 87D9 | CALL ClearMenuScreenAreas | Call ClearMenuScreenAreas. | ||
| 87DC | JP CalculateFlightPath | Jump to CalculateFlightPath. | ||
|
Prints "No DiscountsAllowed".
|
||||
| NotEnoughMoneyToFly | 87DF | POP DE | Restore DE from the stack (housekeeping, this is immediately thrown away). | |
|
Prints "No ".
|
||||
| 87E0 | LD HL,$8C10 | HL=Messaging_No. | ||
| 87E3 | LD DE,$50A3 | DE=50A3 (screen buffer location). | ||
| 87E6 | CALL Print_String | Call Print_String. | ||
|
Prints "Discounts".
|
||||
| 87E9 | LD DE,$50C0 | DE=50C0 (screen buffer location). | ||
| 87EC | CALL Print_String | Call Print_String. | ||
|
Prints "Allowed".
|
||||
| 87EF | LD DE,$50E1 | DE=50E1 (screen buffer location). | ||
| 87F2 | CALL Print_String | Call Print_String. | ||
| 87F5 | JP Handler_LocationChoice_InputLoop | Jump to Handler_LocationChoice_InputLoop. | ||
|
Process the player pressing "up".
|
||||
| ProcessLocationChoiceInput_Up | 87F8 | CALL Erase_ArrowSymbol | Call Erase_ArrowSymbol. | |
| 87FB | POP BC | Restore BC from the stack. | ||
| 87FC | LD A,($7811) | Jump to LocationChoice_MoveChoice if *TemporaryScreenLocation is equal to with 88. | ||
| 87FF | CP $88 | |||
| 8801 | JR Z,LocationChoice_MoveChoice | |||
| 8803 | SUB $20 | A-=20. | ||
| UpdateDestinationChoice | 8805 | LD ($7811),A | Write A to *TemporaryScreenLocation. | |
| 8808 | PUSH BC | Stash BC on the stack. | ||
| 8809 | CALL Print_ArrowSymbol | Call Print_ArrowSymbol. | ||
| 880C | JP Handler_LocationChoice_InputLoop | Jump to Handler_LocationChoice_InputLoop. | ||
|
Process the player pressing "down".
|
||||
| ProcessLocationChoiceInput_Down | 880F | CALL Erase_ArrowSymbol | Call Erase_ArrowSymbol. | |
| 8812 | POP BC | Restore BC from the stack. | ||
| 8813 | LD A,($7811) | Jump to LocationChoice_BackToTop if *TemporaryScreenLocation is equal to C. | ||
| 8816 | CP C | |||
| 8817 | JR Z,LocationChoice_BackToTop | |||
| 8819 | ADD A,$20 | A+=20. | ||
| 881B | JR UpdateDestinationChoice | Jump to UpdateDestinationChoice. | ||
|
Set the cursor position back to the initial "top" choice.
|
||||
| LocationChoice_BackToTop | 881D | LD A,$88 | A=88. | |
| 881F | JR UpdateDestinationChoice | Jump to UpdateDestinationChoice. | ||
| LocationChoice_MoveChoice | 8821 | LD A,C | A=C. | |
| 8822 | JR UpdateDestinationChoice | Jump to UpdateDestinationChoice. | ||
| Prev: 8666 | Up: Map | Next: 8824 |