![]() |
Routines |
| B | Number of characters to check (11, 3, or 1) |
| D | Number of first character to check (152, 167, or 172) |
| H | Number of character who wants to sit down (152-169) |
| 27543 | LD L,98 | Byte 98 of a character's buffer holds his x-coordinate |
| 27545 | LD E,L | |
| 27546 | LD A,(DE) | A=x-coordinate of the potential dethronee |
| 27547 | CP (HL) | Do the x-coordinates match? |
| 27548 | JR NZ,27564 | Jump to consider the next character if not |
| 27550 | DEC E | E=L=97 (which byte holds the character's y-coordinate) |
| 27551 | DEC L | |
| 27552 | LD A,(DE) | A=y-coordinate of the potential dethronee |
| 27553 | CP (HL) | Do the y-coordinates match? |
| 27554 | JR NZ,27564 | Jump to consider the next character if not |
| 27556 | DEC E | E=96 |
| 27557 | LD A,(DE) | A=animatory state of the potential dethronee |
| 27558 | AND 15 | |
| 27560 | CP 5 | Is this character sitting in the chair? |
| 27562 | JR Z,27569 | Dethrone him if so |
| 27564 | INC D | Next character to check |
| 27565 | DJNZ 27543 | Jump back until all potential dethronees have been checked |
| 27567 | AND A | Return with the carry flag reset to indicate that no one was knocked out of the chair |
| 27568 | RET | |
| 27569 | LD A,D | A=number of character sitting in chair |
| 27570 | CP 172 | Is ERIC sitting here? |
| 27572 | JR NZ,27601 | Jump if not |
| 27574 | LD DE,32763 | 32763 holds ERIC's status flags |
| 27577 | EX DE,HL | |
| 27578 | SET 4,(HL) | Signal: ERIC has been knocked out of his chair |
| 27580 | EX DE,HL |
| 27581 | LD L,112 | Remove the routine address from bytes 111 and 112 of the buffer of the character who is going to sit down |
| 27583 | LD (HL),0 | |
| 27585 | LD L,96 | A=this character's current animatory state |
| 27587 | LD A,(HL) | |
| 27588 | AND 248 | Set A to the animatory state of this character sitting in a chair |
| 27590 | ADD A,5 | |
| 27592 | INC L | Pick up the character's coordinates in DE |
| 27593 | LD D,(HL) | |
| 27594 | INC L | |
| 27595 | LD E,(HL) | |
| 27596 | CALL 25008 | Update the character's animatory state and update SRB |
| 27599 | SCF | Return with the carry flag set to indicate that a character was pushed out of his chair |
| 27600 | RET |
| 27601 | LD E,112 | Is there a routine address in bytes 111 and 112 of the seated character's buffer? |
| 27603 | LD A,(DE) | |
| 27604 | AND A | |
| 27605 | JR Z,27613 | Jump if not |
| 27607 | LD L,96 | A=current animatory state of the character who wants to sit down |
| 27609 | LD A,(HL) | |
| 27610 | INC A | Put this character midstride; this has the effect of making him walk to the next chair |
| 27611 | JR 27592 |
| 27613 | EX DE,HL | |
| 27614 | LD (HL),108 | Place the address of the routine at 27733 into bytes 111 and 112 of the seated character's buffer |
| 27616 | DEC L | |
| 27617 | LD (HL),85 | |
| 27619 | JR 27580 |