Routines |
Prev: 8C01 | Up: Map | Next: 8D33 |
Used by the routine at 8C01.
|
||||
8C4A | LD HL,$4000 | Clear the top two-thirds of the display file | ||
8C4D | LD DE,$4001 | |||
8C50 | LD BC,$0FFF | |||
8C53 | LD (HL),$00 | |||
8C55 | LDIR | |||
8C57 | XOR A | Initialise the temporary game status buffer variable at 85E4; this variable will determine the distance of the foot from the top of the screen | ||
8C58 | LD ($85E4),A | |||
8C5B | LD DE,$9D40 | Draw Willy at (12,15) | ||
8C5E | LD HL,$488F | |||
8C61 | LD C,$00 | |||
8C63 | CALL $9456 | |||
8C66 | LD DE,$9C60 | Draw the barrel underneath Willy at (14,15) | ||
8C69 | LD HL,$48CF | |||
8C6C | LD C,$00 | |||
8C6E | CALL $9456 | |||
The following loop draws the foot's descent onto the barrel that supports Willy while producing a sound effect.
|
||||
8C71 | LD A,($85E4) | Pick up the distance variable from 85E4 | ||
8C74 | LD C,A | Point BC at the corresponding entry in the screen buffer address lookup table at 8200 | ||
8C75 | LD B,$82 | |||
8C77 | LD A,(BC) | Point HL at the corresponding location in the display file | ||
8C78 | OR $0F | |||
8C7A | LD L,A | |||
8C7B | INC BC | |||
8C7C | LD A,(BC) | |||
8C7D | SUB $20 | |||
8C7F | LD H,A | |||
8C80 | LD DE,$9C40 | Draw the foot at this location, without erasing the foot at the previous location; this leaves the portion of the foot sprite that's above the ankle in place, and makes the foot appear as if it's at the end of a long, extending leg | ||
8C83 | LD C,$00 | |||
8C85 | CALL $9456 | |||
8C88 | LD A,($85E4) | Pick up the distance variable from 85E4 | ||
8C8B | CPL | A=0xFF-A | ||
8C8C | LD E,A | Store this value (0x3F-0xFF) in E; it determines the (rising) pitch of the sound effect that will be made | ||
8C8D | XOR A | A=0 (black border) | ||
8C8E | LD BC,$0040 | C=0x40; this value determines the duration of the sound effect | ||
8C91 | OUT ($FE),A | Produce a short note whose pitch is determined by E | ||
8C93 | XOR $18 | |||
8C95 | LD B,E | |||
8C96 | DJNZ $8C96 | |||
8C98 | DEC C | |||
8C99 | JR NZ,$8C91 | |||
8C9B | LD HL,$5800 | Prepare BC, DE and HL for setting the attribute bytes in the top two-thirds of the screen | ||
8C9E | LD DE,$5801 | |||
8CA1 | LD BC,$01FF | |||
8CA4 | LD A,($85E4) | Pick up the distance variable from 85E4 | ||
8CA7 | AND $0C | Keep only bits 2 and 3 | ||
8CA9 | RLCA | Shift bits 2 and 3 into bits 3 and 4; these bits determine the PAPER colour: 0, 1, 2 or 3 | ||
8CAA | OR $47 | Set bits 0-2 (INK 7) and 6 (BRIGHT 1) | ||
8CAC | LD (HL),A | Copy this attribute value into the top two-thirds of the screen | ||
8CAD | LDIR | |||
8CAF | AND $FA | Reset bits 0 and 2, and retain all other bits | ||
8CB1 | OR $02 | Set bit 1 (INK 2) | ||
8CB3 | LD ($59CF),A | Copy this attribute value to the cells at (14,15), (14,16), (15, 15) and (15, 16) (where the barrel is, so that it remains red) | ||
8CB6 | LD ($59D0),A | |||
8CB9 | LD ($59EF),A | |||
8CBC | LD ($59F0),A | |||
8CBF | LD A,($85E4) | Add 4 to the distance variable at 85E4; this will move the foot sprite down two pixel rows | ||
8CC2 | ADD A,$04 | |||
8CC4 | LD ($85E4),A | |||
8CC7 | CP $C4 | Has the foot met the barrel yet? | ||
8CC9 | JR NZ,$8C71 | Jump back if not | ||
Now print the "Game Over" message, just to drive the point home.
|
||||
8CCB | LD IX,$8574 | Print "Game" (see 8574) at (6,10) | ||
8CCF | LD C,$04 | |||
8CD1 | LD DE,$40CA | |||
8CD4 | CALL $9680 | |||
8CD7 | LD IX,$8578 | Print "Over" (see 8578) at (6,18) | ||
8CDB | LD C,$04 | |||
8CDD | LD DE,$40D2 | |||
8CE0 | CALL $9680 | |||
8CE3 | 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 | ||
8CE6 | LD D,$06 | |||
The following loop makes the "Game Over" message glisten for about 1.57s.
|
||||
8CE8 | DJNZ $8CE8 | Delay for about a millisecond | ||
8CEA | LD A,C | Change the INK colour of the "G" in "Game" at (6,10) | ||
8CEB | AND $07 | |||
8CED | OR $40 | |||
8CEF | LD ($58CA),A | |||
8CF2 | INC A | Change the INK colour of the "a" in "Game" at (6,11) | ||
8CF3 | AND $07 | |||
8CF5 | OR $40 | |||
8CF7 | LD ($58CB),A | |||
8CFA | INC A | Change the INK colour of the "m" in "Game" at (6,12) | ||
8CFB | AND $07 | |||
8CFD | OR $40 | |||
8CFF | LD ($58CC),A | |||
8D02 | INC A | Change the INK colour of the "e" in "Game" at (6,13) | ||
8D03 | AND $07 | |||
8D05 | OR $40 | |||
8D07 | LD ($58CD),A | |||
8D0A | INC A | Change the INK colour of the "O" in "Over" at (6,18) | ||
8D0B | AND $07 | |||
8D0D | OR $40 | |||
8D0F | LD ($58D2),A | |||
8D12 | INC A | Change the INK colour of the "v" in "Over" at (6,19) | ||
8D13 | AND $07 | |||
8D15 | OR $40 | |||
8D17 | LD ($58D3),A | |||
8D1A | INC A | Change the INK colour of the "e" in "Over" at (6,20) | ||
8D1B | AND $07 | |||
8D1D | OR $40 | |||
8D1F | LD ($58D4),A | |||
8D22 | INC A | Change the INK colour of the "r" in "Over" at (6,21) | ||
8D23 | AND $07 | |||
8D25 | OR $40 | |||
8D27 | LD ($58D5),A | |||
8D2A | DEC C | Decrement the counter in C | ||
8D2B | JR NZ,$8CE8 | Jump back unless it's zero | ||
8D2D | DEC D | Decrement the counter in D (initially 6) | ||
8D2E | JR NZ,$8CE8 | Jump back unless it's zero | ||
8D30 | JP $87CA | Display the title screen and play the theme tune |
Prev: 8C01 | Up: Map | Next: 8D33 |