![]() |
Routines |
| Prev: 26062 | Up: Map |
|
|||||||||||||||||||
| 26068 | LD L,2 | Point HL at byte 2 of the character's buffer | |||||||||||||||||
| 26070 | LD A,(HL) | A=character's y-coordinate | |||||||||||||||||
| 26071 | LD DE,54066 | The table at 54066 contains the x-coordinates of the left ends of the classrooms | |||||||||||||||||
| 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 | HL=54066 if the character is on the top floor, 54069 if he's on the middle floor | |||||||||||||||||
| 26089 | CP (HL) | Is the character to the left of this classroom? | |||||||||||||||||
| 26090 | JR C,26097 | Jump if so | |||||||||||||||||
| 26092 | INC H | Point HL at the x-coordinate of the right end of the classroom (in the table at 54322) | |||||||||||||||||
| 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: the character is not in a classroom | |||||||||||||||||
| 26103 | RET | ||||||||||||||||||
|
The character is in a classroom. But is he beside a chair?
|
|||||||||||||||||||
| 26104 | INC H | Point HL at the x-coordinate of the leftmost seat in the classroom (in the table at 54578) | |||||||||||||||||
| 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: the character must walk to the rightmost chair | |||||||||||||||||
| 26110 | EX DE,HL | ||||||||||||||||||
| 26111 | RET | ||||||||||||||||||
| 26112 | INC H | Point HL at the x-coordinate of the rightmost seat in the classroom (in the table at 54834) | |||||||||||||||||
| 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: the character must walk to the next chair to the left | |||||||||||||||||
| 26118 | EX DE,HL | ||||||||||||||||||
| 26119 | RET | ||||||||||||||||||
|
The character is between the leftmost and rightmost chairs in the classroom.
|
|||||||||||||||||||
| 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: the character is facing left and standing beside a chair | |||||||||||||||||
| 26133 | RET | ||||||||||||||||||
| Prev: 26062 | Up: Map |