Prev: 27621 Up: Map Next: 27726
27632: Check whether a character is beside a chair
Used by the routine at 27772. Returns with the zero flag set if the character is standing beside a chair. Returns with the carry flag set if the character should turn round.
Input
A Character's animatory state
DE Character's coordinates
H Character number (152-169)
27632 BIT 7,A Set the zero flag if the character is facing left
This entry point is used by the routine at 27823 with H=172 (ERIC).
27634 LD A,D A=character's y-coordinate
27635 JR NZ,27694 Jump if the character is facing right
27637 CP 155 Set the zero flag if the character is on the top floor
27639 LD A,E A=character's x-coordinate
27640 JR NZ,27666 Jump if the character's on the middle floor
27642 CP 58 Is the character to the right of the Map Room wall?
27644 JR NC,27659 Jump if so
27646 CP 48 This is the x-coordinate of the leftmost chair in the Reading Room
27648 RET C Return if the character is to the left of this
27649 NOP
27650 CP 56 This is the x-coordinate of the rightmost chair in the Reading Room
27652 JR Z,27655 Jump if the character is beside the rightmost chair in the room
27654 RET NC Return if the character is to the right of this chair
27655 AND A
27656 BIT 0,A Return with the zero flag set if the character is standing beside a chair
27658 RET
The character is on the top floor to the right of the Map Room wall.
27659 CP 64 This is the x-coordinate of the leftmost chair in the Map Room
27661 RET C Return if the character is to the left of this
27662 CP 72 This is the x-coordinate of the rightmost chair in the Map Room
27664 JR 27652
The character is somewhere on the middle floor.
27666 CP 39 Is the character to the right of the Exam Room wall?
27668 JR NC,27678 Jump if so
27670 CP 29 This is the x-coordinate of the leftmost chair in the White Room
27672 RET C Return if the character is to the left of this
27673 INC A This is the x-coordinate (+1) of the rightmost chair in the White Room
27674 CP 38
27676 JR 27652
The character is on the middle floor to the right of the Exam Room wall.
27678 CP 43 This is the x-coordinate of the leftmost chair in the Exam Room
27680 RET C Return if the character is to the left of this
27681 CP 60 This is the x-coordinate of the left end of the first set of chairs in the Exam Room
27683 JR C,27689 Jump if the character is to the left of this
27685 CP 68 This is the x-coordinate of the rightmost chair in the Exam Room
27687 JR 27652
The character is in the Exam Room, to the left of the first set of chairs.
27689 INC A This is the x-coordinate (+1) of the right end of the second set of chairs in the Exam Room
27690 CP 54
27692 JR 27652
The character is facing right.
27694 CP 155 Set the zero flag if the character is on the top floor
27696 LD A,E A=character's x-coordinate
27697 JR NZ,27714 Jump if the character is on the middle floor
27699 CP 58 This is the x-coordinate of the wall between the Reading and Map Rooms
27701 JR NC,27710 Jump if the character is to the right of this
27703 CP 55 This is the x-coordinate of the spot between the two chairs at the right in the Reading Room; if this were 'CP 56' instead, kids would be able to find the rightmost seat in the room
27705 CCF Clear the carry flag if the character is to the left of the rightmost chair in the room (i.e. he's still on his way there)
27706 RET NZ Return unless the character is beside the rightmost chair in the room
27707 AND A Reset the zero flag, and set the carry flag to indicate that the character should turn round
27708 CCF
27709 RET
27710 CP 72 This is the x-coordinate of the rightmost seat in the Map Room
27712 JR 27705
27714 CP 39 This is the x-coordinate of the wall between the White and Exam Rooms
27716 JR NC,27722 Jump if the character is to the right of this
27718 CP 37 This is the x-coordinate of the rightmost chair in the White Room
27720 JR 27705
27722 CP 68 This is the x-coordinate of the rightmost chair in the Exam Room
27724 JR 27705
Prev: 27621 Up: Map Next: 27726