Routines |
Prev: CDD1 | Up: Map | Next: CFF6 |
See Access Hidden Game.
|
|||||
|
|||||
GoldfishGame | CE41 | CALL ClearScreen | Call ClearScreen. | ||
Print the playing instructions.
|
|||||
CE44 | LD DE,$DD9A | DE=Messaging_GoldfishGame. | |||
CE47 | CALL PrintString | Call PrintString. | |||
Pause to let the message sink in...
|
|||||
CE4A | LD BC,$012C | BC=012C (pause loops). | |||
GoldfishGame_PauseLoop | CE4D | PUSH BC | Stash the pause loop counter on the stack. | ||
CE4E | CALL SmallPause | Call SmallPause. | |||
CE51 | POP BC | Restore the pause loop counter from the stack. | |||
CE52 | DEC BC | Decrease the pause loop counter by one. | |||
CE53 | LD A,B | Jump to GoldfishGame_PauseLoop until the pause loop counter is zero. | |||
CE54 | OR C | ||||
CE55 | JR NZ,GoldfishGame_PauseLoop | ||||
Initialise the number of goldfish needed to complete this mini-game.
|
|||||
CE57 | LD A,$14 | Write 14 to *GoldfishGame_FishToCollect. | |||
CE59 | LD ($DB44),A | ||||
CE5C | LD A,$05 | Set the border to CYAN using BORDER. | |||
CE5E | CALL $229B | ||||
CE61 | LD A,$05 | Write CYAN (05) to *Active_BorderColour. | |||
CE63 | LD ($5BD0),A | ||||
CE66 | LD A,$38 | Write INK: BLACK, PAPER: WHITE (38) to *ATTR_P. | |||
CE68 | LD ($5C8D),A | ||||
CE6B | CALL ClearScreen | Call ClearScreen. | |||
Start colouring the game playarea.
This is colourised in bands. First, 10 blue lines (from the bottom).
|
|||||
CE6E | LD B,$10 | B=10. | |||
CE70 | LD A,$08 | Write INK: BLACK, PAPER: BLUE (08) to *ATTR_P. | |||
CE72 | LD ($5C8D),A | ||||
CE75 | CALL $0E44 | Clear the bottom 10 lines using CL_LINE. | |||
Next, 08 yellow lines (again, from the bottom).
|
|||||
CE78 | LD A,$30 | Write INK: BLACK, PAPER: YELLOW (30) to *ATTR_P. | |||
CE7A | LD ($5C8D),A | ||||
CE7D | LD B,$03 | Clear the bottom 08 lines using CL_LINE. | |||
CE7F | CALL $0E44 | ||||
Finally, 02 cyan lines (again, from the bottom).
|
|||||
CE82 | LD A,$28 | Write INK: BLACK, PAPER: CYAN (28) to *ATTR_P. | |||
CE84 | LD ($5C8D),A | ||||
CE87 | LD B,$02 | Clear the bottom 02 lines using CL_LINE. | |||
CE89 | CALL $0E44 | ||||
This entry point is used by the routine at StartGame.
|
|||||
GoldfishGame_InitialiseGame | CE8C | LD IX,$DC0E | IX=GoldfishGame_PlayerAttributes. | ||
CE90 | LD (IX+$00),$0F | Set the player starting position: 0F/ 0A. | |||
CE94 | LD (IX+$01),$0A | ||||
CE98 | LD (IX+$02),$03 | Set the player horizontal and vertical position offsets: 03/ 03. | |||
CE9C | LD (IX+$03),$03 | ||||
CEA0 | LD (IX+$04),$00 | Write 00 to *GoldfishGame_FlagPlayerHorizontal. | |||
CEA4 | LD (IX+$05),$00 | Write 00 to *GoldfishGame_FlagPlayerVertical. | |||
CEA8 | LD (IX+$06),$20 | Write 20 to *GoldfishGame_PlayerSpriteID. | |||
CEAC | LD (IX+$07),$02 | Write 02 to *GoldfishGame_PlayerWidth. | |||
CEB0 | LD (IX+$08),$01 | Write 01 to *GoldfishGame_PlayerHeight. | |||
CEB4 | LD (IX+$09),$07 | Write WHITE to *GoldfishGame_PlayerColour. | |||
CEB8 | LD (IX+$0A),$01 | Write 01 to *IX+0A. | |||
CEBC | LD (IX+$0B),$03 | Write 03 to *IX+0B. | |||
CEC0 | LD (IX+$0C),$03 | Write 03 to *IX+0C. | |||
CEC4 | LD (IX+$0D),$0F | Write 0F to *IX+0D. | |||
CEC8 | LD (IX+$0E),$0A | Write 0A to *IX+0E. | |||
CECC | LD (IX+$0F),$03 | Write 03 to *IX+0F. | |||
CED0 | LD BC,$0064 | BC=0064. | |||
CED3 | LD DE,$DB46 | DE=Data_SeaCreatures. | |||
CED6 | LD HL,$A06C | HL=Graphics_MaskSprite. | |||
CED9 | LDIR | Copy 0064 bytes of data from *Graphics_MaskSprite to *Data_SeaCreatures. | |||
CEDB | LD HL,$A06C | HL=Graphics_MaskSprite. | |||
CEDE | LD DE,$DBAA | DE=DBAA. | |||
CEE1 | LD BC,$0064 | BC=0064. | |||
CEE4 | LDIR | Copy 0064 bytes of data from *Graphics_MaskSprite to *DBAA. | |||
Randomly choose sand UDGs and write them into the Sand Animation Buffer. Note; the count is one screen width +01 (so 21) so the animation doesn't happen on-screen.
|
|||||
PopulateSandBuffer | CEE6 | LD DE,$DC22 | DE=Buffer_SandAnimation. | ||
CEE9 | LD B,$21 | B=21 (counter; number of sand UDGs to copy). | |||
PopulateSandBuffer_Loop | CEEB | PUSH BC | Stash the sand UDG counter and sand animation buffer pointer on the stack. | ||
CEEC | PUSH DE | ||||
CEED | CALL UpdateAnimationCounter | Fetch a semi-random number from 00-0F and store it in A. | |||
CEF0 | AND %00001111 | ||||
CEF2 | LD E,A | HL=Graphics_GoldfishGameSand+(A*08). | |||
CEF3 | LD D,$00 | ||||
CEF5 | SLA E | ||||
CEF7 | SLA E | ||||
CEF9 | SLA E | ||||
CEFB | LD HL,$964C | ||||
CEFE | ADD HL,DE | ||||
CEFF | POP DE | Restore the sand animation buffer pointer from the stack. | |||
CF00 | LD BC,$0008 | BC=0008. | |||
CF03 | LDIR | Copy a sand UDG (0008 bytes of data) to the sand animation buffer. | |||
CF05 | POP BC | Restore the sand UDG counter from the stack. | |||
CF06 | DJNZ PopulateSandBuffer_Loop | Decrease the sand UDG counter by one and loop back to PopulateSandBuffer_Loop until it is zero. | |||
CF08 | CALL GoldfishGame_PrintBoats | Call GoldfishGame_PrintBoats. | |||
Set up the status bar.
Set the co-ordinates of where we're going to PRINT AT.
|
|||||
CF0B | LD B,$02 | Set up the screen buffer location 02/21 using CL_SET. | |||
CF0D | LD C,$21 | ||||
CF0F | CALL $0DD9 | ||||
Restore the default ZX Spectrum font.
|
|||||
CF12 | LD HL,$3C00 | Write 3C00 (CHARSET-0100) to *CHARS. | |||
CF15 | LD ($5C36),HL | ||||
Print the status bar messaging.
|
|||||
CF18 | LD DE,$D9D2 | DE=Messaging_FishGameStatusBar. | |||
CF1B | CALL PrintString | Call PrintString. | |||
Draw the oxygen bar at the bottom of the screen.
|
|||||
CF1E | CALL GoldfishGame_PrintAirBar | Call GoldfishGame_PrintAirBar. | |||
Reset any bubble data.
|
|||||
CF21 | LD HL,$DD2A | HL=Data_Bubbles. | |||
CF24 | LD A,$00 | A=00. | |||
CF26 | LD B,$6E | B=6E. | |||
GoldfishGame_ClearBubblesLoop | CF28 | LD (HL),A | Write 00 to *HL. | ||
CF29 | INC HL | Increment HL by one. | |||
CF2A | DJNZ GoldfishGame_ClearBubblesLoop | Decrease counter by one and loop back to GoldfishGame_ClearBubblesLoop until counter is zero. | |||
Set player game entry variables.
|
|||||
CF2C | LD A,$00 | Write 00 to *GoldfishGame_FishCaught. | |||
CF2E | LD ($DB42),A | ||||
CF31 | LD A,$13 | Write 13 to *GoldfishGame_OxygenLevel. | |||
CF33 | LD ($D33E),A | ||||
The "normal" game just starts on completion of the Goldfish game.
|
|||||
GoldfishGame_GameLoop | CF36 | LD A,($DB44) | Jump to StartGame if *GoldfishGame_FishCaught is equal to *GoldfishGame_FishToCollect. | ||
CF39 | LD B,A | ||||
CF3A | LD A,($DB42) | ||||
CF3D | CP B | ||||
CF3E | JP Z,StartGame | ||||
Handle the player "spending" air (only every 16th frame).
|
|||||
CF41 | CALL GoldfishGame_AirBar | Call GoldfishGame_AirBar. | |||
CF44 | CALL GoldfishGame_AnimateSand | Call GoldfishGame_AnimateSand. | |||
CF47 | LD A,($D93D) | Increment *GoldfishGame_BuoyancyCounter by one. | |||
CF4A | INC A | ||||
CF4B | LD ($D93D),A | ||||
CF4E | CALL GoldfishGame_AnimatePlayer | Call GoldfishGame_AnimatePlayer. | |||
Add the "float up" effect on every fourth frame.
|
|||||
CF51 | LD A,($D93D) | Call GoldfishGame_PlayerMoveUp when GoldfishGame_BuoyancyCounter is divisable by 04 (with no remainder). | |||
CF54 | AND %00000011 | ||||
CF56 | CALL Z,GoldfishGame_PlayerMoveUp | ||||
CF59 | LD BC,($DD98) | BC=*DD98. | |||
CF5D | CALL Handler_SeaCreatures | Call Handler_SeaCreatures. | |||
CF60 | CALL UpdateAnimationCounter | Get a semi-random number between 01-08 and store it in B. | |||
CF63 | AND %00000111 | ||||
CF65 | INC A | ||||
CF66 | LD B,A | ||||
CF67 | CALL Handler_SeaCreatures | Call Handler_SeaCreatures. | |||
CF6A | CALL $D4CC | Call D4CC. | |||
CF6D | CALL GoldfishGame_Handler_Bubbles | Call GoldfishGame_Handler_Bubbles. | |||
CF70 | CALL GoldfishGame_PlayerControls | Call GoldfishGame_PlayerControls. | |||
CF73 | CALL GoldfishGame_AnimateBoats | Call GoldfishGame_AnimateBoats. | |||
CF76 | LD A,($D33E) | Jump to GoldfishGame_PrintFishCaught if *GoldfishGame_OxygenLevel is equal to 00. | |||
CF79 | CP $00 | ||||
CF7B | JP Z,GoldfishGame_PrintFishCaught | ||||
CF7E | LD A,($DD98) | B=*DD98. | |||
CF81 | LD B,A | ||||
CF82 | LD IX,$DB46 | IX=Data_SeaCreatures. | |||
GoldfishGame_ProcessCreature | CF86 | PUSH BC | Stash BC on the stack. | ||
CF87 | LD A,(IX+$0A) | Jump to GoldfishGame_NextCreature if *IX+0A is equal to 00. | |||
CF8A | CP $00 | ||||
CF8C | JR Z,GoldfishGame_NextCreature | ||||
CF8E | LD A,($DC0F) | A=*DC0F. | |||
CF91 | DEC A | Decrease A by one. | |||
CF92 | ADD A,(IX+$08) | A+=*IX+08. | |||
CF95 | LD B,(IX+$01) | B=*IX+01. | |||
CF98 | SUB B | A-=B. | |||
CF99 | LD B,(IX+$08) | B=*IX+08. | |||
CF9C | INC B | Increment B by one. | |||
CF9D | CP B | Jump to GoldfishGame_Collision if A is lower than B. | |||
CF9E | JR C,GoldfishGame_Collision | ||||
This entry point is used by the routine at GoldfishGame_Collision.
|
|||||
GoldfishGame_NextCreature | CFA0 | POP BC | Restore BC from the stack. | ||
CFA1 | LD DE,$0018 | DE=0018. | |||
CFA4 | ADD IX,DE | IX+=DE. | |||
CFA6 | 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 | CFA8 | LD A,$10 | Set INK: BLACK (00). | ||
CFAA | RST $10 | ||||
CFAB | LD A,$00 | ||||
CFAD | RST $10 | ||||
CFAE | LD A,$11 | Set PAPER: CYAN (05). | |||
CFB0 | RST $10 | ||||
CFB1 | LD A,$05 | ||||
CFB3 | RST $10 | ||||
Restore the default ZX Spectrum font.
|
|||||
CFB4 | LD HL,$3C00 | Write 3C00 (CHARSET-0100) to *CHARS. | |||
CFB7 | LD ($5C36),HL | ||||
CFBA | LD B,$02 | Set up the screen buffer location 02/1C using CL_SET. | |||
CFBC | LD C,$1C | ||||
CFBE | CALL $0DD9 | ||||
|
|||||
CFC1 | LD A,($DB42) | BC=*GoldfishGame_FishCaught. | |||
CFC4 | LD C,A | ||||
CFC5 | LD B,$00 | ||||
CFC7 | CALL $1A1B | Call OUT_NUM_1. | |||
CFCA | LD A,$20 | A=ASCII "space" (20). | |||
CFCC | CALL GoldfishGame_PrintColourUDG | Call GoldfishGame_PrintColourUDG. | |||
CFCF | LD A,($DC0F) | Jump to GoldfishGame_GameLoop if *DC0F is not equal to 10. | |||
CFD2 | CP $10 | ||||
CFD4 | JP NZ,GoldfishGame_GameLoop | ||||
CFD7 | LD A,($DC11) | Jump to GoldfishGame_GameLoop if *DC11 is not equal to 03. | |||
CFDA | CP $03 | ||||
CFDC | JP NZ,GoldfishGame_GameLoop | ||||
CFDF | LD A,($DC0E) | C=*GoldfishGame_PlayerAttributes. | |||
CFE2 | LD C,A | ||||
CFE3 | LD A,$21 | A=21. | |||
CFE5 | SUB C | A-=C. | |||
CFE6 | LD HL,$47E0 | HL=47E0 (screen buffer location). | |||
CFE9 | LD E,A | E=A. | |||
CFEA | LD D,$00 | D=00. | |||
CFEC | ADD HL,DE | HL+=DE. | |||
CFED | LD A,(HL) | Jump to GoldfishGame_RefillOxygen if *HL is equal to 00. | |||
CFEE | CP $00 | ||||
CFF0 | JP Z,GoldfishGame_RefillOxygen | ||||
CFF3 | JP GoldfishGame_GameLoop | Jump to GoldfishGame_GameLoop. |
Prev: CDD1 | Up: Map | Next: CFF6 |