![]() |
Routines |
| Prev: DFCB | Up: Map | Next: E058 |
|
Used by the routine at InitialiseGame.
|
||||
|
Restore the default ZX Spectrum font.
|
||||
| AllTreasureCollected | DFD3 | LD HL,$3C00 | Write 3C00 (CHARSET-0100) to *CHARS. | |
| DFD6 | LD ($5C36),HL | |||
|
Set the attributes.
|
||||
| DFD9 | LD A,$10 | Set INK: WHITE (07). | ||
| DFDB | RST $10 | |||
| DFDC | LD A,$07 | |||
| DFDE | RST $10 | |||
| DFDF | LD A,$11 | Set PAPER: *ActiveRoom_PaperColour. | ||
| DFE1 | RST $10 | |||
| DFE2 | LD A,($5BD1) | |||
| DFE5 | RST $10 | |||
|
Don't decrease *TimerGoldenKey every frame, we track a count of the frames and only decrease it every 20th frame.
|
||||
| DFE6 | LD BC,($5BFA) | Decrease *TimerGoldenKey_FrameSkip by one. | ||
| DFEA | DEC BC | |||
| DFEB | LD ($5BFA),BC | |||
| DFEF | LD A,B | Skip to DisplayGoldenKeyTimer if *TimerGoldenKey_FrameSkip is not yet zero. | ||
| DFF0 | OR C | |||
| DFF1 | JR NZ,DisplayGoldenKeyTimer | |||
|
14 frames have passed, so decrease the actual timer and check that it hasn't expired yet.
|
||||
| DFF3 | LD BC,$0014 | Reset *TimerGoldenKey_FrameSkip back to 0014. | ||
| DFF6 | LD ($5BFA),BC | |||
| DFFA | LD A,($5BFF) | Decrease *TimerGoldenKey by one. | ||
| DFFD | DEC A | |||
| DFFE | LD ($5BFF),A | |||
|
Player lives don't matter with the Golden Key section of the game, once the timer expires it's Game Over.
|
||||
| E001 | JP Z,ForceGameOver | Jump to ForceGameOver if *TimerGoldenKey is zero. | ||
|
Display the Golden Key timer.
|
||||
| DisplayGoldenKeyTimer | E004 | LD C,$0C | Set up the screen buffer location 0C/02 using CL_SET. | |
| E006 | LD B,$02 | |||
| E008 | CALL $0DD9 | |||
|
|
||||
| E00B | LD B,$00 | BC=*TimerGoldenKey. | ||
| E00D | LD A,($5BFF) | |||
| E010 | LD C,A | |||
| E011 | CALL $1A1B | Call OUT_NUM_1. | ||
|
The ASCII space after the timer acts to clear "extra" digits when the timer transitions to being single digit.
|
||||
| E014 | LD A,$20 | A=ASCII "space" (20). | ||
| E016 | CALL PrintColourCharacter | Call PrintColourCharacter. | ||
|
Is the Golden Key in the current room?
|
||||
| E019 | LD A,($5BD3) | Return if *CurrentRoom is not equal to *GoldenKeyRoom. | ||
| E01C | LD HL,$5BFC | |||
| E01F | CP (HL) | |||
| E020 | RET NZ | |||
|
It is in this room, so display it.
|
||||
| E021 | LD BC,($5BFD) | BC=*PositionGoldenKey. | ||
| E025 | LD HL,$DEBB | Write DEBB (Graphics_GoldenKey) to *CHARS. | ||
| E028 | LD ($5C36),HL | |||
| E02B | LD A,$10 | Set INK: YELLOW (06). | ||
| E02D | RST $10 | |||
| E02E | LD A,$06 | |||
| E030 | RST $10 | |||
| E031 | LD A,$20 | A=20 (base sprite ID). | ||
| E033 | LD DE,$0201 | DE=Set the sprite width/ height (02/ 01). | ||
| E036 | CALL PrintSprite | Call PrintSprite. | ||
|
Handle player collision with the Golden Key.
|
||||
| E039 | LD IX,$F231 | IX=TablePlayerAttributes. | ||
| E03D | LD BC,($5BFD) | BC=*PositionGoldenKey. | ||
| E041 | LD A,(IX+$00) | Return if the players horizontal co-ordinate is not equal to the Golden Key horizontal co-ordinate. | ||
| E044 | CP C | |||
| E045 | RET NZ | |||
| E046 | LD A,(IX+$01) | Return if the players vertical co-ordinate is not equal to the Golden Key vertical co-ordinate. | ||
| E049 | CP B | |||
| E04A | RET NZ | |||
|
The player has collected the Golden Key!
Hilariously, just beep at the player and restart the game. Zero fanfare!
|
||||
| E04B | LD DE,$00C8 | DE=00C8. | ||
| E04E | LD HL,$00C8 | HL=00C8. | ||
| E051 | CALL $03B5 | Call BEEPER. | ||
| E054 | POP BC | Restore BC from the stack. | ||
| E055 | JP InitialiseGameStates | Jump to InitialiseGameStates. | ||
| Prev: DFCB | Up: Map | Next: E058 |