![]() |
Routines |
H | Character number (183-214) |
25700 | LD L,5 | Pull the destination coordinates from the command list into bytes 5 and 6 of the character's buffer |
25702 | CALL 25188 |
25705 | LD L,3 | Replace the address of this routine in bytes 3 and 4 of the character's buffer with 25726 (below) |
25707 | LD (HL),126 | |
25709 | LD L,0 | Point HL at byte 0 of the character's buffer |
25711 | LD A,(HL) | A=animatory state of character |
25712 | AND 7 | Is the character sitting on a chair (kids only)? |
25714 | CP 4 | |
25716 | JR NZ,25726 | Jump if not |
25718 | CALL 25012 | Update SRB for the character's current animatory state |
25721 | AND 248 | A=animatory state of character standing up |
25723 | JP 24880 | Update SRB for the character's new animatory state |
25726 | LD L,6 | Collect the destination coordinates into DE |
25728 | LD D,(HL) | |
25729 | DEC L | |
25730 | LD E,(HL) | |
25731 | LD L,1 | Point HL at byte 1 of the character's buffer |
25733 | LD A,E | A=character's current x-coordinate |
25734 | CP (HL) | Does the character's current x-coordinate match that of the destination? |
25735 | INC HL | L=2 |
25736 | JR NZ,25743 | Jump forward if not |
25738 | LD A,D | A=character's current y-coordinate |
25739 | CP (HL) | Is the character already at his destination? |
25740 | JP Z,25484 | Move to the next instruction in the command list if so |
25743 | CALL 25554 | Get the region identifier for the character's destination |
ID | Region | 189 | Top floor, left of left study door in boys' skool | 190 | Middle floor, left of far wall of science lab storeroom | 191 | Bottom floor (anywhere) | 192 | Assembly hall stage | 193 | Near middle-floor window in boys' skool | 194 | Top floor, right of left study door in boys' skool | 195 | Middle floor, girls' skool | 196 | Top floor, girls' skool |
---|
25746 | LD D,(HL) | Collect the character's current coordinates into DE |
25747 | DEC L | |
25748 | LD E,(HL) | |
25749 | LD L,A | L=destination region ID (189-196) |
25750 | CALL 25554 | A=region ID (189-196) for character's current location |
25753 | CP L | Will the character have to negotiate any staircases in order to reach his destination? |
25754 | JR Z,25800 | Jump if not (he's in the same region as his destination) |
25756 | LD D,A | D=region ID of current location (189-196) |
25757 | LD A,L | A=destination region ID (189-196) |
25758 | SUB 129 | E=destination region ID minus 129 (60-67) |
25760 | LD E,A | |
25761 | LD A,(DE) | Collect the appropriate staircase endpoint identifier |
189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 48444 | 189 | 189 | 189 | 189 | 189 | 189 | 189 | 189 | 189 | 48700 | 190 | 190 | 190 | 191 | 191 | 191 | 191 | 191 | 191 | 48956 | 191 | 192 | 192 | 191 | 193 | 193 | 193 | 194 | 194 | 49212 | 192 | 195 | 195 | 195 | 192 | 196 | 196 | 195 | 195 | 49468 | 193 | 197 | 197 | 197 | 197 | 193 | 198 | 197 | 197 | 49724 | 194 | 199 | 199 | 199 | 199 | 199 | 199 | 199 | 199 | 49980 | 195 | 200 | 200 | 200 | 200 | 200 | 200 | 195 | 206 | 50236 | 196 | 207 | 207 | 207 | 207 | 207 | 207 | 207 | 207 |
---|
ID | x | d | LSB | n | Staircase endpoint | 48452 | 189 | 26 | 0 | 77 | 8 | Top of stairs, top floor, between blue room and revision library | 48708 | 190 | 19 | 128 | 56 | 8 | Bottom of stairs, middle floor, between science lab and wash basins | 48964 | 191 | 15 | 128 | 77 | 8 | Top of stairs, middle floor, between science lab and wash basins | 49220 | 192 | 22 | 0 | 56 | 8 | Bottom of stairs, bottom floor, far left of boys' skool | 49476 | 193 | 83 | 0 | 56 | 4 | Bottom of stairs, bottom floor, leading up to assembly hall stage | 49732 | 194 | 176 | 128 | 56 | 8 | Bottom of stairs, bottom floor, girls' skool | 49988 | 195 | 80 | 128 | 77 | 4 | Top of stairs leading down to bottom floor, assembly hall stage | 50244 | 196 | 81 | 128 | 56 | 5 | Bottom of stairs leading up to middle floor, assembly hall stage | 50500 | 197 | 85 | 0 | 77 | 5 | Top of stairs, middle floor, leading down to assembly hall stage | 50756 | 198 | 91 | 0 | 56 | 8 | Bottom of stairs, middle floor, leading up to head's study | 51012 | 199 | 84 | 128 | 77 | 8 | Top of stairs, top floor, at head's study door | 51268 | 200 | 183 | 0 | 77 | 8 | Top of stairs, middle floor, girls' skool | 52804 | 206 | 186 | 0 | 56 | 8 | Bottom of stairs, middle floor, girls' skool | 53060 | 207 | 179 | 128 | 77 | 8 | Top of stairs, top floor, girls' skool |
---|
25762 | LD D,A | Place the staircase endpoint identifier in D |
25763 | LD E,68 | Byte 68 holds the x-coordinate of the top or bottom of the staircase identified by D |
25765 | LD L,1 | Point DE at byte 1 of the character's buffer, and HL at the staircase endpoint x-coordinate |
25767 | EX DE,HL | |
25768 | LD A,(DE) | A=character's current x-coordinate |
25769 | CP (HL) | Is the character already at the top or bottom of the appropriate staircase? |
25770 | JR NZ,25796 | Jump forward if not |
25772 | INC L | (HL)=0 if the character has to face left to ascend or descend the stairs, 128 otherwise |
25773 | DEC E | E=0 |
25774 | LD A,(DE) | A=character's animatory state |
25775 | XOR (HL) | Set the carry flag if the character has to turn round to negotiate the staircase |
25776 | RLCA | |
25777 | EX DE,HL | Swap DE and HL so that H holds the character number |
25778 | JP C,25648 | Turn the character round if he's facing the wrong way |
25781 | EX DE,HL | Swap DE and HL back again |
25782 | LD E,11 | Point DE at byte 11 of the character's buffer |
25784 | INC L | L=70 |
25785 | LD C,(HL) | BC=25656 if the stairs are to be ascended, 25677 if descended |
25786 | LD B,100 | |
25788 | NOP | |
25789 | INC L | L=71 |
25790 | LD A,(HL) | A=1+number of steps in staircase |
25791 | LD (DE),A | Place this number of steps in byte 11 of the character's buffer |
25792 | EX DE,HL | Swap DE and HL so that H holds the character number |
25793 | JP 25520 | Place the routine address in BC into bytes 9 and 10 of the character's buffer and jump to it |
25796 | LD A,(HL) | A=x-coordinate of the top or bottom of the staircase |
25797 | EX DE,HL | H=character number |
25798 | JR 25803 | Send the character towards the staircase |
25800 | LD L,5 | Point HL at byte 5 of the character's buffer |
25802 | LD A,(HL) | A=x-coordinate of the character's destination |
25803 | LD L,11 | Place the x-coordinate of the top or bottom of the staircase, or the destination, into byte 11 of the character's buffer |
25805 | LD (HL),A | |
25806 | LD BC,25581 | Place the address of the routine at 25581 into bytes 9 and 10 of the character's buffer and jump to it, thus guiding the character to this x-coordinate |
25809 | JP 25520 |