| Routines

27090: Set a random destination for a character

Used by the routine at 27111. Selects a destination at random from the table of locations at 27082 and places its coordinates into bytes 101 and 102 of the character's buffer.
Input
H | Character number (152-169)
27090 | CALL 24993 | A=random number
27093 | AND 6 | A=202, 204, 206 or 208
27095 | ADD A,202
27097 | LD E,A | Point DE at one of the four skool locations in the table at 27082
27098 | LD D,105
27100 | EX DE,HL | Pick up the coordinates of the skool location in A and D
27101 | LD A,(HL)
27102 | INC L
27103 | LD H,(HL)
27104 | EX DE,HL
27105 | LD L,101 | Place the coordinates of the skool location into bytes 101 and 102 of the character's buffer to make it his next destination
27107 | LD (HL),A
27108 | INC L
27109 | LD (HL),D
27110 | RET |