![]() |
Routines |
Prev: 63530 | Up: Map |
The address of this interruptible subcommand routine is placed into bytes 14 and 15 of a cat's buffer by the routine at 63530. It makes a cat run up or down to his next walkabout destination, and then terminates.
|
||||||||||
63558 | LD L,0 | Point HL at byte 0 of the cat's buffer | ||||||||
63560 | BIT 0,(HL) | Is the cat in running phase 2 (animatory state 118/246)? | ||||||||
The cat's animatory state is 117 or 245 (running phase 1). Move him forward and advance his animatory state.
|
||||||||||
63562 | JR Z,63580 | Jump if so | ||||||||
63564 | CALL 59848 | Update the SRB for the cat's current animatory state and location | ||||||||
63567 | INC A | A=118/246 (cat running phase 2) | ||||||||
63568 | PUSH AF | Save this animatory state briefly | ||||||||
63569 | RLCA | A=-1 if the cat is facing left, 1 if he's facing right | ||||||||
63570 | CCF | |||||||||
63571 | SBC A,A | |||||||||
63572 | ADD A,A | |||||||||
63573 | INC A | |||||||||
63574 | ADD A,E | Adjust the cat's x-coordinate appropriately | ||||||||
63575 | LD E,A | |||||||||
63576 | POP AF | Restore the cat's next animatory state to A | ||||||||
63577 | JP 59861 | Update the cat's animatory state and location and update the SRB | ||||||||
The cat's animatory state is 118 or 246 (running phase 2). Either advance his animatory state, or turn him round.
|
||||||||||
63580 | LD L,1 | Point HL at byte 1 of the cat's buffer | ||||||||
63582 | LD A,(HL) | A=cat's current x-coordinate | ||||||||
63583 | LD L,11 | The cat's walkabout destination x-coordinate is stored in byte 11 of the cat's buffer | ||||||||
63585 | CP (HL) | Has the cat reached his walkabout destination? | ||||||||
63586 | JP Z,62084 | Terminate this subcommand if so | ||||||||
63589 | LD B,255 | B=-1 (which will set the cat's animatory state to running phase 1) | ||||||||
63591 | LD L,0 | Point HL at byte 0 of the cat's buffer | ||||||||
63593 | BIT 7,(HL) | Set the zero flag if the cat is facing left | ||||||||
63595 | JR C,63610 | Jump if the cat is to the left of his walkabout destination | ||||||||
63597 | JR Z,63601 | Jump if the cat is facing left | ||||||||
63599 | LD B,128 | B=128 (which will turn the cat round) | ||||||||
63601 | PUSH BC | Save the animatory state adjustment | ||||||||
63602 | CALL 59848 | Update the SRB for the cat's current animatory state and location | ||||||||
63605 | POP BC | Restore the animatory state adjustment to B | ||||||||
63606 | ADD A,B | A=cat's next animatory state (running phase 1, or turned round) | ||||||||
63607 | JP 59861 | Update the cat's animatory state and location and update the SRB | ||||||||
63610 | JR NZ,63601 | Jump if the cat is facing right | ||||||||
63612 | JR 63599 | Turn the cat round |
Prev: 63530 | Up: Map |