![]() |
Routines |
| 0 | Character is facing left and standing beside a chair | 3 | Character must walk to the next chair to the left | 4 | Character must walk to the rightmost chair | 255 | Character is not even in a classroom |
| H | Character number (183-210) |
| 26068 | LD L,2 | |
| 26070 | LD A,(HL) | A=character's y-coordinate |
| 26071 | LD DE,54066 | DE points to the classroom/chairs location table (see below) |
| 26074 | LD B,3 | There are three sets of chairs on the top floor |
| 26076 | CP B | Is the character on the top floor? |
| 26077 | JR Z,26086 | Jump if so |
| 26079 | DEC B | B=2 (two sets of chairs on the middle floor) |
| 26080 | CP 10 | Is the character on the middle floor? |
| 26082 | JR NZ,26101 | Jump if not |
| 26084 | LD E,53 | DE=54069 |
| 26086 | DEC L | |
| 26087 | LD A,(HL) | A=character's x-coordinate |
| 26088 | EX DE,HL | |
| 26089 | CP (HL) | Is the character to the left of this classroom? |
| 26090 | JR C,26097 | Jump if so |
| 26092 | INC H | |
| 26093 | CP (HL) | Is the character in this classroom? |
| 26094 | JR C,26104 | Jump if so |
| 26096 | DEC H | |
| 26097 | INC L | |
| 26098 | DJNZ 26089 | |
| 26100 | EX DE,HL | |
| 26101 | LD A,255 | Signal: character is not even in a classroom |
| 26103 | RET |
| 26104 | INC H | |
| 26105 | CP (HL) | Is the character to the right of the leftmost chair? |
| 26106 | JR NC,26112 | Jump if so |
| 26108 | LD A,4 | Signal: character must walk to the rightmost chair |
| 26110 | EX DE,HL | |
| 26111 | RET | |
| 26112 | INC H | |
| 26113 | CP (HL) | Is the character to the left of the rightmost chair? |
| 26114 | JR C,26120 | Jump if so |
| 26116 | LD A,3 | Signal: character must walk to the next chair to the left |
| 26118 | EX DE,HL | |
| 26119 | RET |
| 26120 | DEC E | E=0 |
| 26121 | LD A,(DE) | A=character's animatory state |
| 26122 | INC E | E=1 |
| 26123 | RLCA | |
| 26124 | JR C,26108 | Jump if the character is facing right |
| 26126 | LD A,(DE) | A=character's x-coordinate |
| 26127 | XOR (HL) | The chairs in a classroom have either all odd or all even x-coordinates. Is the character standing beside one? |
| 26128 | RRCA | |
| 26129 | JR NC,26116 | Jump if not |
| 26131 | EX DE,HL | |
| 26132 | XOR A | Signal: character is beside a chair |
| 26133 | RET |