Prev: 39552 Up: Map Next: 39593
39563: 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 Jump_GraphicLayoutRoutine.
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
39563 PUSH IX Stash current position in graphic layout data on the stack.
39565 LD A,(IX+0) Load A and E with number of possible values.
39568 LD E,A
39569 CALL 38234 Load BC with a random number, m, between 1 and number of values.
39572 INC A
39573 LD C,A
39574 LD B,0
39576 ADD IX,BC Load A with then m-th value in the list.
39578 LD A,(IX+0)
39581 POP IX Restore previous position in graphic layout data.
39583 LD C,E Advance IX to the start of the next instruction.
39584 INC C
39585 ADD IX,BC
39587 LD (IX+0),A Set next instruction to random value chosen from list.
39590 JP 39070 Read / process data at address in IX.
Prev: 39552 Up: Map Next: 39593