Prev: 9C2C Up: Map Next: 9CF3
9CCE: 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
AdvanceScriptInstruction 9CCE INC HL Advance script data pointer by two bytes.
9CCF INC HL
This entry point is used by the routines at 8A27, 9E51, 9E61, 9E6D, 9E7E, 9E8A, 9E9B, 9EA7, A449, A6A8, A82E, B571, B6AD, B709, B8CD, B934, BA10, C13D, C427, C98E, CF80, D004, D4BE, D6A8 and D6FF.
ScriptInstruction 9CD0 INC HL Advance script data pointer by one byte.
9CD1 LD A,(HL) Load A with the byte at this location.
9CD2 DEC HL Move HL back one byte.
9CD3 OR A If byte loaded into A was zero (i.e. a script instruction) then skip ahead to ExecuteScript.
9CD4 JR Z,ExecuteScript
HL pointing to a graphic layout data address, rather than a script instruction.
9CD6 LD ($6DC4),HL Store current position in script at CurrentScript.
9CD9 LD A,(HL) Load word at location HL into graphic layout address in current entity's complex state data entry (IX).
9CDA LD (IX+$02),A
9CDD INC HL
9CDE LD A,(HL)
9CDF LD (IX+$03),A
9CE2 RET Return.
HL pointing to a script instruction.
ExecuteScript 9CE3 LD A,(HL) Load A with script "instruction".
9CE4 PUSH HL Stash HL (pointer to current position in script data) on the stack.
9CE5 LD HL,$9C2C Point HL at TableScriptHandlers.
9CE8 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.
9CE9 LD C,A
9CEA LD B,$00
9CEC ADD HL,BC
9CED LD C,(HL) Load BC with address at this location.
9CEE INC HL
9CEF LD B,(HL)
9CF0 POP HL Restore HL (pointer to current position in script data) from the stack.
9CF1 PUSH BC Push address in BC onto stack and "return" to this address.
9CF2 RET
Prev: 9C2C Up: Map Next: 9CF3