Routines |
Prev: 35211 | Up: Map | Next: 35563 |
35245 | CALL 35211 | Draw the remaining lives | ||
35248 | LD HL,24064 | Copy the contents of the attribute buffer at 24064 (the attributes for the empty room) into the attribute buffer at 23552 | ||
35251 | LD DE,23552 | |||
35254 | LD BC,512 | |||
35257 | LDIR | |||
35259 | LD HL,28672 | Copy the contents of the screen buffer at 28672 (the tiles for the empty room) into the screen buffer at 24576 | ||
35262 | LD DE,24576 | |||
35265 | LD BC,4096 | |||
35268 | LDIR | |||
35270 | CALL 37056 | Move the rope and guardians in the current room | ||
35273 | LD A,(34271) | Pick up the game mode indicator from 34271 | ||
35276 | CP 3 | Is Willy's head down the toilet? | ||
35278 | CALL NZ,36307 | If not, move Willy | ||
35281 | LD A,(34255) | Pick up Willy's y-coordinate from 34255 | ||
35284 | CP 225 | Has Willy just moved up a ramp or a rope past the top of the screen? | ||
35286 | CALL NC,38064 | If so, move Willy into the room above | ||
35289 | LD A,(34271) | Pick up the game mode indicator from 34271 | ||
35292 | CP 3 | Is Willy's head down the toilet? | ||
35294 | CALL NZ,38344 | If not, check and set the attribute bytes for Willy's sprite in the buffer at 23552, and draw Willy to the screen buffer at 24576 | ||
35297 | LD A,(34271) | Pick up the game mode indicator from 34271 | ||
35300 | CP 2 | Is Willy on his way to the toilet? | ||
35302 | CALL Z,38276 | If so, check whether he's reached it yet | ||
35305 | CALL 38196 | Deal with special rooms (Master Bedroom, The Bathroom) | ||
35308 | CALL 37310 | Draw the rope, arrows and guardians in the current room | ||
35311 | CALL 38137 | Move the conveyor in the current room (if there is one) | ||
35314 | CALL 37841 | Draw the items in the current room (if there are any) and collect any that Willy is touching | ||
This entry point is used by the routine at 37046.
|
||||
35317 | LD HL,24576 | Copy the contents of the screen buffer at 24576 to the display file | ||
35320 | LD DE,16384 | |||
35323 | LD BC,4096 | |||
35326 | LDIR | |||
35328 | LD A,(34271) | Pick up the game mode indicator from 34271 | ||
35331 | AND 2 | Now A=1 if Willy is running to the toilet or already has his head down it, 0 otherwise | ||
35333 | RRCA | |||
35334 | LD HL,34258 | Set Willy's animation frame at 34258 to 1 or 3 if Willy is running to the toilet or already has his head down it; this has the effect of moving Willy at twice his normal speed as he makes his way to the toilet (using animation frames 2 and 0) | ||
35337 | OR (HL) | |||
35338 | LD (HL),A | |||
35339 | LD A,(34253) | Pick up the screen flash counter (unused and always 0) from 34253 | ||
35342 | OR A | Is it zero? | ||
35343 | JR Z,35366 | Jump if so (this jump is always made) | ||
The next section of code is never executed.
|
||||
35345 | DEC A | Decrement the screen flash counter at 34253 | ||
35346 | LD (34253),A | |||
35349 | RLCA | Move bits 0-2 into bits 3-5 and clear all the other bits | ||
35350 | RLCA | |||
35351 | RLCA | |||
35352 | AND 56 | |||
35354 | LD HL,23552 | Set every attribute byte in the buffer at 23552 to this value | ||
35357 | LD DE,23553 | |||
35360 | LD BC,511 | |||
35363 | LD (HL),A | |||
35364 | LDIR | |||
Normal service resumes here.
|
||||
35366 | LD HL,23552 | Copy the contents of the attribute buffer at 23552 to the attribute file | ||
35369 | LD DE,22528 | |||
35372 | LD BC,512 | |||
35375 | LDIR | |||
35377 | LD IX,34175 | Print the current time (see 34175) at (19,25) | ||
35381 | LD DE,20601 | |||
35384 | LD C,6 | |||
35386 | CALL 38528 | |||
35389 | LD IX,34172 | Print the number of items collected (see 34172) at (19,16) | ||
35393 | LD DE,20592 | |||
35396 | LD C,3 | |||
35398 | CALL 38528 | |||
35401 | LD A,(34251) | Increment the minute counter at 34251 | ||
35404 | INC A | |||
35405 | LD (34251),A | |||
35408 | JR NZ,35499 | Jump unless the minute counter has ticked over to 0 | ||
A minute of game time has passed. Update the game clock accordingly.
|
||||
35410 | LD IX,34175 | Point IX at the current time at 34175 | ||
35414 | INC (IX+4) | Increment the units digit of the minute | ||
35417 | LD A,(IX+4) | Pick up the new units digit | ||
35420 | CP 58 | Was it '9' before? | ||
35422 | JR NZ,35499 | Jump if not | ||
35424 | LD (IX+4),48 | Set the units digit of the minute to '0' | ||
35428 | INC (IX+3) | Increment the tens digit of the minute | ||
35431 | LD A,(IX+3) | Pick up the new tens digit | ||
35434 | CP 54 | Was it '5' before? | ||
35436 | JR NZ,35499 | Jump if not | ||
35438 | LD (IX+3),48 | Set the tens digit of the minute to '0' | ||
35442 | LD A,(IX+0) | Pick up the tens digit of the hour | ||
35445 | CP 49 | Is it currently '1'? | ||
35447 | JR NZ,35481 | Jump if not | ||
35449 | INC (IX+1) | Increment the units digit of the hour | ||
35452 | LD A,(IX+1) | Pick up the new units digit | ||
35455 | CP 51 | Was it '2' before? | ||
35457 | JR NZ,35499 | Jump if not | ||
35459 | LD A,(IX+5) | Pick up the 'a' or 'p' of 'am/pm' | ||
35462 | CP 112 | Is it 'p'? | ||
35464 | JP Z,34762 | If so, quit the game (it's 1am) | ||
35467 | LD (IX+0),32 | Set the tens digit of the hour to ' ' (space) | ||
35471 | LD (IX+1),49 | Set the units digit of the hour to '1' | ||
35475 | LD (IX+5),112 | Change the 'a' of 'am' to 'p' | ||
35479 | JR 35499 | |||
35481 | INC (IX+1) | Increment the units digit of the hour | ||
35484 | LD A,(IX+1) | Pick up the new units digit | ||
35487 | CP 58 | Was it '9' before? | ||
35489 | JR NZ,35499 | Jump if not | ||
35491 | LD (IX+1),48 | Set the units digit of the hour to '0' | ||
35495 | LD (IX+0),49 | Set the tens digit of the hour to '1' | ||
Now check whether any non-movement keys are being pressed.
|
||||
35499 | LD BC,65278 | Read keys SHIFT-Z-X-C-V | ||
35502 | IN A,(C) | |||
35504 | LD E,A | Save the result in E | ||
35505 | LD B,127 | Read keys B-N-M-SS-SPACE | ||
35507 | IN A,(C) | |||
35509 | OR E | Combine the results | ||
35510 | AND 1 | Are SHIFT and SPACE being pressed? | ||
35512 | JP Z,34762 | If so, quit the game | ||
35515 | LD A,(34272) | Increment the inactivity timer at 34272 | ||
35518 | INC A | |||
35519 | LD (34272),A | |||
35522 | JR Z,35537 | Jump if the inactivity timer is now 0 (no keys have been pressed for a while) | ||
35524 | LD B,253 | Read keys A-S-D-F-G | ||
35526 | IN A,(C) | |||
35528 | AND 31 | Are any of these keys being pressed? | ||
35530 | CP 31 | |||
35532 | JR Z,35607 | Jump if not | ||
35534 | LD DE,0 | Prepare the delay counters in D and E for the pause loop that follows | ||
The following loop pauses the game until any key except A, S, D, F or G is pressed.
|
||||
35537 | LD B,2 | Read every half-row of keys except A-S-D-F-G | ||
35539 | IN A,(C) | |||
35541 | AND 31 | Are any of these keys being pressed? | ||
35543 | CP 31 | |||
35545 | JR NZ,35591 | If so, resume the game | ||
35547 | INC E | Increment the delay counter in E | ||
35548 | JR NZ,35537 | Jump back unless it's zero | ||
35550 | INC D | Increment the delay counter in D | ||
35551 | JR NZ,35537 | Jump back unless it's zero | ||
35553 | LD A,(34275) | Pick up the WRITETYPER key counter from 34275 | ||
35556 | CP 10 | Has WRITETYPER been keyed in yet? | ||
35558 | CALL NZ,35563 | If not, cycle the INK and PAPER colours | ||
35561 | JR 35537 | Jump back to the beginning of the pause loop |
Prev: 35211 | Up: Map | Next: 35563 |