Routines |
Prev: 63BC | Up: Map | Next: 645B |
Used by command lists 0x80, 0x82, 0x84, 0x86, 0x88, 0x8C, 0x8E, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9A, 0x9C, 0x9E, 0xA0, 0xA2, 0xA4, 0xA6, 0xA8, 0xAA, 0xAC, 0xAE, 0xB0, 0xB2, 0xB4, 0xB8, 0xBA, 0xBC, 0xBE, 0xC0, 0xC6, 0xC8, 0xCA, 0xD0, 0xD4, 0xD6, 0xD8, 0xDA and 0xDE to make a character go to a specified place.
|
||||||||||
63BE | LD A,(HL) | Reset bits 5 and 6 of byte 0x7A of the character's buffer, indicating that he should no longer walk fast or slow continuously (if he was doing so) | ||||||||
63BF | AND $9F | |||||||||
63C1 | LD (HL),A | |||||||||
63C2 | LD L,$65 | Get the destination y-coordinate from the command list and place it in byte 0x65 of the character's buffer | ||||||||
63C4 | CALL $618C | |||||||||
63C7 | LD (HL),A | |||||||||
63C8 | INC L | Get the destination x-coordinate from the command list and place it in byte 0x66 of the character's buffer | ||||||||
63C9 | CALL $618C | |||||||||
63CC | LD (HL),A | |||||||||
This entry point is used by the routines at 69E7 and 6A82.
|
||||||||||
63CD | NOP | |||||||||
63CE | CALL $6CF0 | Make the character stand up if he's not already | ||||||||
63D1 | LD L,$61 | Collect the character's x- and y-coordinates in E and D | ||||||||
63D3 | LD D,(HL) | |||||||||
63D4 | INC L | |||||||||
63D5 | LD E,(HL) | |||||||||
63D6 | LD L,$65 | Bytes 0x65 and 0x66 of the character's buffer contain the destination coordinates | ||||||||
63D8 | LD BC,$633C | Point BC at 633C (guide character to intermediate destination) | ||||||||
63DB | LD A,D | A=character's y-coordinate | ||||||||
63DC | CP (HL) | Is the character on the same floor as his destination? | ||||||||
63DD | JP Z,$6496 | Jump if so | ||||||||
63E0 | CP $9B | Is the character on the top floor? | ||||||||
63E2 | JP Z,$645F | Jump if so | ||||||||
63E5 | CP $A9 | Is the character on the bottom floor? | ||||||||
63E7 | JP Z,$6464 | Jump if so | ||||||||
The character is on the middle floor and is destined for another floor.
|
||||||||||
63EA | LD A,(HL) | A=y-coordinate of destination | ||||||||
63EB | CP $A9 | Set the zero flag if the character is going to the bottom floor | ||||||||
63ED | LD A,$26 | This is the x-coordinate of the wall between the White and Exam Rooms | ||||||||
63EF | JR NZ,$6427 | Jump if the character is going to the top floor | ||||||||
This entry point is used by the routine at 645F with A=57 (the x-coordinate of the wall between the Map and Reading Rooms).
|
||||||||||
63F1 | CP E | E holds the character's x-coordinate | ||||||||
63F2 | LD A,$0C | This is the x-coordinate of the tops of the staircases at the left of the skool | ||||||||
63F4 | JR NC,$63F8 | Jump if the character is to the left of the wall whose x-coordinate (38 or 57) was in A | ||||||||
This entry point is used by the routine at 6496 when the character is on the right-middle or right-top floor and needs to go down the stairs to get to his destination.
|
||||||||||
63F6 | LD A,$4D | This is the x-coordinate of the tops of the staircases at the right of the skool | ||||||||
This entry point is used by the routine at 6496 with A=12 (the x-coordinate of the tops of the staircases at the left of the skool) when the character is on the left-middle or left-top floors and needs to go down the stairs to get to his destination.
|
||||||||||
63F8 | CP E | Is the character at the top of the stairs he needs to descend? | ||||||||
63F9 | JR NZ,$641B | Jump if not | ||||||||
63FB | LD L,$60 | Byte 0x60 of the character's buffer holds his animatory state | ||||||||
63FD | BIT 0,(HL) | Is the character midstride (about to descend)? | ||||||||
63FF | JR NZ,$641B | Jump if so | ||||||||
6401 | CP $30 | Is the target staircase on the right of the skool? | ||||||||
6403 | JR NC,$640B | Jump if so | ||||||||
6405 | BIT 7,(HL) | Is the character facing left? | ||||||||
6407 | JR Z,$640F | Jump if so | ||||||||
6409 | JR $6417 | |||||||||
The character must go to the top of a staircase at the right of the skool.
|
||||||||||
640B | BIT 7,(HL) | Is the character facing left? | ||||||||
640D | JR Z,$6417 | Jump if so | ||||||||
This entry point is used by the routine at 6464.
|
||||||||||
640F | CALL $6214 | Update the SRB for the character's current location | ||||||||
6412 | XOR $80 | Turn the character round | ||||||||
6414 | JP $61B0 | Update the character's animatory state and location and update the SRB | ||||||||
6417 | LD C,$90 | BC=6390 (guide character down stairs) | ||||||||
This entry point is used by the routine at 6464.
|
||||||||||
6419 | LD A,$0F | Going up or down a staircase entails 15 movements | ||||||||
641B | LD L,$69 | Place the interruptible subcommand routine address in BC (633C, 638C or 6390) into bytes 0x69 and 0x6A of the character's buffer | ||||||||
641D | LD (HL),C | |||||||||
641E | INC L | |||||||||
641F | LD (HL),B | |||||||||
6420 | INC L | Byte 0x6B will contain either (a) the x-coordinate of the next intermediate destination (i.e. the final destination itself, or the top or bottom of the next staircase the character must negotiate first) (BC=633C), or (b) 15, that being the number of movements required to ascend or descend a staircase (BC=638C or 6390) | ||||||||
6421 | LD (HL),A | |||||||||
6422 | INC L | Initialise byte 0x6C to 9; this ensures that the routine at 633C will move the character at most 9 paces towards the destination before relinquishing control (and thus giving the routine at 6226 a chance to check whether the command list should be restarted, e.g. for a new lesson) | ||||||||
6423 | LD (HL),$09 | |||||||||
6425 | PUSH BC | Make an indirect jump to 633C, 638C or 6390 | ||||||||
6426 | RET | |||||||||
The character is on the middle floor but is destined for the top floor. At this point A=38 (the x-coordinate of the wall between the White and Exam Rooms).
|
||||||||||
6427 | INC L | Point HL at the destination x-coordinate | ||||||||
6428 | CP E | |||||||||
6429 | LD A,$39 | This is the x-coordinate of the wall between the Map and Reading Rooms | ||||||||
642B | JR NC,$6443 | Jump if the character is to the left of the White Room wall | ||||||||
642D | CP (HL) | (HL) holds the destination x-coordinate | ||||||||
642E | LD A,$46 | This is the x-coordinate of the bottoms of the staircases at the right of the skool | ||||||||
6430 | JR NC,$63F6 | Jump if the destination is to the left of the Map Room wall | ||||||||
6432 | CP E | Is the character at the bottom of the staircase just outside the Exam Room? | ||||||||
6433 | JR NZ,$641B | Jump if not (to send the character there) | ||||||||
6435 | LD L,$60 | Byte 0x60 of the character's buffer holds his animatory state | ||||||||
6437 | BIT 0,(HL) | Is the character midstride? | ||||||||
6439 | JR NZ,$641B | Jump if so (to finish the stride) | ||||||||
643B | BIT 7,(HL) | Is the character facing left? | ||||||||
643D | JR Z,$640F | Jump if so (to turn the character round) | ||||||||
643F | LD C,$8C | BC=638C (guide character up stairs) | ||||||||
6441 | JR $6419 | |||||||||
The character is on the middle floor to the left of the White Room wall, and is destined for the top floor. At this point A=57 (the x-coordinate of the wall between the Map and Reading Rooms).
|
||||||||||
6443 | CP (HL) | (HL) holds the destination x-coordinate | ||||||||
6444 | LD A,$0C | This is the x-coordinate of the tops of the staircases at the left of the skool | ||||||||
6446 | JR C,$63F8 | Jump if the destination is to the right of the Map Room wall | ||||||||
6448 | LD A,$13 | This is the x-coordinate of the bottoms of the staircases at the left of the skool | ||||||||
644A | CP E | Is the character at the bottom of the staircase just outside the White Room? | ||||||||
644B | JR NZ,$641B | Jump if not (to send the character there) | ||||||||
644D | LD L,$60 | Byte 0x60 of the character's buffer holds his animatory state | ||||||||
644F | BIT 0,(HL) | Is the character midstride? | ||||||||
6451 | JR NZ,$641B | Jump if so (to finish the stride) | ||||||||
6453 | BIT 7,(HL) | Is the character facing right? | ||||||||
6455 | JR NZ,$640F | Jump if so (to turn the character round) | ||||||||
6457 | LD C,$8C | BC=638C (guide character up stairs) | ||||||||
6459 | JR $6419 |
Prev: 63BC | Up: Map | Next: 645B |