Routines

31969: Walk up and down a few times or until...


Used by tables of A&P numbers 18, 42 and 44 to make a character walk about a fixed location until a specified time, or until a certain number of walkings-up-and-down have been performed

H Character number (183-214)

31969 2E06 LD L,6 Collect the next two bytes from the table of A&P and place them in bytes 6 and 7 of the character's buffer
31971 CD6462 CALL 25188
31974 2E07 LD L,7 Decrease the walkings-up-and-down counter at byte 7 of the character's buffer
31976 35 DEC (HL)
31977 200E JR NZ,31993 Jump forward to check for the time/event if the character has not yet performed the maximum number of walkings-up-and-down
31979 34 INC (HL) Set (HL) back to 1 to ensure that we return to this execution path next time
31980 2E05 LD L,5 Byte 5 holds the x-coordinate of the walkabout origin
31982 CDB47C CALL 31924 Return the character to the walkabout origin if he's not already there
31985 D28C63 JP NC,25484 Move to the next instruction in the table of A&P if the specified time has arrived and the character is ready to respond to it
31988 CD9F63 CALL 25503 Otherwise send the character off to another walkabout destination via the routine at 25581, and return to the instruction at 31991 (below) when done
31991 18ED JR 31974
31993 CDAB7C CALL 31915 Has the specified time arrived, and is the character ready to respond to it?
31996 18F3 JR 31985