Back to Skool Routines
25815: Go to a place at random
Used by command lists 18, 20, 28, 40, 42, 66, 68, 78 and 88 to make a character go to a place at random.
H Character number (183-209)
25815 LD L,36 Point HL at byte 36 of the character's buffer
25817 LD E,(HL) Pick up the contents in E
25818 EX DE,HL
25819 CALL 25233 A=random number
25822 AND 3 A=211, 212, 213 or 214
25824 ADD A,211
25826 LD H,A Point HL at an entry in the table of random locations
25827 LD E,1 Point DE at byte 1 of the character's buffer
25829 LD A,(DE) A=character's x-coordinate
25830 CP (HL) Is the character already at this x-coordinate?
25831 JR Z,25819 Get another random location if so
25833 LD E,5 Copy the random location's coordinates into bytes 5 and 6 of the character's buffer, thus making it his next destination
25835 LDI
25837 LDI
25839 EX DE,HL Transfer the character number back to H
25840 JP 25705 Exit via the Go to... routine
The contents of byte 36 of each character's buffer are as follows:
H Character Address Byte H Character Address Byte
183 Little girl no. 1 46884 36 197 Little boy no. 8 50468 42
184 Little girl no. 2 47140 36 198 Little boy no. 9 50724 44
185 Little girl no. 3 47396 36 199 Little boy no. 10 50980 44
186 Little girl no. 4 47652 38 200 MR WACKER 51236 48
187 Little girl no. 5 47908 38 201 MR WITHIT 51492 48
188 Little girl no. 6 48164 38 202 MR ROCKITT 51748 68
189 Little girl no. 7 48420 38 203 MR CREAK 52004 68
190 Little boy no. 1 48676 40 204 MISS TAKE 52260 38
191 Little boy no. 2 48932 40 205 ALBERT 52516 44
192 Little boy no. 3 49188 40 206 BOY WANDER 52772 46
193 Little boy no. 4 49444 42 207 ANGELFACE 53028 46
194 Little boy no. 5 49700 42 208 EINSTEIN 53284 44
195 Little boy no. 6 49956 42 209 HAYLEY 53540 36
196 Little boy no. 7 50212 42
And here are the random locations used by this routine:
E D=211 D=212 D=213 D=214
36 129,17 144,17 136,17 189,17
38 189,17 189,10 170,17 182,3
40 38,3 10,10 10,17 66,17
42 38,3 10,17 109,17 75,17
44 112,17 145,17 158,17 37,3
46 189,10 183,17 137,17 72,17
48 157,17 38,3 10,17 92,17
68 38,3 90,3 10,17 90,17