![]() |
Routines |
Prev: 34188 | Up: Map |
The first thing this routine does is initialise some game status buffer variables in preparation for the next game.
|
|||||||
34252 | XOR A | A=0 | |||||
34253 | LD (33799),A | Initialise the current cavern number at 33799 | |||||
34256 | LD (33881),A | Initialise the Kempston joystick indicator at 33881 | |||||
34259 | LD (33882),A | Initialise the game mode indicator at 33882 | |||||
34262 | LD (33883),A | Initialise the in-game music note index at 33883 | |||||
34265 | LD (33880),A | Initialise the screen flash counter at 33880 | |||||
34268 | LD A,2 | Initialise the number of lives remaining at 33879 | |||||
34270 | LD (33879),A | ||||||
34273 | LD HL,33884 | Initialise the keypress flag in bit 0 at 33884 | |||||
34276 | SET 0,(HL) | ||||||
Next, prepare the screen.
|
|||||||
34278 | LD HL,16384 | Clear the entire display file | |||||
34281 | LD DE,16385 | ||||||
34284 | LD BC,6143 | ||||||
34287 | LD (HL),0 | ||||||
34289 | LDIR | ||||||
34291 | LD HL,40960 | Copy the graphic data at 40960 to the top two-thirds of the display file | |||||
34294 | LD DE,16384 | ||||||
34297 | LD BC,4096 | ||||||
34300 | LDIR | ||||||
34302 | LD HL,18493 | Draw Willy at (9,29) | |||||
34305 | LD DE,33344 | ||||||
34308 | LD C,0 | ||||||
34310 | CALL 36852 | ||||||
34313 | LD HL,64512 | Copy the attribute bytes from 64512 to the top third of the attribute file | |||||
34316 | LD DE,22528 | ||||||
34319 | LD BC,256 | ||||||
34322 | LDIR | ||||||
34324 | LD HL,40448 | Copy the attribute bytes from 40448 to the bottom two-thirds of the attribute file | |||||
34327 | LD BC,512 | ||||||
34330 | LDIR | ||||||
Now check whether there is a joystick connected.
|
|||||||
34332 | LD BC,31 | B=0, C=31 (joystick port) | |||||
34335 | DI | Disable interrupts (which are already disabled) | |||||
34336 | XOR A | A=0 | |||||
34337 | IN E,(C) | Combine 256 readings of the joystick port in A | |||||
34339 | OR E | ||||||
34340 | DJNZ 34337 | ||||||
34342 | AND 32 | Is a joystick connected (bit 5 reset)? | |||||
34344 | JR NZ,34351 | Jump if not | |||||
34346 | LD A,1 | Set the Kempston joystick indicator at 33881 to 1 | |||||
34348 | LD (33881),A | ||||||
And finally, play the theme tune and check for keypresses.
|
|||||||
34351 | LD IY,33902 | Point IY at the theme tune data at 33902 | |||||
34355 | CALL 37596 | Play the theme tune | |||||
34358 | JP NZ,34436 | Start the game if ENTER or the fire button was pressed | |||||
34361 | XOR A | Initialise the game status buffer variable at 32988; this will be used as an index for the message scrolled across the screen | |||||
34362 | LD (32988),A | ||||||
34365 | LD A,(32988) | Pick up the message index from 32988 | |||||
34368 | LD IX,40192 | Point IX at the corresponding location in the message at 40192 | |||||
34372 | LD IXl,A | ||||||
34374 | LD DE,20576 | Print 32 characters of the message at (19,0) | |||||
34377 | LD C,32 | ||||||
34379 | CALL 37562 | ||||||
34382 | LD A,(32988) | Pick up the message index from 32988 | |||||
34385 | AND 6 | Keep only bits 1 and 2, and move them into bits 6 and 7, so that A holds 0, 64, 128 or 192; this value determines the animation frame to use for Willy | |||||
34387 | RRCA | ||||||
34388 | RRCA | ||||||
34389 | RRCA | ||||||
34390 | LD E,A | Point DE at the graphic data for Willy's sprite (33280+A) | |||||
34391 | LD D,130 | ||||||
34393 | LD HL,18493 | Draw Willy at (9,29) | |||||
34396 | LD C,0 | ||||||
34398 | CALL 36852 | ||||||
34401 | LD BC,100 | Pause for about 0.1s | |||||
34404 | DJNZ 34404 | ||||||
34406 | DEC C | ||||||
34407 | JR NZ,34404 | ||||||
34409 | LD BC,49150 | Read keys H-J-K-L-ENTER | |||||
34412 | IN A,(C) | ||||||
34414 | AND 1 | Keep only bit 0 of the result (ENTER) | |||||
34416 | CP 1 | Is ENTER being pressed? | |||||
34418 | JR NZ,34436 | If so, start the game | |||||
34420 | LD A,(32988) | Pick up the message index from 32988 | |||||
34423 | INC A | Increment it | |||||
34424 | CP 224 | Set the zero flag if we've reached the end of the message | |||||
34426 | LD (32988),A | Store the new message index at 32988 | |||||
34429 | JR NZ,34365 | Jump back unless we've finished scrolling the message across the screen | |||||
34431 | LD A,64 | Initialise the game mode indicator at 33882 to 64: demo mode | |||||
34433 | LD (33882),A | ||||||
This routine continues into the one at 34436.
|
Prev: 34188 | Up: Map |