Prev: 85CC Up: Map Next: 870E
8684: Start the game (or demo mode)
Used by the routine at 85CC.
8684 LD HL,$8425 Initialise the score at 8425
8687 LD DE,$8426
868A LD BC,$0009
868D LD (HL),$30
This entry point is used by the routines at 870E (when teleporting into a cavern or reinitialising the current cavern after Willy has lost a life) and 9028.
8691 LD A,($8407) Pick up the number of the current cavern from 8407
8694 SLA A Point HL at the first byte of the cavern definition
8696 SLA A
8698 ADD A,$B0
869A LD H,A
869B LD L,$00
869D LD DE,$5E00 Copy the cavern's attribute bytes into the buffer at 5E00
86A0 LD BC,$0200
86A5 LD DE,$8000 Copy the rest of the cavern definition into the game status buffer at 8000
86A8 LD BC,$0200
86AD CALL $8A75 Draw the current cavern to the screen buffer at 7000
86B0 LD HL,$5000 Clear the bottom third of the display file
86B3 LD DE,$5001
86B6 LD BC,$07FF
86B9 LD (HL),$00
86BD LD IX,$8000 Print the cavern name (see 8000) at (16,0)
86C1 LD C,$20
86C3 LD DE,$5000
86C6 CALL $92BA
86C9 LD IX,$8418 Print 'AIR' (see 8418) at (17,0)
86CD LD C,$03
86CF LD DE,$5020
86D2 CALL $92BA
86D5 LD A,$52 Initialise A to 0x52; this is the MSB of the display file address at which to start drawing the bar that represents the air supply
86D7 LD H,A Prepare HL and DE for drawing a row of pixels in the air bar
86D8 LD D,A
86D9 LD L,$24
86DB LD E,$25
86DD LD B,A Save the display file address MSB in B briefly
86DE LD A,($80BC) Pick up the value of the initial air supply from 80BC
86E1 SUB $24 Now C determines the length of the air bar (in cell widths)
86E3 LD C,A
86E4 LD A,B Restore the display file address MSB to A
86E5 LD B,$00 Now BC determines the length of the air bar (in cell widths)
86E7 LD (HL),$FF Draw a single row of pixels across C cells
86EB INC A Increment the display file address MSB in A (moving down to the next row of pixels)
86EC CP $56 Have we drawn all four rows of pixels in the air bar yet?
86EE JR NZ,$86D7 If not, jump back to draw the next one
86F0 LD IX,$842F Print 'High Score 000000   Score 000000' (see 842F) at (19,0)
86F4 LD DE,$5060
86F7 LD C,$20
86F9 CALL $92BA
86FC LD A,($8073) Pick up the border colour for the current cavern from 8073
86FF LD C,$FE Set the border colour
8701 OUT (C),A
8703 LD A,($845A) Pick up the game mode indicator from 845A
8706 OR A Are we in demo mode?
8707 JR Z,$870E If not, enter the main loop now
8709 LD A,$40 Reset the game mode indicator at 845A to 0x40 (we're in demo mode)
870B LD ($845A),A
This routine continues into the main loop at 870E.
Prev: 85CC Up: Map Next: 870E