Prev: 46306 Up: Map Next: 46347
46317: Graphic layout routine: (236) Set graphic index in next instruction to value randomly selected from list
Read current byte (n, number of values), generate random number m (1 to n inclusive) and copy the m-th byte in following list into position after end of list bytes (i.e. the graphic index field of the next graphic layout data entry), then advance current position to this location.
Used by the routine at 46218.
Input
IX Address of first parameter in current graphic layout data instruction
Output
B Do-not-recalculate-display-buffer-address flag (0)
IX Address of next graphic layout data instruction to process
46317 PUSH IX Store current position in graphic layout data
46319 LD A,(IX+0) Load A and E with number of possible values
46322 LD E,A
46323 CALL 54222 Load BC with a random number, m, between 1 and number of values
46326 INC A
46327 LD C,A
46328 LD B,0
46330 ADD IX,BC Load A with then m-th value in the list
46332 LD A,(IX+0)
46335 POP IX Restore previous position in graphic layout data
46337 LD C,E Advance IX to the start of the next instruction
46338 INC C
46339 ADD IX,BC
46341 LD (IX+0),A Set next instruction to random value chosen from list
46344 JP 46003 Read / process data at address in IX
Prev: 46306 Up: Map Next: 46347