Prev: 28615 Up: Map Next: 28635
28616: Randomly select a message number
Used by the routine at 28357. Returns with a randomly chosen message number (different from the last one used) in A. On entry, A holds 197 or 198 depending on the type of message required: 197 for a person or group of people, 198 for a verb.
Input
A 197 or 198
28616 LD C,A Point BC at the relevant last used message number (see 28613)
28617 LD B,111
28619 LD A,(BC) E=last used message number (8-15, 16-23)
28620 LD E,A
28621 AND 248 Discard bits 0-2
28623 LD D,A D=8 or 16
28624 CALL 61823 Get a random number in A
28627 AND 7 A=message number (8-15, 16-23)
28629 ADD A,D
28630 CP E Is this the same message number as last time?
28631 JR Z,28624 Jump back to try again if so
28633 LD (BC),A Store the randomly chosen message number for comparison next time
28634 RET
Prev: 28615 Up: Map Next: 28635