Prev: CC37 Up: Map Next: CCC7
CC78: Script Interpreter
Used by the routine at GameEntryPoint.
Input
A Character ID
ScriptInterpreter CC78 CALL ProcessCharacterAction_1 Call ProcessCharacterAction_1.
CC7B LD IY,($9FDB) IY=CurrentCharacter_TimetablePointer.
CC7F CALL GetScriptPointerFromTimetable Call GetScriptPointerFromTimetable.
This entry point is used by the routines at HandleCommandType_0E_0C_0B_0A and ProcessScriptCommandWithCounter.
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 HandleCommandType_0E_0C_0B_0A if A is greater than or equal to 0A.
CCA5 JR NC,HandleCommandType_0E_0C_0B_0A
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 ProcessScriptDisplay Call ProcessScriptDisplay.
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 ProcessDisplayAction Call ProcessDisplayAction.
CCBE RET NC Return if A is greater than 01.
CCBF CALL FindCharacterScriptEntry Call FindCharacterScriptEntry.
CCC2 LD (IX+$05),$02 Write 02 to *IX+05.
CCC6 RET Return.
Prev: CC37 Up: Map Next: CCC7