Prev: 52279 Up: Map Next: 52423
52344: Script Interpreter
Used by the routine at GameEntryPoint.
Input
A Character ID
ScriptInterpreter 52344 CALL 52314 Call 52314.
52347 LD IY,(40923) IY=CurrentCharacter_TimetablePointer.
52351 CALL 53256 Call 53256.
This entry point is used by the routines at 52467 and 52920.
ScriptInterpreter_0 52354 LD L,(IY+1) Get the characters script position.
52357 LD H,(IY+2)
52360 XOR A Write 0 to *47412.
52361 LD (47412),A
52364 LD A,(52235) Jump to TerminateCharacterScript if *52235 is equal to 10.
52367 CP 10
52369 JP Z,TerminateCharacterScript
FindNextCommand 52372 LD A,(HL) Jump to ProcessScriptCommand if *HL is not equal to A.
52373 AND A
52374 JR NZ,ProcessScriptCommand
52376 INC HL Increment HL by one.
52377 JR FindNextCommand Jump to FindNextCommand.
Process the current script command.
ProcessScriptCommand 52379 PUSH HL IX=HL (using the stack).
52380 POP IX
52382 LD (40921),HL Write HL to *CurrentCharacter_CommandPosition.
52385 AND %00001111 Keep only bits 0-3.
52387 CP 10 Jump to 52467 if A is greater than or equal to 10.
52389 JR NC,52467
52391 LD A,(52237) Jump to ExecuteCharacterCommand if *52237 is not equal to 1.
52394 CP 1
52396 JR NZ,ExecuteCharacterCommand
52398 SUB A A-=A.
52399 LD (52237),A Write A to *52237.
52402 LD A,(HL) A=*HL.
52403 CALL 47414 Call 47414.
52406 JP C,TerminateCharacterScript_0 Jump to TerminateCharacterScript_0 if A is less than 1.
52409 JR Z,ExecuteCharacterCommand Jump to ExecuteCharacterCommand if A is equal to 1.
52411 CALL 50385 Call 50385.
52414 RET NC Return if A is greater than 1.
52415 CALL 53174 Call 53174.
52418 LD (IX+5),2 Write 2 to *IX+5.
52422 RET Return.
Prev: 52279 Up: Map Next: 52423