Routines

25815: Go to a place at random


Used by the tables of A&P to make a character go to a place at random

H Character number (183-209)

25815 2E24 LD L,36 Point to byte 36 of the character's buffer
25817 5E LD E,(HL)
25818 EB EX DE,HL
25819 CD9162 CALL 25233 A=random number
25822 E603 AND 3
25824 C6D3 ADD A,211 A=211, 212, 213 or 214
25826 67 LD H,A HL points to a table of random locations
25827 1E01 LD E,1
25829 1A LD A,(DE) A=character's x-coordinate
25830 BE CP (HL) Is character already at this x-coordinate
25831 28F2 JR Z,25819 Jump back to get another if so
25833 1E05 LD E,5 Copy the location to go to into bytes 5 and 6
of the character's buffer
25835 EDA0 LDI
25837 EDA0 LDI
25839 EB EX DE,HL
25840 C36964 JP 25705 Exit via the Go to... routine

Byte 36 of each character's buffer is 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