Prev: 97FF Up: Map Next: 99C6
9918: Turn: Step The Script Pointer
Stores a script pointer on the special-object record. Bit 4 of the script byte skips two bytes first.
Turn_StepTheScriptPointer 9918 ADD HL,DE Step HL on, and jump to Turn_StepTheScriptPointer_StoreThePointer if bit 4 of this script byte is clear.
9919 BIT 4,(IX+$00)
991D JR Z,Turn_StepTheScriptPointer_StoreThePointer
991F INC HL Skip two bytes of the pointer.
9920 INC HL
Turn_StepTheScriptPointer_StoreThePointer 9921 LD (IY+$02),L Store the low byte of the script pointer on the special-object record.
9924 LD (IY+$03),H Store the high byte of the script pointer on the special-object record.
9927 RET Return.
This entry point is used by the routine at Turn_GateTheMessage.
Turn_StepTheScriptPointer_RunTheScriptEntry 9928 CALL Turn_StepTheScriptPointer Call Turn_StepTheScriptPointer to step the script pointer past this entry and store it on the special-object record.
992B BIT 0,(IX+$00) Jump to Turn_StepTheScriptPointer_ReadTheHandlerAddress if bit 0 of this script byte is set.
992F JR NZ,Turn_StepTheScriptPointer_ReadTheHandlerAddress
9931 LD A,(IX+$01) Read the action id from this script.
9934 LD ($B6E7),A Update *CurrentAction.
9937 LD A,(IX+$02) Read the object id from this script.
993A LD ($B6E8),A Update *CurrentObject.
993D LD A,(IX+$03) Read the second object id from this script.
9940 LD ($B6E9),A Update *B6E9.
9943 CALL Turn_ApplyTheSavedMatch Call Turn_ApplyTheSavedMatch to build the action sentence from the saved match.
9946 JR Z,Turn_StepTheScriptPointer_CountAnotherTry Jump to Turn_StepTheScriptPointer_CountAnotherTry if Turn_ApplyTheSavedMatch returned zero.
9948 JR Turn_StepTheScriptPointer_TestAndClear Jump to Turn_StepTheScriptPointer_TestAndClear to skip updating the message gate.
Turn_StepTheScriptPointer_ReadTheHandlerAddress 994A LD L,(IX+$01) Read the low byte of the handler address.
994D LD H,(IX+$02) Read the high byte of the handler address.
9950 SUB A Clear A so the message gate and the message-suppressed flag are both cleared.
9951 LD ($B6FA),A Clear the message gate so the handler may speak.
9954 LD ($B6FB),A Clear the message-suppressed flag before the handler runs.
Run the handler for this action.
9957 CALL TriggerAction Call TriggerAction to call the handler stored for this action.
Test the message-suppressed flag.
995A LD A,($B6FB) Jump to Turn_StepTheScriptPointer_CountAnotherTry unless the message-suppressed flag is 01.
995D CP $01
995F JR NZ,Turn_StepTheScriptPointer_CountAnotherTry
9961 LD ($B6FA),A Update *B6FA.
Run the handler for this action.
9964 CALL TriggerAction Call TriggerAction to call the handler stored for this action.
Turn_StepTheScriptPointer_TestAndClear 9967 BIT 5,(IX+$00) Jump back to Turn_GateTheMessage_StepThePointerOnBySevenBytes if bit 5 of this script byte is clear.
996B JP Z,Turn_GateTheMessage_StepThePointerOnBySevenBytes
996E LD (IX+$00),$00 Clear this script byte.
9972 JR Turn_GateTheMessage_StepThePointerOnBySevenBytes Jump back to Turn_GateTheMessage_StepThePointerOnBySevenBytes to clear *980B.
This entry point is used by the routine at Turn_GateTheMessage.
Turn_StepTheScriptPointer_StepTwoBytes 9974 LD DE,$0002 Step the script pointer by 02 bytes.
9977 CALL Turn_StepTheScriptPointer Call Turn_StepTheScriptPointer to step the script pointer past this entry and store it on the special-object record.
997A LD A,(IX+$01) Read the next byte of this script.
997D CP $FF Jump to Turn_StepTheScriptPointer_FollowThePointer if that script byte is FF.
997F JR Z,Turn_StepTheScriptPointer_FollowThePointer
9981 LD ($B6E7),A Update *CurrentAction.
Update the current object.
9984 LD A,$FF Write FF to *CurrentObject and *B6E9.
9986 LD ($B6E8),A
9989 LD ($B6E9),A
998C CALL Turn_ApplyTheSavedMatch Call Turn_ApplyTheSavedMatch to build the action sentence from the saved match.
998F JR Z,Turn_StepTheScriptPointer_CountAnotherTry Jump to Turn_StepTheScriptPointer_CountAnotherTry if Turn_ApplyTheSavedMatch returned zero.
9991 JP Turn_GateTheMessage_StepThePointerOnBySevenBytes Jump back to Turn_GateTheMessage_StepThePointerOnBySevenBytes to clear *980B.
Turn_StepTheScriptPointer_FollowThePointer 9994 BIT 4,(IX+$00) Jump back to Turn_GateTheMessage_StepThePointerOnBySevenBytes if bit 4 of this script byte is clear.
9998 JP Z,Turn_GateTheMessage_StepThePointerOnBySevenBytes
999B LD L,(IX+$02) Read the low byte of the pointer in this script.
999E LD H,(IX+$03) Read the high byte of the pointer in this script.
99A1 LD (IY+$02),L Store the low byte of that pointer on the special-object record.
99A4 LD (IY+$03),H Store the high byte of that pointer on the special-object record.
99A7 JP Turn_GateTheMessage_StepThePointerOnBySevenBytes Jump back to Turn_GateTheMessage_StepThePointerOnBySevenBytes to clear *980B.
Turn_StepTheScriptPointer_CountAnotherTry 99AA LD HL,$980B Point HL at 980B.
99AD INC (HL) Count one more try.
99AE BIT 4,(IX+$00) Jump back to Turn_GateTheMessage_ReadTheScriptPointer if bit 4 of this script byte is clear.
99B2 JP Z,Turn_GateTheMessage_ReadTheScriptPointer
99B5 ADD IX,DE Step the script pointer on by DE.
99B7 LD H,(IX+$01) Read the high byte of the word at this script byte.
99BA LD L,(IX+$00) Read this script byte into L.
99BD LD (IY+$02),L Store the low byte of that word on the special-object record.
99C0 LD (IY+$03),H Store the high byte of that word on the special-object record.
99C3 JP Turn_GateTheMessage_TestTheTryCount Branch Turn_GateTheMessage_TestTheTryCount on this test.
Prev: 97FF Up: Map Next: 99C6