![]() |
Routines |
Prev: 8FF4 | Up: Map |
|
||||||||
9028 | LD A,($8407) | Pick up the number of the current cavern from 8407 | ||||||
902B | INC A | Increment the cavern number | ||||||
902C | CP $14 | Is the current cavern The Final Barrier? | ||||||
902E | JR NZ,$9091 | Jump if not | ||||||
9030 | LD A,($845A) | Pick up the game mode indicator from 845A | ||||||
9033 | OR A | Are we in demo mode? | ||||||
9034 | JP NZ,$9090 | Jump if so | ||||||
9037 | LD A,($845D) | Pick up the 6031769 key counter from 845D | ||||||
903A | CP $07 | Is cheat mode activated? | ||||||
903C | JR Z,$9090 | Jump if so | ||||||
Willy has made it through The Final Barrier without cheating.
|
||||||||
903E | LD C,$00 | Draw Willy at (2,19) on the ground above the portal | ||||||
9040 | LD DE,$8260 | |||||||
9043 | LD HL,$4053 | |||||||
9046 | CALL $8FF4 | |||||||
9049 | LD DE,$B2E0 | Draw the swordfish graphic (see B2E0) over the portal | ||||||
904C | LD HL,$40B3 | |||||||
904F | CALL $8FF4 | |||||||
9052 | LD HL,$5853 | Point HL at (2,19) in the attribute file | ||||||
9055 | LD DE,$001F | Prepare DE for addition | ||||||
9058 | LD (HL),$2F | Set the attributes for the upper half of Willy's sprite at (2,19) and (2,20) to 0x2F (INK 7: PAPER 5) | ||||||
905A | INC HL | |||||||
905B | LD (HL),$2F | |||||||
905D | ADD HL,DE | Set the attributes for the lower half of Willy's sprite at (3,19) and (3,20) to 0x27 (INK 7: PAPER 4) | ||||||
905E | LD (HL),$27 | |||||||
9060 | INC HL | |||||||
9061 | LD (HL),$27 | |||||||
9063 | ADD HL,DE | Point HL at (5,19) in the attribute file | ||||||
9064 | INC HL | |||||||
9065 | ADD HL,DE | |||||||
9066 | LD (HL),$45 | Set the attributes for the fish at (5,19) and (5,20) to 0x45 (INK 5: PAPER 0: BRIGHT 1) | ||||||
9068 | INC HL | |||||||
9069 | LD (HL),$45 | |||||||
906B | ADD HL,DE | Set the attribute for the handle of the sword at (6,19) to 0x46 (INK 6: PAPER 0: BRIGHT 1) | ||||||
906C | LD (HL),$46 | |||||||
906E | INC HL | Set the attribute for the blade of the sword at (6,20) to 0x47 (INK 7: PAPER 0: BRIGHT 1) | ||||||
906F | LD (HL),$47 | |||||||
9071 | ADD HL,DE | Set the attributes at (7,19) and (7,20) to 0x00 (to hide Willy's feet just below where the portal was) | ||||||
9072 | LD (HL),$00 | |||||||
9074 | INC HL | |||||||
9075 | LD (HL),$00 | |||||||
9077 | LD BC,$0000 | Prepare C and D for the celebratory sound effect | ||||||
907A | LD D,$32 | |||||||
907C | XOR A | A=0 (black border) | ||||||
907D | OUT ($FE),A | Produce the celebratory sound effect: Willy has escaped from the mine | ||||||
907F | XOR $18 | |||||||
9081 | LD E,A | |||||||
9082 | LD A,C | |||||||
9083 | ADD A,D | |||||||
9084 | ADD A,D | |||||||
9085 | ADD A,D | |||||||
9086 | LD B,A | |||||||
9087 | LD A,E | |||||||
9088 | DJNZ $9088 | |||||||
908A | DEC C | |||||||
908B | JR NZ,$907D | |||||||
908D | DEC D | |||||||
908E | JR NZ,$907D | |||||||
9090 | XOR A | A=0x00 (the next cavern will be Central Cavern) | ||||||
9091 | LD ($8407),A | Update the cavern number at 8407 | ||||||
The next section of code cycles the INK and PAPER colours of the current cavern.
|
||||||||
9094 | LD A,$3F | Initialise A to 0x3F (INK 7: PAPER 7) | ||||||
9096 | LD HL,$5800 | Set the attributes for the top two-thirds of the screen to the value in A | ||||||
9099 | LD DE,$5801 | |||||||
909C | LD BC,$01FF | |||||||
909F | LD (HL),A | |||||||
90A0 | LDIR | |||||||
90A2 | LD BC,$0004 | Pause for about 0.004s | ||||||
90A5 | DJNZ $90A5 | |||||||
90A7 | DEC C | |||||||
90A8 | JR NZ,$90A5 | |||||||
90AA | DEC A | Decrement the attribute value in A | ||||||
90AB | JR NZ,$9096 | Jump back until we've gone through all attribute values from 0x3F down to 0x01 | ||||||
90AD | LD A,($845A) | Pick up the game mode indicator from 845A | ||||||
90B0 | OR A | Are we in demo mode? | ||||||
90B1 | JP NZ,$8691 | If so, demo the next cavern | ||||||
The following loop increases the score and decreases the air supply until it runs out.
|
||||||||
90B4 | CALL $8A3C | Decrease the air remaining in the current cavern | ||||||
90B7 | JP Z,$8691 | Move to the next cavern if the air supply is now gone | ||||||
90BA | LD HL,$842E | Add 1 to the score | ||||||
90BD | CALL $90FE | |||||||
90C0 | LD IX,$8429 | Print the new score at (19,26) | ||||||
90C4 | LD C,$06 | |||||||
90C6 | LD DE,$507A | |||||||
90C9 | CALL $92BA | |||||||
90CC | LD C,$04 | This value determines the duration of the sound effect | ||||||
90CE | LD A,($80BC) | Pick up the remaining air supply (S) from 80BC | ||||||
90D1 | CPL | D=2*(63-S); this value determines the pitch of the sound effect (which decreases with the amount of air remaining) | ||||||
90D2 | AND $3F | |||||||
90D4 | RLC A | |||||||
90D6 | LD D,A | |||||||
90D7 | LD A,$00 | Produce a short note | ||||||
90D9 | OUT ($FE),A | |||||||
90DB | LD B,D | |||||||
90DC | DJNZ $90DC | |||||||
90DE | LD A,$18 | |||||||
90E0 | OUT ($FE),A | |||||||
90E2 | LD B,D | |||||||
90E3 | DJNZ $90E3 | |||||||
90E5 | DEC C | |||||||
90E6 | JR NZ,$90D7 | |||||||
90E8 | JR $90B4 | Jump back to decrease the air supply again |
Prev: 8FF4 | Up: Map |