Prev: 9A80 Up: Map Next: 9AA9
9A8B: 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 (00)
IX Address of next graphic layout data instruction to process
9A8B PUSH IX Stash current position in graphic layout data on the stack.
9A8D LD A,(IX+$00) Load A and E with number of possible values.
9A90 LD E,A
9A91 CALL $955A Load BC with a random number, m, between 1 and number of values.
9A94 INC A
9A95 LD C,A
9A96 LD B,$00
9A98 ADD IX,BC Load A with then m-th value in the list.
9A9A LD A,(IX+$00)
9A9D POP IX Restore previous position in graphic layout data.
9A9F LD C,E Advance IX to the start of the next instruction.
9AA0 INC C
9AA1 ADD IX,BC
9AA3 LD (IX+$00),A Set next instruction to random value chosen from list.
9AA6 JP $989E Read / process data at address in IX.
Prev: 9A80 Up: Map Next: 9AA9