![]() |
Routines |
Prev: 26450 | Up: Map |
Entered from the routine at 63768.
|
|||||||
26471 | LD HL,(32759) | 32759 holds the lesson clock | |||||
26474 | DEC HL | Decrease it by 1 and set the zero flag if it's time to ring the bell | |||||
26475 | LD A,H | ||||||
26476 | OR L | ||||||
26477 | LD (32759),HL | ||||||
26480 | CALL Z,26342 | Change the lesson if the lesson clock reached zero | |||||
26483 | CALL 25126 | Move the characters | |||||
26486 | CALL 27353 | Move ERIC | |||||
26489 | JR C,26556 | Jump if ERIC has already been dealt with | |||||
26491 | LD HL,32744 | Decrement ERIC's main action timer at 32744 | |||||
26494 | DEC (HL) | ||||||
26495 | JR NZ,26556 | Jump unless it's time to deal with ERIC | |||||
26497 | INC L | Pick up the midstride indicator at 32745 | |||||
26498 | LD A,(HL) | ||||||
26499 | AND A | Is ERIC midstride? | |||||
26500 | JR Z,26507 | Jump if not | |||||
26502 | CALL 25856 | Move ERIC from the midstride position, then scroll the screen left or right if necessary | |||||
26505 | JR 26559 | ||||||
Time to check the keyboard (or simulate a keypress in demo mode) to see how ERIC should move next.
|
|||||||
26507 | DEC L | Reset ERIC's main action timer at 32744 to 9 | |||||
26508 | LD (HL),9 | ||||||
26510 | CALL 62938 | Collect or simulate a keypress | |||||
26513 | JR Z,26556 | Jump if no relevant keypress was collected or simulated | |||||
26515 | LD HL,32763 | 32763 holds ERIC's status flags | |||||
26518 | BIT 5,(HL) | Is ERIC writing on a blackboard? | |||||
26520 | JR Z,26527 | Jump if not | |||||
26522 | CALL 63146 | Deal with keypresses while ERIC is writing on the board | |||||
26525 | JR 26556 | ||||||
26527 | INC L | DE=32764 (which holds the ASCII code of the last keypress) | |||||
26528 | EX DE,HL | ||||||
26529 | CP 32 | Was the keypress ASCII code >= 32? | |||||
26531 | JR C,26556 | Jump if not | |||||
26533 | LD HL,26556 | Push the address of the entry point at 26556 (see below) onto the stack | |||||
26536 | PUSH HL | ||||||
26537 | LD L,A | Point HL at the appropriate entry in the keypress offset table | |||||
26538 | LD H,104 | ||||||
26540 | LD L,(HL) | ||||||
26541 | LDI | Copy the ASCII code of the keypress into 32764 | |||||
26543 | LD E,(HL) | Pick up in DE the address of the appropriate routine for dealing with the keypress | |||||
26544 | INC L | ||||||
26545 | LD D,(HL) | ||||||
26546 | PUSH DE | Push this address onto the stack | |||||
26547 | LD HL,44128 | Point HL at byte 96 of ERIC's buffer | |||||
26550 | LD B,(HL) | Pick up ERIC's animatory state in B and his coordinates in DE | |||||
26551 | INC L | ||||||
26552 | LD D,(HL) | ||||||
26553 | INC L | ||||||
26554 | LD E,(HL) | ||||||
26555 | RET | Make an indirect jump to the appropriate routine for dealing with ERIC, then return to 26556 below | |||||
Now that ERIC has been moved or otherwise dealt with, update the display.
|
|||||||
26556 | CALL 27026 | Update the display | |||||
The next section of code ensures that we don't pass through the main loop more than once every 20 milliseconds.
|
|||||||
26559 | LD HL,32762 | Wait until the system variable FRAMES at 23672 has been incremented since the last time it was checked (FRAMES is incremented every 20ms) | |||||
26562 | LD A,(23672) | ||||||
26565 | CP (HL) | ||||||
26566 | JR Z,26562 | ||||||
26568 | LD (HL),A | ||||||
26569 | JP 26471 | Jump back to the beginning of the main loop |
Prev: 26450 | Up: Map |