Prev: 63520 Up: Map Next: 63558
63530: Control a cat
Used by the command list at 65170. Makes the cat run up and down for ever.
Input
H 218 (Cat)
63530 LD L,1 Point HL at byte 1 of the cat's buffer
63532 LD A,(HL) A=cat's initial x-coordinate
63533 LD L,3 Set bit 7 of byte 3 of the cat's buffer (cats always run)
63535 LD (HL),128
63537 LD L,10 The cat's initial x-coordinate will be its walkabout origin; store it in byte 10 of the cat's buffer
63539 LD (HL),A
The following loop controls the cat from now on.
63540 CALL 61823 Get a random number between 0 and 15 in A
63543 AND 15
63545 LD L,10 Add the x-coordinate of the cat's walkabout origin to get the next walkabout destination x-coordinate
63547 ADD A,(HL)
63548 INC L Store this in byte 11 of the cat's buffer
63549 LD (HL),A
63550 LD BC,63558 Copy the address of the interruptible subcommand routine at 63558 into bytes 14 and 15 of the cat's buffer, and change the address of the primary command routine to 63556 (below)
63553 CALL 63386
63556 JR 63540
Prev: 63520 Up: Map Next: 63558