Prev: E8E8 Up: Map Next: E943
E909: Graphic Layout Routine: (F7) Timer-Based Random Graphic Index
Choose a graphic-set index from a timer-based random table.
GraphicLayoutRoutine_TimerRandomGraphicIndex E909 LD B,$00 Load B with 00.
E90B LD A,(IX+$00) Fetch the current entity's type into A.
E90E INC A Step the nested-layout counter on by one.
E90F LD (IX+$00),A Set the current entity's entity type.
E912 CP (IX+$01) Compare A with this entity's flags byte 1.
E915 INC IX Advance IX past the two-byte graphic-layout operand.
E917 INC IX
E919 LD A,(IX+$00) Fetch the current entity's type into A.
E91C JR Z,GraphicLayoutRoutine_F7Continue Jump to GraphicLayoutRoutine_F7Continue to continue if the comparison matched.
E91E INC A Step the nested-layout counter on by one.
E91F LD C,A Keep the updated index in C.
E920 ADD IX,BC IX+=BC.
E922 JP Process_GraphicLayoutData Jump to Process_GraphicLayoutData to process graphic layout data.
Reset the F7 timer byte, pick a random graphic index, and continue layout at Process_GraphicLayoutData.
GraphicLayoutRoutine_F7Continue E925 LD (IX-$02),$00 Write 00 to *(IX-02).
E929 PUSH IX Stash IX on the stack.
E92B CALL PseudoRandom Call PseudoRandom to pick a pseudo-random value.
E92E INC A Step the nested-layout counter on by one.
E92F LD C,A Keep the updated index in C.
E930 ADD IX,BC IX+=BC.
E932 LD A,(IX+$00) Fetch the current entity's type into A.
E935 POP IX Restore IX from the stack.
E937 LD C,(IX+$00) Load C with the current entity's entity type.
E93A INC C Advance the saved count in C by one.
E93B ADD IX,BC IX+=BC.
E93D LD (IX+$00),A Set the current entity's entity type.
E940 JP Process_GraphicLayoutData Jump to Process_GraphicLayoutData to process graphic layout data.
View the equivalent code in;
Prev: E8E8 Up: Map Next: E943