D | y-coordinate of mouse to release |
E | x-coordinate of mouse to release |
31502 | 26C6 | LD H,198 | Use buffers 198 and 199 (little boys nos. 9 and 10) for released mice if possible |
31504 | 0602 | LD B,2 | |
31506 | CD1A7B | CALL 31514 | Prepare these buffers |
31509 | C8 | RET Z | Return if ERIC has no mice left |
31510 | 26CE | LD H,206 | Also use buffers 206-208 (BOY WANDER, ANGELFACE and EINSTEIN) for released mice if possible |
31512 | 0603 | LD B,3 | |
31514 | 2E12 | LD L,18 | |
31516 | 7E | LD A,(HL) | |
31517 | FE7A | CP 122 | Is a mouse already using this buffer? |
31519 | 282F | JR Z,31568 | Jump if so |
31521 | 2E01 | LD L,1 | |
31523 | 7E | LD A,(HL) | A=x-coordinate of character using this buffer |
31524 | FE8E | CP 142 | Is this character on-screen? |
31526 | 3028 | JR NC,31568 | Jump if so (we can't use his buffer) |
31528 | 2D | DEC L | |
31529 | 7E | LD A,(HL) | A=character's animatory state |
31530 | 2E0F | LD L,15 | |
31532 | 77 | LD (HL),A | Store this in byte 15 of the buffer temporarily |
31533 | CD9162 | CALL 25233 | A=random number |
31536 | E61F | AND 31 | |
31538 | C60A | ADD A,10 | 10≤A≤41 |
31540 | 2C | INC L | L=16 |
31541 | 77 | LD (HL),A | |
31542 | 2C | INC L | Place the address of the routine at 31254 into bytes 17 and 18 of the character's buffer |
31543 | 3616 | LD (HL),22 | |
31545 | 2C | INC L | |
31546 | 367A | LD (HL),122 | |
31548 | AF | XOR A | |
31549 | 2C | INC L | Zero out bytes 19 and 20 |
31550 | 77 | LD (HL),A | |
31551 | 2C | INC L | |
31552 | 77 | LD (HL),A | |
31553 | 2C | INC L | L=21 |
31554 | 70 | LD (HL),B | |
31555 | 2C | INC L | Store x-coordinate of mouse in byte 22 |
31556 | 73 | LD (HL),E | |
31557 | 2E02 | LD L,2 | And the y-coordinate in byte 2 |
31559 | 72 | LD (HL),D | |
31560 | 3AE17F | LD A,(32737) | A=number of mice caught |
31563 | 3D | DEC A | One fewer now |
31564 | 32E17F | LD (32737),A | |
31567 | C8 | RET Z | Return if ERIC has no mice left |
31568 | 24 | INC H | Point to next potential buffer for released mouse |
31569 | 10C7 | DJNZ 31514 | |
31571 | C9 | RET |