Prev: CC37 Up: Map Next: CEDE
CC78: Script Interpreter
Used by the routine at GameEntryPoint.
ScriptInterpreter CC78 CALL $CC5A Call CC5A.
CC7B LD IY,($9FDB) IY=9FDB.
CC7F CALL $D008 Call D008.
ScriptInterpreter_0 CC82 LD L,(IY+$01) L=*IY+01.
CC85 LD H,(IY+$02) H=*IY+02.
CC88 XOR A Write 00 to *B934.
CC89 LD ($B934),A
CC8C LD A,($CC0B) Jump to ScriptInterpreter_12 if *CC0B is equal to 0A.
CC8F CP $0A
CC91 JP Z,ScriptInterpreter_12
ScriptInterpreter_1 CC94 LD A,(HL) Jump to ScriptInterpreter_2 if *HL is not equal to A.
CC95 AND A
CC96 JR NZ,ScriptInterpreter_2
CC98 INC HL Increment HL by one.
CC99 JR ScriptInterpreter_1 Jump to ScriptInterpreter_1.
ScriptInterpreter_2 CC9B PUSH HL IX=HL (using the stack).
CC9C POP IX
CC9E LD ($9FD9),HL Write HL to *9FD9.
CCA1 AND %00001111 Keep only bits 0-3.
CCA3 CP $0A Jump to ScriptInterpreter_4 if A is greater than or equal to 0A.
CCA5 JR NC,ScriptInterpreter_4
CCA7 LD A,($CC0D) Jump to ScriptInterpreter_3 if *CC0D is not equal to 01.
CCAA CP $01
CCAC JR NZ,ScriptInterpreter_3
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,ScriptInterpreter_13 Jump to ScriptInterpreter_13 if A is less than 01.
CCB9 JR Z,ScriptInterpreter_3 Jump to ScriptInterpreter_3 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.
ScriptInterpreter_3 CCC7 LD A,(HL) A=*HL.
CCC8 AND %00001111 Keep only bits 0-3.
CCCA CP $07 Jump to ScriptInterpreter_18 if A is equal to 07.
CCCC JP Z,ScriptInterpreter_18
CCCF CP $06 Jump to ScriptInterpreter_14 if A is equal to 06.
CCD1 JP Z,ScriptInterpreter_14
CCD4 CP $05 Jump to ScriptInterpreter_15 if A is equal to 05.
CCD6 JP Z,ScriptInterpreter_15
CCD9 CP $04 Jump to ScriptInterpreter_16 if A is equal to 04.
CCDB JP Z,ScriptInterpreter_16
CCDE CP $01 Jump to ScriptInterpreter_20 if A is equal to 01.
CCE0 JP Z,ScriptInterpreter_20
CCE3 CP $03 Jump to ScriptInterpreter_19 if A is equal to 03.
CCE5 JP Z,ScriptInterpreter_19
CCE8 CP $08 Jump to ScriptInterpreter_8 if A is equal to 08.
CCEA JR Z,ScriptInterpreter_8
CCEC CP $09 Jump to ScriptInterpreter_9 if A is equal to 09.
CCEE JR Z,ScriptInterpreter_9
CCF0 JP ScriptInterpreter_17 Jump to ScriptInterpreter_17.
ScriptInterpreter_4 CCF3 CP $0E Jump to ScriptInterpreter_5 if A is not equal to 0E.
CCF5 JR NZ,ScriptInterpreter_5
CCF7 LD A,(IX+$01) Write *IX+01 to *IY+01.
CCFA LD (IY+$01),A
CCFD LD A,(IX+$02) Write *IX+02 to *IY+02.
CD00 LD (IY+$02),A
CD03 JP ScriptInterpreter_0 Jump to ScriptInterpreter_0.
ScriptInterpreter_5 CD06 CP $0C Jump to ScriptInterpreter_6 if A is equal to 0C.
ScriptInterpreter_6 CD08 JR Z,ScriptInterpreter_6
CD0A CP $0B Jump to ScriptInterpreter_7 if A is not equal to 0B.
CD0C JR NZ,ScriptInterpreter_7
CD0E CALL $CFCF Call CFCF.
CD11 CP $02 Return if A is equal to 02.
CD13 RET Z
CD14 JP ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_7 CD17 CP $0A Jump to ScriptInterpreter_11 if A is not equal to 0A.
CD19 JR NZ,ScriptInterpreter_11
CD1B CALL $CFCF Call CFCF.
CD1E CP $02 Return if A is equal to 02.
CD20 RET Z
CD21 JP ScriptInterpreter_25 Jump to ScriptInterpreter_25.
ScriptInterpreter_8 CD24 LD A,(IX+$01) A=*IX+01.
CD27 PUSH AF Stash AF on the stack.
CD28 LD A,$02 A=02.
CD2A CALL $A11C Call A11C.
CD2D LD HL,($9FE7) HL=*9FE7.
CD30 LD ($9FE7),IX Write IX to *9FE7.
CD34 LD (IX-$02),L Write L to *IX-02.
CD37 LD (IX-$01),H Write H to *IX-01.
CD3A LD A,($A036) Write *A036 to *IX+00.
CD3D LD (IX+$00),A
CD40 POP AF Restore AF from the stack.
CD41 LD (IX+$01),A Write A to *IX+01.
CD44 JP ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_9 CD47 LD B,(IX+$01) B=*IX+01.
CD4A LD IX,$9FE9 IX=9FE9.
ScriptInterpreter_10 CD4E CALL $A0F7 Call A0F7.
CD51 JP Z,ScriptInterpreter_25 Jump to ScriptInterpreter_25 if A is equal to 02.
CD54 LD A,($A036) Jump to ScriptInterpreter_10 if *A036 is not equal to *IX+01.
CD57 CP (IX+$01)
CD5A JR NZ,ScriptInterpreter_10
CD5C LD A,B Jump to ScriptInterpreter_10 if B is not equal to *IX+00.
CD5D CP (IX+$00)
CD60 JR NZ,ScriptInterpreter_10
CD62 PUSH IY Stash IY on the stack.
CD64 PUSH IX DE=IX (using the stack).
CD66 POP DE
CD67 LD IY,$9FE7 IY=9FE7.
CD6B CALL $A104 Call A104.
CD6E LD L,(IX-$02) L=*IX-02.
CD71 LD H,(IX-$01) H=*IX-01.
CD74 LD (IY-$02),L Write L to *IY-02.
CD77 LD (IY-$01),H Write H to *IY-01.
CD7A CALL $A1C7 Call A1C7.
CD7D POP IY Restore IY from the stack.
CD7F JP ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_11 CD82 LD HL,$0001 Write 0001 to *A01F.
CD85 LD ($A01F),HL
CD88 JP ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_12 CD8B LD HL,$0001 Write 0001 to *A01F.
CD8E LD ($A01F),HL
ScriptInterpreter_13 CD91 CALL $D026 Call D026.
CD94 RET Return.
ScriptInterpreter_14 CD95 LD L,(IX+$01) L=*IX+01.
CD98 LD H,(IX+$02) H=*IX+02.
CD9B CALL $A59F Call A59F.
CD9E JP ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_15 CDA1 LD L,(IX+$02) L=*IX+02.
CDA4 LD H,(IX+$03) H=*IX+03.
CDA7 PUSH HL Stash HL on the stack.
CDA8 LD A,(IX+$01) A=*IX+01.
CDAB CALL $CEDE Call CEDE.
CDAE LD ($A034),A Write A to *A034.
CDB1 LD A,$07 Write 07 to *A00F.
CDB3 LD ($A00F),A
CDB6 LD HL,$6830 HL=6830.
CDB9 CALL $A59F Call A59F.
CDBC JP ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_16 CDBF LD A,$2E Write 2E to *A033.
CDC1 LD ($A033),A
CDC4 LD A,(IX+$01) A=*IX+01.
CDC7 CALL $CEDE Call CEDE.
CDCA LD ($A034),A Write A to *A034.
CDCD LD A,(IX+$02) A=*IX+02.
CDD0 LD ($A35D),A Write A to *A35D.
CDD3 LD A,(IX+$03) A=*IX+03.
CDD6 CALL $CEDE Call CEDE.
CDD9 LD ($A35E),A Write A to *A35E.
CDDC LD A,(IX+$04) A=*IX+04.
CDDF CALL $CEDE Call CEDE.
CDE2 LD ($A35F),A Write A to *A35F.
CDE5 LD A,$08 A=08.
CDE7 CALL $A11C Call A11C.
CDEA LD A,($A034) A=*A034.
CDED LD (IX+$00),A Write A to *IX+00.
CDF0 LD (IX+$01),$FF Write FF to *IX+01.
CDF4 LD A,($A35D) A=*A35D.
CDF7 LD (IX+$02),A Write A to *IX+02.
CDFA LD HL,($A35E) HL=*A35E.
CDFD LD (IX+$03),L Write L to *IX+03.
CE00 LD (IX+$04),H Write H to *IX+04.
CE03 LD HL,($9FEE) HL=*9FEE.
CE06 LD ($9FEE),IX Write IX to *9FEE.
CE0A LD (IX-$02),L Write L to *IX+FE.
CE0D LD (IX-$01),H Write H to *IX+FF.
CE10 LD HL,$682A HL=682A.
CE13 CALL $A59F Call A59F.
CE16 JR ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_17 CE18 LD A,(IX+$01) A=*IX+01.
CE1B CALL $CEDE Call CEDE.
CE1E LD ($A033),A Write A to *A033.
CE21 LD A,(IX+$02) A=*IX+02.
CE24 CALL $CEDE Call CEDE.
CE27 LD ($A034),A Write A to *A034.
CE2A LD A,(IX+$03) A=*IX+03.
CE2D CALL $CEDE Call CEDE.
CE30 LD ($A035),A Write A to *A035.
CE33 CALL $C4D1 Call C4D1.
CE36 RET C Return if A is less than 08.
CE37 JR Z,ScriptInterpreter_25 Jump to ScriptInterpreter_25 if A is equal to 08.
CE39 JR ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_18 CE3B LD A,(IX+$03) A=*IX+03.
CE3E CALL $CEDE Call CEDE.
CE41 LD ($A034),A Write A to *A034.
CE44 LD A,(IX+$04) A=*IX+04.
CE47 CALL $CEDE Call CEDE.
CE4A LD ($A035),A Write A to *A035.
CE4D JR ShowRoomDescription Jump to ShowRoomDescription.
ScriptInterpreter_19 CE4F LD A,$FF Write FF to;
CE51 LD ($A034),A
CE54 LD ($A035),A
Set the room description marker.
ShowRoomDescription CE57 LD A,$FF Write FF to *A033.
CE59 LD ($A033),A
CE5C LD L,(IX+$01) Fetch the room address from *IX+01/ *IX+02 and store it in HL.
CE5F LD H,(IX+$02)
CE62 CALL $C591 Call C591.
CE65 RET C Return if the room description can't be displayed.
CE66 JR Z,ScriptInterpreter_25 Jump to ScriptInterpreter_25 if A is equal to FF.
CE68 JR ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_20 CE6A LD A,(IX+$01) A=*IX+01.
CE6D CALL $CEDE Call CEDE.
CE70 LD ($A033),A Write A to *A033.
CE73 LD A,$FF Write FF to;
CE75 LD ($A034),A
CE78 LD ($A035),A
CE7B CALL $C4D1 Call C4D1.
CE7E RET C Return if A is less than FF.
CE7F JR Z,ScriptInterpreter_25 Jump to ScriptInterpreter_25 if A is equal to FF.
CE81 JR ScriptInterpreter_22 Jump to ScriptInterpreter_22.
ScriptInterpreter_21 CE83 LD IY,($9FDB) IY=*9FDB.
CE87 LD HL,($9FD9) HL=*9FD9.
CE8A PUSH HL IX=HL (using the stack).
CE8B POP IX
CE8D LD A,(HL) A=*HL.
CE8E RET Return.
ScriptInterpreter_22 CE8F CALL ScriptInterpreter_21 Call ScriptInterpreter_21.
CE92 CALL $CF03 Call CF03.
CE95 BIT 7,(IX+$00) Jump to ScriptInterpreter_23 if bit 7 of *IX+00 is not set.
CE99 JR Z,ScriptInterpreter_23
CE9B LD E,(HL) E=*HL.
CE9C INC HL Increment HL by one.
CE9D LD D,(HL) D=*HL.
CE9E EX DE,HL Exchange the DE and HL registers.
CE9F JR ScriptInterpreter_24 Jump to ScriptInterpreter_24.
ScriptInterpreter_23 CEA1 BIT 4,(IX+$00) Call CF40 if bit 4 of *IX+00 is set.
CEA5 CALL NZ,$CF40
ScriptInterpreter_24 CEA8 BIT 5,(IX+$00) Call CF43 if bit 5 of *IX+00 is set.
CEAC CALL NZ,$CF43
CEAF LD (IY+$01),L Write L to *IY+01.
CEB2 LD (IY+$02),H Write H to *IY+02.
CEB5 JP ScriptInterpreter_13 Jump to ScriptInterpreter_13.
ScriptInterpreter_25 CEB8 LD HL,$CC0B Increment *CC0B by one.
CEBB INC (HL)
CEBC CALL ScriptInterpreter_21 Call ScriptInterpreter_21.
CEBF CALL $CEFE Call CEFE.
CEC2 BIT 4,(IX+$00) Jump to ScriptInterpreter_26 if bit 4 of *IX+00 is not set.
CEC6 JR Z,ScriptInterpreter_26
CEC8 LD E,(HL) E=*HL.
CEC9 INC HL Increment HL by one.
CECA LD D,(HL) D=*HL.
CECB EX DE,HL Exchange the DE and HL registers.
ScriptInterpreter_26 CECC LD (IY+$01),L Write L to *IY+01.
CECF LD (IY+$02),H Write H to *IY+02.
CED2 PUSH IX DE=IX (using the stack).
CED4 POP DE
CED5 AND A HL-=DE (with carry).
CED6 SBC HL,DE
CED8 JP Z,ScriptInterpreter_12 Jump to ScriptInterpreter_12 if HL is equal to A.
CEDB JP ScriptInterpreter_0 Jump to ScriptInterpreter_0.
Prev: CC37 Up: Map Next: CEDE