Prev: CC37 Up: Map Next: CCC7
CC78: Script Interpreter
Used by the routine at GameEntryPoint.
Input
A Character ID
ScriptInterpreter CC78 CALL $CC5A Call CC5A.
CC7B LD IY,($9FDB) IY=CurrentCharacter_TimetablePointer.
CC7F CALL $D008 Call D008.
This entry point is used by the routines at CCF3 and CEB8.
ScriptInterpreter_0 CC82 LD L,(IY+$01) Get the characters script position.
CC85 LD H,(IY+$02)
CC88 XOR A Write 00 to *B934.
CC89 LD ($B934),A
CC8C LD A,($CC0B) Jump to TerminateCharacterScript if *CC0B is equal to 0A.
CC8F CP $0A
CC91 JP Z,TerminateCharacterScript
FindNextCommand CC94 LD A,(HL) Jump to ProcessScriptCommand if *HL is not equal to A.
CC95 AND A
CC96 JR NZ,ProcessScriptCommand
CC98 INC HL Increment HL by one.
CC99 JR FindNextCommand Jump to FindNextCommand.
Process the current script command.
ProcessScriptCommand CC9B PUSH HL IX=HL (using the stack).
CC9C POP IX
CC9E LD ($9FD9),HL Write HL to *CurrentCharacter_CommandPosition.
CCA1 AND %00001111 Keep only bits 0-3.
CCA3 CP $0A Jump to CCF3 if A is greater than or equal to 0A.
CCA5 JR NC,$CCF3
CCA7 LD A,($CC0D) Jump to ExecuteCharacterCommand if *CC0D is not equal to 01.
CCAA CP $01
CCAC JR NZ,ExecuteCharacterCommand
CCAE SUB A A-=A.
CCAF LD ($CC0D),A Write A to *CC0D.
CCB2 LD A,(HL) A=*HL.
CCB3 CALL $B936 Call B936.
CCB6 JP C,TerminateCharacterScript_0 Jump to TerminateCharacterScript_0 if A is less than 01.
CCB9 JR Z,ExecuteCharacterCommand Jump to ExecuteCharacterCommand if A is equal to 01.
CCBB CALL $C4D1 Call C4D1.
CCBE RET NC Return if A is greater than 01.
CCBF CALL $CFB6 Call CFB6.
CCC2 LD (IX+$05),$02 Write 02 to *IX+05.
CCC6 RET Return.
Prev: CC37 Up: Map Next: CCC7