![]() |
Routines |
| Prev: F82A | Up: Map |
|
The address of this interruptible subcommand routine is placed into bytes 0x0E and 0x0F of a cat's buffer by the routine at F82A. It makes a cat run up or down to his next walkabout destination, and then terminates.
|
||||||||||
| F846 | LD L,$00 | Point HL at byte 0x00 of the cat's buffer | ||||||||
| F848 | BIT 0,(HL) | Is the cat in running phase 2 (animatory state 0x76/0xF6)? | ||||||||
|
The cat's animatory state is 0x75 or 0xF5 (running phase 1). Move him forward and advance his animatory state.
|
||||||||||
| F84A | JR Z,$F85C | Jump if so | ||||||||
| F84C | CALL $E9C8 | Update the SRB for the cat's current animatory state and location | ||||||||
| F84F | INC A | A=0x76/0xF6 (cat running phase 2) | ||||||||
| F850 | PUSH AF | Save this animatory state briefly | ||||||||
| F851 | RLCA | A=-1 if the cat is facing left, 1 if he's facing right | ||||||||
| F852 | CCF | |||||||||
| F853 | SBC A,A | |||||||||
| F854 | ADD A,A | |||||||||
| F855 | INC A | |||||||||
| F856 | ADD A,E | Adjust the cat's x-coordinate appropriately | ||||||||
| F857 | LD E,A | |||||||||
| F858 | POP AF | Restore the cat's next animatory state to A | ||||||||
| F859 | JP $E9D5 | Update the cat's animatory state and location and update the SRB | ||||||||
|
The cat's animatory state is 0x76 or 0xF6 (running phase 2). Either advance his animatory state, or turn him round.
|
||||||||||
| F85C | LD L,$01 | Point HL at byte 0x01 of the cat's buffer | ||||||||
| F85E | LD A,(HL) | A=cat's current x-coordinate | ||||||||
| F85F | LD L,$0B | The cat's walkabout destination x-coordinate is stored in byte 0x0B of the cat's buffer | ||||||||
| F861 | CP (HL) | Has the cat reached his walkabout destination? | ||||||||
| F862 | JP Z,$F284 | Terminate this subcommand if so | ||||||||
| F865 | LD B,$FF | B=-1 (which will set the cat's animatory state to running phase 1) | ||||||||
| F867 | LD L,$00 | Point HL at byte 0x00 of the cat's buffer | ||||||||
| F869 | BIT 7,(HL) | Set the zero flag if the cat is facing left | ||||||||
| F86B | JR C,$F87A | Jump if the cat is to the left of his walkabout destination | ||||||||
| F86D | JR Z,$F871 | Jump if the cat is facing left | ||||||||
| F86F | LD B,$80 | B=0x80 (which will turn the cat round) | ||||||||
| F871 | PUSH BC | Save the animatory state adjustment | ||||||||
| F872 | CALL $E9C8 | Update the SRB for the cat's current animatory state and location | ||||||||
| F875 | POP BC | Restore the animatory state adjustment to B | ||||||||
| F876 | ADD A,B | A=cat's next animatory state (running phase 1, or turned round) | ||||||||
| F877 | JP $E9D5 | Update the cat's animatory state and location and update the SRB | ||||||||
| F87A | JR NZ,$F871 | Jump if the cat is facing right | ||||||||
| F87C | JR $F86F | Turn the cat round | ||||||||
| Prev: F82A | Up: Map |