Routines |
Prev: 33741 | Up: Map | Next: 33873 |
|
||||
GameOver | 33775 | CALL GameOver_Start | Call GameOver_Start. | |
33778 | JP 33459 | Jump to 33459. | ||
Actions "game over".
|
||||
GameOver_Start | 33781 | PUSH HL | Stash HL and DE on the stack. | |
33782 | PUSH DE | |||
33783 | XOR A | Write $00 to WaitCoutdown. | ||
33784 | LD (46849),A | |||
33787 | LD HL,46164 | HL="you have mastered [0x16]" | ||
33790 | CALL PrintMsg | Call PrintMsg. | ||
33793 | LD HL,(46839) | HL=PercentageComplete. | ||
33796 | LD DE,100 | DE=$0064 (i.e. "100" in decimal). | ||
33799 | CALL PercentageAscii | Call PercentageAscii. | ||
33802 | CALL NZ,34187 | If the result is non-zero, call 34187. | ||
33805 | LD DE,10 | DE=$000A (i.e. "10" in decimal). | ||
33808 | CALL PercentageAscii | Call PercentageAscii. | ||
33811 | CALL 34187 | Call 34187. | ||
33814 | LD A,46 | A=$2E (i.e. a period in ASCII, as the produced percentage is a float). | ||
33816 | CALL 34187 | Call 34187. | ||
33819 | LD A,L | A=the percentage digit, plus $30 to convert to ASCII. | ||
33820 | ADD A,48 | |||
33822 | CALL 34187 | Call 34187. | ||
33825 | XOR A | Write $00 to 46852. | ||
33826 | LD (46852),A | |||
33829 | LD HL,46178 | HL="% of this adventure" | ||
33832 | CALL PrintMsg | Call PrintMsg. | ||
33835 | POP DE | Restore DE and HL from the stack. | ||
33836 | POP HL | |||
33837 | RET | Return. | ||
Converts e.g. "0075" into "7.5" in ASCII for display purposes.
|
||||
PercentageAscii | 33838 | LD A,47 | A=$2F (ASCII "0" less one, due to the following line being the loop and so, incrementing to $30 - which is ASCII "0"). | |
PercentageAscii_Loop | 33840 | INC A | Increment A by one. | |
33841 | AND A | |||
33842 | SBC HL,DE | Subtract DE (either 100 or 10) from HL. | ||
33844 | JR NC,PercentageAscii_Loop | Jump back to PercentageAscii_Loop if there's no carry. | ||
33846 | ADD HL,DE | HL=HL + DE. | ||
33847 | CP 48 | Compare against $30 (ASCII "0") to set flags for the return. | ||
33849 | RET | Return. | ||
I don't believe this is ever used?
|
||||
33850 | LD A,4 | Set the border to $04 (green). | ||
33852 | OUT (254),A | |||
33854 | CALL DebounceAnyKey | Call DebounceAnyKey. | ||
WaitForKey | 33857 | XOR A | Read from the keyboard port. | |
33858 | IN A,(254) | |||
33860 | AND %00011111 | A pressed key from any line will set its respective bit; bit 0 (outer key) to bit 4 (inner key). Hence keep only bits 0-4 for the check. | ||
33862 | CP 31 | Loop back to WaitForKey until any key has been pressed. | ||
33864 | JR NZ,WaitForKey | |||
33866 | LD A,7 | Set the border to $07 (white). | ||
33868 | OUT (254),A | |||
33870 | JP 33459 | Jump to 33459. |
Prev: 33741 | Up: Map | Next: 33873 |