Prev: 47966 Up: Map Next: 48133
48096: Advance HL to next script instruction and execute
Input
IX Address of complex state data for an entity
Output
HL Current position in script data
48096 INC HL Advance script data pointer by two bytes
48097 INC HL
48098 INC HL Advance script data pointer by one byte
48099 LD A,(HL) Load A with byte at this location
48100 DEC HL Move HL back one byte
48101 OR A If byte loaded into A was zero (i.e. a script instruction) then skip ahead to 48117
48102 JR Z,48117
HL pointing to a graphic layout data address, rather than a script instruction
48104 LD (34277),HL Store current position in script at 34277
48107 LD A,(HL) Load word at location HL into graphic layout address in current entity's complex state data entry (IX)
48108 LD (IX+2),A
48111 INC HL
48112 LD A,(HL)
48113 LD (IX+3),A
48116 RET Return
HL pointing to a script instruction
48117 LD A,(HL) Load A with script "instruction"
48118 PUSH HL Store HL (pointer to current position in script data)
48119 LD HL,47966 Point HL at table of script routine start addresses
48122 ADD A,A Load BC with double index of script instruction and add as offset in HL to point to start address of required script routine
48123 LD C,A
48124 LD B,0
48126 ADD HL,BC
48127 LD C,(HL) Load BC with address at this location
48128 INC HL
48129 LD B,(HL)
48130 POP HL Restore HL (pointer to current position in script data)
48131 PUSH BC Push address in BC onto stack and "return" to this address
48132 RET
Prev: 47966 Up: Map Next: 48133