Routines |
Prev: 34574 | Up: Map | Next: 35388 |
Used by the routine at 34574. First check whether we have a new high score.
|
||||
35140 | LD HL,33823 | Point HL at the high score at 33823 | ||
35143 | LD DE,33833 | Point DE at the current score at 33833 | ||
35146 | LD B,6 | There are 6 digits to compare | ||
35148 | LD A,(DE) | Pick up a digit of the current score | ||
35149 | CP (HL) | Compare it with the corresponding digit of the high score | ||
35150 | JP C,35171 | Jump if it's less than the corresponding digit of the high score | ||
35153 | JP NZ,35160 | Jump if it's greater than the corresponding digit of the high score | ||
35156 | INC HL | Point HL at the next digit of the high score | ||
35157 | INC DE | Point DE at the next digit of the current score | ||
35158 | DJNZ 35148 | Jump back to compare the next pair of digits | ||
35160 | LD HL,33833 | Replace the high score with the current score | ||
35163 | LD DE,33823 | |||
35166 | LD BC,6 | |||
35169 | LDIR | |||
Now prepare the screen for the game over sequence.
|
||||
35171 | LD HL,16384 | Clear the top two-thirds of the display file | ||
35174 | LD DE,16385 | |||
35177 | LD BC,4095 | |||
35180 | LD (HL),0 | |||
35182 | LDIR | |||
35184 | XOR A | Initialise the game status buffer variable at 32988; this variable will determine the distance of the boot from the top of the screen | ||
35185 | LD (32988),A | |||
35188 | LD DE,33344 | Draw Willy at (12,15) | ||
35191 | LD HL,18575 | |||
35194 | LD C,0 | |||
35196 | CALL 36852 | |||
35199 | LD DE,46816 | Draw the plinth (see 46816) underneath Willy at (14,15) | ||
35202 | LD HL,18639 | |||
35205 | LD C,0 | |||
35207 | CALL 36852 | |||
The following loop draws the boot's descent onto the plinth that supports Willy while producing a sound effect.
|
||||
35210 | LD A,(32988) | Pick up the distance variable from 32988 | ||
35213 | LD C,A | Point BC at the corresponding entry in the screen buffer address lookup table at 33536 | ||
35214 | LD B,131 | |||
35216 | LD A,(BC) | Point HL at the corresponding location in the display file | ||
35217 | OR 15 | |||
35219 | LD L,A | |||
35220 | INC BC | |||
35221 | LD A,(BC) | |||
35222 | SUB 32 | |||
35224 | LD H,A | |||
35225 | LD DE,47840 | Draw the boot (see 47840) 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 | ||
35228 | LD C,0 | |||
35230 | CALL 36852 | |||
35233 | LD A,(32988) | Pick up the distance variable from 32988 | ||
35236 | CPL | A=255-A | ||
35237 | LD E,A | Store this value (63-255) in E; it determines the (rising) pitch of the sound effect that will be made | ||
35238 | XOR A | A=0 (black border) | ||
35239 | LD BC,64 | C=64; this value determines the duration of the sound effect | ||
35242 | OUT (254),A | Produce a short note whose pitch is determined by E | ||
35244 | XOR 24 | |||
35246 | LD B,E | |||
35247 | DJNZ 35247 | |||
35249 | DEC C | |||
35250 | JR NZ,35242 | |||
35252 | LD HL,22528 | Prepare BC, DE and HL for setting the attribute bytes in the top two-thirds of the screen | ||
35255 | LD DE,22529 | |||
35258 | LD BC,511 | |||
35261 | LD A,(32988) | Pick up the distance variable from 32988 | ||
35264 | AND 12 | Keep only bits 2 and 3 | ||
35266 | RLCA | Shift bits 2 and 3 into bits 3 and 4; these bits determine the PAPER colour: 0, 1, 2 or 3 | ||
35267 | OR 71 | Set bits 0-2 (INK 7) and 6 (BRIGHT 1) | ||
35269 | LD (HL),A | Copy this attribute value into the top two-thirds of the screen | ||
35270 | LDIR | |||
35272 | LD A,(32988) | Add 4 to the distance variable at 32988; this will move the boot sprite down two pixel rows | ||
35275 | ADD A,4 | |||
35277 | LD (32988),A | |||
35280 | CP 196 | Has the boot met the plinth yet? | ||
35282 | JR NZ,35210 | Jump back if not | ||
Now print the "Game Over" message, just to drive the point home.
|
||||
35284 | LD IX,33871 | Print "Game" (see 33871) at (6,10) | ||
35288 | LD C,4 | |||
35290 | LD DE,16586 | |||
35293 | CALL 37562 | |||
35296 | LD IX,33875 | Print "Over" (see 33875) at (6,18) | ||
35300 | LD C,4 | |||
35302 | LD DE,16594 | |||
35305 | CALL 37562 | |||
35308 | LD BC,0 | 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 | ||
35311 | LD D,6 | |||
The following loop makes the "Game Over" message glisten for about 1.57s.
|
||||
35313 | DJNZ 35313 | Delay for about a millisecond | ||
35315 | LD A,C | Change the INK colour of the "G" in "Game" at (6,10) | ||
35316 | AND 7 | |||
35318 | OR 64 | |||
35320 | LD (22730),A | |||
35323 | INC A | Change the INK colour of the "a" in "Game" at (6,11) | ||
35324 | AND 7 | |||
35326 | OR 64 | |||
35328 | LD (22731),A | |||
35331 | INC A | Change the INK colour of the "m" in "Game" at (6,12) | ||
35332 | AND 7 | |||
35334 | OR 64 | |||
35336 | LD (22732),A | |||
35339 | INC A | Change the INK colour of the "e" in "Game" at (6,13) | ||
35340 | AND 7 | |||
35342 | OR 64 | |||
35344 | LD (22733),A | |||
35347 | INC A | Change the INK colour of the "O" in "Over" at (6,18) | ||
35348 | AND 7 | |||
35350 | OR 64 | |||
35352 | LD (22738),A | |||
35355 | INC A | Change the INK colour of the "v" in "Over" at (6,19) | ||
35356 | AND 7 | |||
35358 | OR 64 | |||
35360 | LD (22739),A | |||
35363 | INC A | Change the INK colour of the "e" in "Over" at (6,20) | ||
35364 | AND 7 | |||
35366 | OR 64 | |||
35368 | LD (22740),A | |||
35371 | INC A | Change the INK colour of the "r" in "Over" at (6,21) | ||
35372 | AND 7 | |||
35374 | OR 64 | |||
35376 | LD (22741),A | |||
35379 | DEC C | Decrement the counter in C | ||
35380 | JR NZ,35313 | Jump back unless it's zero | ||
35382 | DEC D | Decrement the counter in D (initially 6) | ||
35383 | JR NZ,35313 | Jump back unless it's zero | ||
35385 | JP 34252 | Display the title screen and play the theme tune |
Prev: 34574 | Up: Map | Next: 35388 |