![]() |
Routines |
| D | y-coordinate of mouse to release |
| E | x-coordinate of mouse to release |
| 31502 | LD H,198 | Use buffers 198 and 199 (little boys nos. 9 and 10) for released mice if possible |
| 31504 | LD B,2 | |
| 31506 | CALL 31514 | Prepare these buffers |
| 31509 | RET Z | Return if ERIC has no mice left |
| 31510 | LD H,206 | Also use buffers 206-208 (BOY WANDER, ANGELFACE and EINSTEIN) for released mice if possible |
| 31512 | LD B,3 | |
| 31514 | LD L,18 | Pick up the MSB of the routine address in bytes 17 and 18 of the character's buffer |
| 31516 | LD A,(HL) | |
| 31517 | CP 122 | Is a mouse already using this buffer (122=MSB of 31254)? |
| 31519 | JR Z,31568 | Jump if so |
| 31521 | LD L,1 | A=x-coordinate of the character using this buffer |
| 31523 | LD A,(HL) | |
| 31524 | CP 142 | Is this character on-screen? |
| 31526 | JR NC,31568 | Jump if so (we can't use his buffer) |
| 31528 | DEC L | L=0 |
| 31529 | LD A,(HL) | A=character's animatory state |
| 31530 | LD L,15 | Store this in byte 15 of the buffer for retrieval when the mouse dies |
| 31532 | LD (HL),A | |
| 31533 | CALL 25233 | A=random number between 10 and 41; this determines the lifespan of the mouse |
| 31536 | AND 31 | |
| 31538 | ADD A,10 | |
| 31540 | INC L | Store this lifespan parameter in byte 16 of the buffer |
| 31541 | LD (HL),A | |
| 31542 | INC L | Place the address of the routine at 31254 into bytes 17 and 18 of the character's buffer |
| 31543 | LD (HL),22 | |
| 31545 | INC L | |
| 31546 | LD (HL),122 | |
| 31548 | XOR A | Set bytes 19 and 20 to 0 so that the mouse is initially hidden (see 31254 for details on how these bytes are used) |
| 31549 | INC L | |
| 31550 | LD (HL),A | |
| 31551 | INC L | |
| 31552 | LD (HL),A | |
| 31553 | INC L | Set byte 21 (time remaining before coming out of hiding) to 3, 2 or 1 |
| 31554 | LD (HL),B | |
| 31555 | INC L | Store the x-coordinate of the mouse in byte 22, so it appears there when it comes out of hiding |
| 31556 | LD (HL),E | |
| 31557 | LD L,2 | Store the y-coordinate in byte 2 |
| 31559 | LD (HL),D | |
| 31560 | LD A,(32737) | 32737 holds the number of mice ERIC has caught |
| 31563 | DEC A | One fewer now |
| 31564 | LD (32737),A | |
| 31567 | RET Z | Return if ERIC has no mice left |
| 31568 | INC H | Point to the next potential buffer for a released mouse |
| 31569 | DJNZ 31514 | Jump back until all have been considered |
| 31571 | RET |