![]() |
Routines |
H | 210 (ERIC) |
31573 | LD L,0 | Point HL at byte 0 of ERIC's buffer |
31575 | LD A,(HL) | A=ERIC's animatory state |
31576 | RLCA | Set A to -1 if ERIC is facing left, or 1 if he's facing right |
31577 | SBC A,A | |
31578 | ADD A,A | |
31579 | CPL | |
31580 | INC L | L=1 |
31581 | ADD A,(HL) | Now A=x-coordinate of the spot in front of ERIC |
31582 | INC L | L=2 |
31583 | LD DE,(54273) | Pick up the coordinates of the character using buffer 212 (mouse or frog) |
31587 | CP E | Is there a mouse or frog at this x-coordinate? |
31588 | RET NZ | Return if not |
31589 | LD A,(HL) | A=ERIC's y-coordinate |
31590 | CP D | Is the mouse/frog on this floor? |
31591 | RET NZ | Return if not |
31592 | LD A,(54272) | Pick up the mouse/frog's animatory state in A |
31595 | AND 127 | Discard all but the "direction" bit (bit 7) |
31597 | CP 47 | 47: Is it a mouse? |
31599 | JP NZ,31733 | Jump if not (it's the frog) |
31602 | LD H,212 | H=212 (the mouse's buffer) |
31604 | CALL 25012 | Update SRB for the mouse's current animatory state and location |
31607 | LD HL,32767 | 32767 holds the column of the play area at the far left of the screen |
31610 | CALL 25233 | A=random number from 0 to 7; we'll use this to determine where the new free mouse will be placed |
31613 | AND 7 | |
31615 | LD D,A | Copy this random number to D |
31616 | CP 2 | Jump if the random number is >= 2 |
31618 | JR NC,31628 | |
31620 | LD A,(HL) | A=X (column of play area at far left of screen) |
31621 | RLCA | |
31622 | JR C,31610 | Jump if X>=128 to get another random number |
31624 | LD L,170 | 170=x-coordinate for new free mouse |
31626 | JR 31651 | Go and figure out the y-coordinate |
31628 | CP 5 | |
31630 | LD A,(HL) | A=X (column of play area at far left of screen) |
31631 | JR NC,31645 | Jump if the random number is >= 5 |
31633 | CP 56 | |
31635 | LD L,88 | 88=possible x-coordinate for new free mouse |
31637 | JR C,31651 | Jump if X<56 to figure out the y-coordinate |
31639 | CP 104 | Jump if 56<=X<104 to get another random number |
31641 | JR C,31610 | |
31643 | JR 31651 | Go and figure out the y-coordinate for the mouse |
31645 | LD L,10 | 10=possible x-coordinate for new free mouse |
31647 | CP 56 | Jump if X<56 to get another random number |
31649 | JR C,31610 |
R | X=(32767) | x | 0-1 | X<128 | 170 | 2-4 | X<56 or X>=104 | 88 | 5-7 | X>=56 | 10 |
---|
31651 | LD A,D | A=random number from 0 to 7 |
31652 | SUB 3 | Convert this to a random number from 0 to 2 by taking the remainder when divided by 3 |
31654 | JR NC,31652 | |
31656 | ADD A,3 | |
31658 | LD H,17 | 17=possible y-coordinate for new free mouse (bottom floor) |
31660 | JR Z,31669 | Jump if the random number is 0 |
31662 | DEC A | |
31663 | LD H,10 | 10=possible y-coordinate for new free mouse (middle floor) |
31665 | JR Z,31669 | Jump if the random number was 1 |
31667 | LD H,3 | 3=y-coordinate for new free mouse (top floor) |
31669 | LD (54273),HL | Fill in the location of the new free mouse |
31672 | LD A,10 | Add 100 to the score, print it and make a sound effect |
31674 | CALL 28952 | |
31677 | LD HL,32737 | 32737 holds the number of mice ERIC has caught |
31680 | INC (HL) | Increase this by 1 |
31681 | LD A,(HL) |
31682 | LD A,(32737) | A=number of mice in ERIC's pocket |
31685 | LD C,A | C will count the number of mice remaining to be printed in the inventory |
31686 | LD L,168 | 168=LSB of the display file address for the spot in the inventory for the first captive mouse |
31688 | LD A,C | A=number of mice left to print |
31689 | AND A | Set the zero flag if there are none left |
31690 | LD B,8 | There are 8 bytes in the mouse UDG/inventory slot |
31692 | LD H,80 | Set HL to the appropriate display file address |
31694 | JR NZ,31702 | Jump if we need to draw a mouse here |
31696 | LD (HL),A | Otherwise blank out this spot in the mouse inventory |
31697 | INC H | |
31698 | DJNZ 31696 | |
31700 | JR 31712 | Move to the next spot in the mouse inventory |
31702 | LD DE,40928 | Point DE at the captured mouse UDG data |
31705 | DEC C | Decrease the captured mouse counter |
31706 | LD A,(DE) | Display a captured mouse in the inventory |
31707 | LD (HL),A | |
31708 | INC H | |
31709 | INC E | |
31710 | DJNZ 31706 | |
31712 | INC L | Point to the next spot in the mouse inventory |
31713 | BIT 4,L | Have we drawn all 8 spots yet (L=176)? |
31715 | JR Z,31688 | Jump back to draw the next one if not |
31717 | LD H,210 | 210=ERIC |
31719 | RET |