![]() |
Routines |
Prev: 52689 | Up: Map | Next: 53238 |
See Access Hidden Game.
|
|||||
|
|||||
GoldfishGame | 52801 | CALL ClearScreen | Call ClearScreen. | ||
Print the playing instructions.
|
|||||
52804 | LD DE,56730 | DE=Messaging_GoldfishGame. | |||
52807 | CALL PrintString | Call PrintString. | |||
Pause to let the message sink in...
|
|||||
52810 | LD BC,300 | BC=300 (pause loops). | |||
GoldfishGame_PauseLoop | 52813 | PUSH BC | Stash the pause loop counter on the stack. | ||
52814 | CALL SmallPause | Call SmallPause. | |||
52817 | POP BC | Restore the pause loop counter from the stack. | |||
52818 | DEC BC | Decrease the pause loop counter by one. | |||
52819 | LD A,B | Jump to GoldfishGame_PauseLoop until the pause loop counter is zero. | |||
52820 | OR C | ||||
52821 | JR NZ,GoldfishGame_PauseLoop | ||||
Initialise the number of goldfish needed to complete this mini-game.
|
|||||
52823 | LD A,20 | Write 20 to *GoldfishGame_FishToCollect. | |||
52825 | LD (56132),A | ||||
52828 | LD A,5 | Set the border to CYAN using BORDER. | |||
52830 | CALL 8859 | ||||
52833 | LD A,5 | Write CYAN (5) to *Active_BorderColour. | |||
52835 | LD (23504),A | ||||
52838 | LD A,56 | Write INK: BLACK, PAPER: WHITE (56) to *ATTR_P. | |||
52840 | LD (23693),A | ||||
52843 | CALL ClearScreen | Call ClearScreen. | |||
Start colouring the game playarea.
This is colourised in bands. First, 16 blue lines (from the bottom).
|
|||||
52846 | LD B,16 | B=16. | |||
52848 | LD A,8 | Write INK: BLACK, PAPER: BLUE (8) to *ATTR_P. | |||
52850 | LD (23693),A | ||||
52853 | CALL 3652 | Clear the bottom 16 lines using CL_LINE. | |||
Next, 8 yellow lines (again, from the bottom).
|
|||||
52856 | LD A,48 | Write INK: BLACK, PAPER: YELLOW (48) to *ATTR_P. | |||
52858 | LD (23693),A | ||||
52861 | LD B,3 | Clear the bottom 8 lines using CL_LINE. | |||
52863 | CALL 3652 | ||||
Finally, 2 cyan lines (again, from the bottom).
|
|||||
52866 | LD A,40 | Write INK: BLACK, PAPER: CYAN (40) to *ATTR_P. | |||
52868 | LD (23693),A | ||||
52871 | LD B,2 | Clear the bottom 2 lines using CL_LINE. | |||
52873 | CALL 3652 | ||||
This entry point is used by the routine at StartGame.
|
|||||
GoldfishGame_InitialiseGame | 52876 | LD IX,56334 | IX=GoldfishGame_PlayerAttributes. | ||
52880 | LD (IX+0),15 | Set the player starting position: 15/ 10. | |||
52884 | LD (IX+1),10 | ||||
52888 | LD (IX+2),3 | Set the player horizontal and vertical position offsets: 3/ 3. | |||
52892 | LD (IX+3),3 | ||||
52896 | LD (IX+4),0 | Write 0 to *GoldfishGame_FlagPlayerHorizontal. | |||
52900 | LD (IX+5),0 | Write 0 to *GoldfishGame_FlagPlayerVertical. | |||
52904 | LD (IX+6),32 | Write 32 to *GoldfishGame_PlayerSpriteID. | |||
52908 | LD (IX+7),2 | Write 2 to *GoldfishGame_PlayerWidth. | |||
52912 | LD (IX+8),1 | Write 1 to *GoldfishGame_PlayerHeight. | |||
52916 | LD (IX+9),7 | Write WHITE to *GoldfishGame_PlayerColour. | |||
52920 | LD (IX+10),1 | Write 1 to *IX+10. | |||
52924 | LD (IX+11),3 | Write 3 to *IX+11. | |||
52928 | LD (IX+12),3 | Write 3 to *IX+12. | |||
52932 | LD (IX+13),15 | Write 15 to *IX+13. | |||
52936 | LD (IX+14),10 | Write 10 to *IX+14. | |||
52940 | LD (IX+15),3 | Write 3 to *IX+15. | |||
52944 | LD BC,100 | BC=0100. | |||
52947 | LD DE,56134 | DE=Data_SeaCreatures. | |||
52950 | LD HL,41068 | HL=Graphics_MaskSprite. | |||
52953 | LDIR | Copy 0100 bytes of data from *Graphics_MaskSprite to *Data_SeaCreatures. | |||
52955 | LD HL,41068 | HL=Graphics_MaskSprite. | |||
52958 | LD DE,56234 | DE=56234. | |||
52961 | LD BC,100 | BC=0100. | |||
52964 | LDIR | Copy 0100 bytes of data from *Graphics_MaskSprite to *56234. | |||
Randomly choose sand UDGs and write them into the Sand Animation Buffer. Note; the count is one screen width +1 (so 33) so the animation doesn't happen on-screen.
|
|||||
PopulateSandBuffer | 52966 | LD DE,56354 | DE=Buffer_SandAnimation. | ||
52969 | LD B,33 | B=33 (counter; number of sand UDGs to copy). | |||
PopulateSandBuffer_Loop | 52971 | PUSH BC | Stash the sand UDG counter and sand animation buffer pointer on the stack. | ||
52972 | PUSH DE | ||||
52973 | CALL UpdateAnimationCounter | Fetch a semi-random number from 0-15 and store it in A. | |||
52976 | AND %00001111 | ||||
52978 | LD E,A | HL=Graphics_GoldfishGameSand+(A*8). | |||
52979 | LD D,0 | ||||
52981 | SLA E | ||||
52983 | SLA E | ||||
52985 | SLA E | ||||
52987 | LD HL,38476 | ||||
52990 | ADD HL,DE | ||||
52991 | POP DE | Restore the sand animation buffer pointer from the stack. | |||
52992 | LD BC,8 | BC=0008. | |||
52995 | LDIR | Copy a sand UDG (0008 bytes of data) to the sand animation buffer. | |||
52997 | POP BC | Restore the sand UDG counter from the stack. | |||
52998 | DJNZ PopulateSandBuffer_Loop | Decrease the sand UDG counter by one and loop back to PopulateSandBuffer_Loop until it is zero. | |||
53000 | CALL GoldfishGame_PrintBoats | Call GoldfishGame_PrintBoats. | |||
Set up the status bar.
Set the co-ordinates of where we're going to PRINT AT.
|
|||||
53003 | LD B,2 | Set up the screen buffer location 2/33 using CL_SET. | |||
53005 | LD C,33 | ||||
53007 | CALL 3545 | ||||
Restore the default ZX Spectrum font.
|
|||||
53010 | LD HL,15360 | Write 15360 (CHARSET-256) to *CHARS. | |||
53013 | LD (23606),HL | ||||
Print the status bar messaging.
|
|||||
53016 | LD DE,55762 | DE=Messaging_FishGameStatusBar. | |||
53019 | CALL PrintString | Call PrintString. | |||
Draw the oxygen bar at the bottom of the screen.
|
|||||
53022 | CALL GoldfishGame_PrintAirBar | Call GoldfishGame_PrintAirBar. | |||
Reset any bubble data.
|
|||||
53025 | LD HL,56618 | HL=Data_Bubbles. | |||
53028 | LD A,0 | A=0. | |||
53030 | LD B,110 | B=110. | |||
GoldfishGame_ClearBubblesLoop | 53032 | LD (HL),A | Write 0 to *HL. | ||
53033 | INC HL | Increment HL by one. | |||
53034 | DJNZ GoldfishGame_ClearBubblesLoop | Decrease counter by one and loop back to GoldfishGame_ClearBubblesLoop until counter is zero. | |||
Set player game entry variables.
|
|||||
53036 | LD A,0 | Write 0 to *GoldfishGame_FishCaught. | |||
53038 | LD (56130),A | ||||
53041 | LD A,19 | Write 19 to *GoldfishGame_OxygenLevel. | |||
53043 | LD (54078),A | ||||
The "normal" game just starts on completion of the Goldfish game.
|
|||||
GoldfishGame_GameLoop | 53046 | LD A,(56132) | Jump to StartGame if *GoldfishGame_FishCaught is equal to *GoldfishGame_FishToCollect. | ||
53049 | LD B,A | ||||
53050 | LD A,(56130) | ||||
53053 | CP B | ||||
53054 | JP Z,StartGame | ||||
Handle the player "spending" air (only every 16th frame).
|
|||||
53057 | CALL GoldfishGame_AirBar | Call GoldfishGame_AirBar. | |||
53060 | CALL GoldfishGame_AnimateSand | Call GoldfishGame_AnimateSand. | |||
53063 | LD A,(55613) | Increment *GoldfishGame_BuoyancyCounter by one. | |||
53066 | INC A | ||||
53067 | LD (55613),A | ||||
53070 | CALL GoldfishGame_AnimatePlayer | Call GoldfishGame_AnimatePlayer. | |||
Add the "float up" effect on every fourth frame.
|
|||||
53073 | LD A,(55613) | Call GoldfishGame_PlayerMoveUp when GoldfishGame_BuoyancyCounter is divisable by 4 (with no remainder). | |||
53076 | AND %00000011 | ||||
53078 | CALL Z,GoldfishGame_PlayerMoveUp | ||||
53081 | LD BC,(56728) | BC=*56728. | |||
53085 | CALL Handler_SeaCreatures | Call Handler_SeaCreatures. | |||
53088 | CALL UpdateAnimationCounter | Get a semi-random number between 1-8 and store it in B. | |||
53091 | AND %00000111 | ||||
53093 | INC A | ||||
53094 | LD B,A | ||||
53095 | CALL Handler_SeaCreatures | Call Handler_SeaCreatures. | |||
53098 | CALL 54476 | Call 54476. | |||
53101 | CALL GoldfishGame_Handler_Bubbles | Call GoldfishGame_Handler_Bubbles. | |||
53104 | CALL GoldfishGame_PlayerControls | Call GoldfishGame_PlayerControls. | |||
53107 | CALL GoldfishGame_AnimateBoats | Call GoldfishGame_AnimateBoats. | |||
53110 | LD A,(54078) | Jump to GoldfishGame_PrintFishCaught if *GoldfishGame_OxygenLevel is equal to 0. | |||
53113 | CP 0 | ||||
53115 | JP Z,GoldfishGame_PrintFishCaught | ||||
53118 | LD A,(56728) | B=*56728. | |||
53121 | LD B,A | ||||
53122 | LD IX,56134 | IX=Data_SeaCreatures. | |||
GoldfishGame_ProcessCreature | 53126 | PUSH BC | Stash BC on the stack. | ||
53127 | LD A,(IX+10) | Jump to GoldfishGame_NextCreature if *IX+10 is equal to 0. | |||
53130 | CP 0 | ||||
53132 | JR Z,GoldfishGame_NextCreature | ||||
53134 | LD A,(56335) | A=*56335. | |||
53137 | DEC A | Decrease A by one. | |||
53138 | ADD A,(IX+8) | A+=*IX+8. | |||
53141 | LD B,(IX+1) | B=*IX+1. | |||
53144 | SUB B | A-=B. | |||
53145 | LD B,(IX+8) | B=*IX+8. | |||
53148 | INC B | Increment B by one. | |||
53149 | CP B | Jump to GoldfishGame_Collision if A is lower than B. | |||
53150 | JR C,GoldfishGame_Collision | ||||
This entry point is used by the routine at GoldfishGame_Collision.
|
|||||
GoldfishGame_NextCreature | 53152 | POP BC | Restore BC from the stack. | ||
53153 | LD DE,24 | DE=0024. | |||
53156 | ADD IX,DE | IX+=DE. | |||
53158 | DJNZ GoldfishGame_ProcessCreature | Decrease counter by one and loop back to GoldfishGame_ProcessCreature until counter is zero. | |||
Print the number of fish the player has caught so far.
|
|||||
GoldfishGame_PrintFishCaught | 53160 | LD A,16 | Set INK: BLACK (0). | ||
53162 | RST 16 | ||||
53163 | LD A,0 | ||||
53165 | RST 16 | ||||
53166 | LD A,17 | Set PAPER: CYAN (5). | |||
53168 | RST 16 | ||||
53169 | LD A,5 | ||||
53171 | RST 16 | ||||
Restore the default ZX Spectrum font.
|
|||||
53172 | LD HL,15360 | Write 15360 (CHARSET-256) to *CHARS. | |||
53175 | LD (23606),HL | ||||
53178 | LD B,2 | Set up the screen buffer location 2/28 using CL_SET. | |||
53180 | LD C,28 | ||||
53182 | CALL 3545 | ||||
|
|||||
53185 | LD A,(56130) | BC=*GoldfishGame_FishCaught. | |||
53188 | LD C,A | ||||
53189 | LD B,0 | ||||
53191 | CALL 6683 | Call OUT_NUM_1. | |||
53194 | LD A,32 | A=ASCII "space" (32). | |||
53196 | CALL GoldfishGame_PrintColourUDG | Call GoldfishGame_PrintColourUDG. | |||
53199 | LD A,(56335) | Jump to GoldfishGame_GameLoop if *56335 is not equal to 16. | |||
53202 | CP 16 | ||||
53204 | JP NZ,GoldfishGame_GameLoop | ||||
53207 | LD A,(56337) | Jump to GoldfishGame_GameLoop if *56337 is not equal to 3. | |||
53210 | CP 3 | ||||
53212 | JP NZ,GoldfishGame_GameLoop | ||||
53215 | LD A,(56334) | C=*GoldfishGame_PlayerAttributes. | |||
53218 | LD C,A | ||||
53219 | LD A,33 | A=33. | |||
53221 | SUB C | A-=C. | |||
53222 | LD HL,18400 | HL=18400 (screen buffer location). | |||
53225 | LD E,A | E=A. | |||
53226 | LD D,0 | D=0. | |||
53228 | ADD HL,DE | HL+=DE. | |||
53229 | LD A,(HL) | Jump to GoldfishGame_RefillOxygen if *HL is equal to 0. | |||
53230 | CP 0 | ||||
53232 | JP Z,GoldfishGame_RefillOxygen | ||||
53235 | JP GoldfishGame_GameLoop | Jump to GoldfishGame_GameLoop. |
Prev: 52689 | Up: Map | Next: 53238 |