![]() |
Routines |
62483 | LD A,(32734) | A=255 if we're in demo mode, 0 otherwise |
62486 | INC A | Are we in demo mode? |
62487 | JP NZ,29178 | Read the keyboard if not |
62490 | LD HL,0 | Set the score (held at 32741) and the number of lines (held at 32743) to 0 |
62493 | LD (32741),HL | |
62496 | LD (32743),HL | |
62499 | CALL 29118 | Check for keypresses |
62502 | JP NZ,63189 | Start a new game if there was one |
62505 | LD DE,(50945) | Pick up the coordinates of little boy no. 10 in DE |
62509 | LD H,210 | 210=ERIC |
62511 | CALL 25843 | Compare the coordinates of ERIC and little boy no. 10 |
62514 | AND A | Are they the same? |
62515 | JR Z,62533 | Jump if so |
62517 | DEC A | Now A=0 (ERIC is on a staircase facing up), 1 (on a staircase facing down), 2 (to the right of little boy no. 10), or 3 (to his left) |
62518 | LD HL,23672 | Point HL at the LSB of the system variable FRAMES |
62521 | XOR 2 | Flip bit 1 of A |
A | ERIC's location | Keypress | 0 | To the right of little boy no. 10 | Left | 1 | To the left of little boy no. 10 | Right | 2 | On a staircase, facing up | Up | 3 | On a staircase, facing down | Down |
---|
62523 | BIT 7,(HL) | Is the LSB of FRAMES < 128? |
62525 | JR Z,62529 | Jump if so: this will be an upper case (fast) keypress |
62527 | ADD A,4 | 4<=A<=7: force a lower case (slow) keypress |
62529 | ADD A,A | A=80+2n where 0<=n<=7 (simulated keypress for LEFT, RIGHT, UP, DOWN or left, right, up, down) |
62530 | ADD A,80 | |
62532 | RET |
62533 | LD A,(50944) | A=animatory state of little boy no. 10 |
62536 | CP 68 | 68: little boy sitting in a chair |
62538 | LD HL,53760 | Point HL at byte 0 of ERIC's buffer |
62541 | JR Z,62549 | Jump if little boy no. 10 is sitting in a chair |
62543 | CP 197 | 197: Is little boy no. 10 sitting on the floor facing right (as in assembly)? |
62545 | JR Z,62549 | Jump if so |
62547 | XOR A | No simulated keypress (ERIC stays still) |
62548 | RET |
62549 | XOR (HL) | Set the carry flag if ERIC and little boy no. 10 are facing in opposite directions |
62550 | RLCA | |
62551 | LD A,98 | 98=keypress code for 'S' (sit) |
62553 | RET NC | Return if ERIC and little boy no. 10 are facing the same way |
62554 | LD A,(HL) | A=ERIC's animatory state |
62555 | RLCA | Set A to 1 if ERIC is facing left (leading to a simulated keypress code of 82, or RIGHT), 0 if he's facing right (leading to a simulated keypress code of 80, or LEFT); that is, make ERIC turn round |
62556 | SBC A,A | |
62557 | INC A | |
62558 | JR 62529 |