![]() |
Routines |
Prev: 870E | Up: Map |
Used by the routine at 870E. First check whether we have a new high score.
|
||||||||
8944 | LD HL,$841F | Point HL at the high score at 841F | ||||||
8947 | LD DE,$8429 | Point DE at the current score at 8429 | ||||||
894A | LD B,$06 | There are 6 digits to compare | ||||||
894C | LD A,(DE) | Pick up a digit of the current score | ||||||
894D | CP (HL) | Compare it with the corresponding digit of the high score | ||||||
894E | JP C,$8963 | Jump if it's less than the corresponding digit of the high score | ||||||
8951 | JP NZ,$8958 | Jump if it's greater than the corresponding digit of the high score | ||||||
8954 | INC HL | Point HL at the next digit of the high score | ||||||
8955 | INC DE | Point DE at the next digit of the current score | ||||||
8956 | DJNZ $894C | Jump back to compare the next pair of digits | ||||||
8958 | LD HL,$8429 | Replace the high score with the current score | ||||||
895B | LD DE,$841F | |||||||
895E | LD BC,$0006 | |||||||
8961 | LDIR | |||||||
Now prepare the screen for the game over sequence.
|
||||||||
8963 | LD HL,$4000 | Clear the top two-thirds of the display file | ||||||
8966 | LD DE,$4001 | |||||||
8969 | LD BC,$0FFF | |||||||
896C | LD (HL),$00 | |||||||
896E | LDIR | |||||||
8970 | XOR A | Initialise the game status buffer variable at 80DC; this variable will determine the distance of the boot from the top of the screen | ||||||
8971 | LD ($80DC),A | |||||||
8974 | LD DE,$8240 | Draw Willy at (12,15) | ||||||
8977 | LD HL,$488F | |||||||
897A | LD C,$00 | |||||||
897C | CALL $8FF4 | |||||||
897F | LD DE,$B6E0 | Draw the plinth (see B6E0) underneath Willy at (14,15) | ||||||
8982 | LD HL,$48CF | |||||||
8985 | LD C,$00 | |||||||
8987 | CALL $8FF4 | |||||||
The following loop draws the boot's descent onto the plinth that supports Willy.
|
||||||||
898A | LD A,($80DC) | Pick up the distance variable from 80DC | ||||||
898D | LD C,A | Point BC at the corresponding entry in the screen buffer address lookup table at 8300 | ||||||
898E | LD B,$83 | |||||||
8990 | LD A,(BC) | Point HL at the corresponding location in the display file | ||||||
8991 | OR $0F | |||||||
8993 | LD L,A | |||||||
8994 | INC BC | |||||||
8995 | LD A,(BC) | |||||||
8996 | SUB $20 | |||||||
8998 | LD H,A | |||||||
8999 | LD DE,$BAE0 | Draw the boot (see BAE0) at this location, without erasing the boot at the previous location; this leaves the portion of the boot sprite that's above the ankle in place, and makes the boot appear as if it's at the end of a long, extending trouser leg | ||||||
899C | LD C,$00 | |||||||
899E | CALL $8FF4 | |||||||
89A1 | LD A,($80DC) | Pick up the distance variable from 80DC | ||||||
89A4 | CPL | A=0xFF-A | ||||||
89A5 | LD E,A | Store this value (0x3F-0xFF) in E; it determines the (rising) pitch of the sound effect that will be made | ||||||
89A6 | XOR A | A=0 (black border) | ||||||
89A7 | LD BC,$0040 | C=0x40; this value determines the duration of the sound effect | ||||||
89AA | OUT ($FE),A | Produce a short note whose pitch is determined by E | ||||||
89AC | XOR $18 | |||||||
89AE | LD B,E | |||||||
89AF | DJNZ $89AF | |||||||
89B1 | DEC C | |||||||
89B2 | JR NZ,$89AA | |||||||
89B4 | LD HL,$5800 | Prepare BC, DE and HL for setting the attribute bytes in the top two-thirds of the screen | ||||||
89B7 | LD DE,$5801 | |||||||
89BA | LD BC,$01FF | |||||||
89BD | LD A,($80DC) | Pick up the distance variable from 80DC | ||||||
89C0 | AND $0C | Keep only bits 2 and 3 | ||||||
89C2 | RLCA | Shift bits 2 and 3 into bits 3 and 4; these bits determine the PAPER colour: 0, 1, 2 or 3 | ||||||
89C3 | OR $47 | Set bits 0-2 (INK 7) and 6 (BRIGHT 1) | ||||||
89C5 | LD (HL),A | Copy this attribute value into the top two-thirds of the screen | ||||||
89C6 | LDIR | |||||||
89C8 | LD A,($80DC) | Add 4 to the distance variable at 80DC; this will move the boot sprite down two pixel rows | ||||||
89CB | ADD A,$04 | |||||||
89CD | LD ($80DC),A | |||||||
89D0 | CP $C4 | Has the boot met the plinth yet? | ||||||
89D2 | JR NZ,$898A | Jump back if not | ||||||
Now print the "Game Over" message, just to drive the point home.
|
||||||||
89D4 | LD IX,$844F | Print "Game" (see 844F) at (6,10) | ||||||
89D8 | LD C,$04 | |||||||
89DA | LD DE,$40CA | |||||||
89DD | CALL $92BA | |||||||
89E0 | LD IX,$8453 | Print "Over" (see 8453) at (6,18) | ||||||
89E4 | LD C,$04 | |||||||
89E6 | LD DE,$40D2 | |||||||
89E9 | CALL $92BA | |||||||
89EC | LD BC,$0000 | Prepare the delay counters for the following loop; the counter in C will also determine the INK colours to use for the "Game Over" message | ||||||
89EF | LD D,$06 | |||||||
The following loop makes the "Game Over" message glisten for about 1.57s.
|
||||||||
89F1 | DJNZ $89F1 | Delay for about a millisecond | ||||||
89F3 | LD A,C | Change the INK colour of the "G" in "Game" at (6,10) | ||||||
89F4 | AND $07 | |||||||
89F6 | OR $40 | |||||||
89F8 | LD ($58CA),A | |||||||
89FB | INC A | Change the INK colour of the "a" in "Game" at (6,11) | ||||||
89FC | AND $07 | |||||||
89FE | OR $40 | |||||||
8A00 | LD ($58CB),A | |||||||
8A03 | INC A | Change the INK colour of the "m" in "Game" at (6,12) | ||||||
8A04 | AND $07 | |||||||
8A06 | OR $40 | |||||||
8A08 | LD ($58CC),A | |||||||
8A0B | INC A | Change the INK colour of the "e" in "Game" at (6,13) | ||||||
8A0C | AND $07 | |||||||
8A0E | OR $40 | |||||||
8A10 | LD ($58CD),A | |||||||
8A13 | INC A | Change the INK colour of the "O" in "Over" at (6,18) | ||||||
8A14 | AND $07 | |||||||
8A16 | OR $40 | |||||||
8A18 | LD ($58D2),A | |||||||
8A1B | INC A | Change the INK colour of the "v" in "Over" at (6,19) | ||||||
8A1C | AND $07 | |||||||
8A1E | OR $40 | |||||||
8A20 | LD ($58D3),A | |||||||
8A23 | INC A | Change the INK colour of the "e" in "Over" at (6,20) | ||||||
8A24 | AND $07 | |||||||
8A26 | OR $40 | |||||||
8A28 | LD ($58D4),A | |||||||
8A2B | INC A | Change the INK colour of the "r" in "Over" at (6,21) | ||||||
8A2C | AND $07 | |||||||
8A2E | OR $40 | |||||||
8A30 | LD ($58D5),A | |||||||
8A33 | DEC C | Decrement the counter in C | ||||||
8A34 | JR NZ,$89F1 | Jump back unless it's zero | ||||||
8A36 | DEC D | Decrement the counter in D (initially 6) | ||||||
8A37 | JR NZ,$89F1 | Jump back unless it's zero | ||||||
8A39 | JP $85CC | Display the title screen and play the theme tune |
Prev: 870E | Up: Map |