Routines |
Prev: 83CD | Up: Map | Next: 8451 |
|
||||
GameOver | 83EF | CALL GameOver_Start | Call GameOver_Start. | |
83F2 | JP $82B3 | Jump to 82B3. | ||
Actions "game over".
|
||||
GameOver_Start | 83F5 | PUSH HL | Stash HL and DE on the stack. | |
83F6 | PUSH DE | |||
83F7 | XOR A | Write $00 to WaitCoutdown. | ||
83F8 | LD ($B701),A | |||
83FB | LD HL,$B454 | HL="you have mastered [0x16]" | ||
83FE | CALL PrintMsg | Call PrintMsg. | ||
8401 | LD HL,($B6F7) | HL=PercentageComplete. | ||
8404 | LD DE,$0064 | DE=$0064 (i.e. "100" in decimal). | ||
8407 | CALL PercentageAscii | Call PercentageAscii. | ||
840A | CALL NZ,$858B | If the result is non-zero, call 858B. | ||
840D | LD DE,$000A | DE=$000A (i.e. "10" in decimal). | ||
8410 | CALL PercentageAscii | Call PercentageAscii. | ||
8413 | CALL $858B | Call 858B. | ||
8416 | LD A,$2E | A=$2E (i.e. a period in ASCII, as the produced percentage is a float). | ||
8418 | CALL $858B | Call 858B. | ||
841B | LD A,L | A=the percentage digit, plus $30 to convert to ASCII. | ||
841C | ADD A,$30 | |||
841E | CALL $858B | Call 858B. | ||
8421 | XOR A | Write $00 to B704. | ||
8422 | LD ($B704),A | |||
8425 | LD HL,$B462 | HL="% of this adventure" | ||
8428 | CALL PrintMsg | Call PrintMsg. | ||
842B | POP DE | Restore DE and HL from the stack. | ||
842C | POP HL | |||
842D | RET | Return. | ||
Converts e.g. "0075" into "7.5" in ASCII for display purposes.
|
||||
PercentageAscii | 842E | LD A,$2F | 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 | 8430 | INC A | Increment A by one. | |
8431 | AND A | |||
8432 | SBC HL,DE | Subtract DE (either 100 or 10) from HL. | ||
8434 | JR NC,PercentageAscii_Loop | Jump back to PercentageAscii_Loop if there's no carry. | ||
8436 | ADD HL,DE | HL=HL + DE. | ||
8437 | CP $30 | Compare against $30 (ASCII "0") to set flags for the return. | ||
8439 | RET | Return. | ||
I don't believe this is ever used?
|
||||
843A | LD A,$04 | Set the border to $04 (green). | ||
843C | OUT ($FE),A | |||
843E | CALL DebounceAnyKey | Call DebounceAnyKey. | ||
WaitForKey | 8441 | XOR A | Read from the keyboard port. | |
8442 | IN A,($FE) | |||
8444 | 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. | ||
8446 | CP $1F | Loop back to WaitForKey until any key has been pressed. | ||
8448 | JR NZ,WaitForKey | |||
844A | LD A,$07 | Set the border to $07 (white). | ||
844C | OUT ($FE),A | |||
844E | JP $82B3 | Jump to 82B3. |
Prev: 83CD | Up: Map | Next: 8451 |