Prev: 97F4 Up: Map Next: 9918
97FF: Turn: Gate The Message
Gates the message. The caller continues only when the message gate and the message-suppressed flag are both set.
Turn_GateTheMessage 97FF PUSH BC Read *B6FA.
9800 LD BC,($B6FA)
9804 LD A,C Jump to Turn_GateTheMessage_Return if the message gate and the message-suppressed flag are both set.
9805 AND B
9806 JR NZ,Turn_GateTheMessage_Return
9808 POP BC
Turn_GateTheMessage_Return 9809 POP BC Restore BC from the stack.
980A RET Return.
980B NOP Try count for this turn. Turn_GateTheMessage_ClearTheTryCount clears it, Turn_StepTheScriptPointer_CountAnotherTry adds one, and Turn_GateTheMessage_TestTheTryCount stops at 06.
980C NOP Workspace byte. Action_None_StoreTheDarkFlag writes whether the location is dark.
980D NOP Result of ObjectFirstLocation, written at 99EF and read at 9A4B.
This entry point is used by the routine at TurnAdvanceTheOtherCharacters.
Turn_GateTheMessage_0 980E CALL Action_None Call Action_None, the empty action, before the special objects are walked.
9811 LD IY,$CACB Point IY at the special-object records.
Turn_GateTheMessage_ClearTheTryCount 9815 XOR A Clear the try count.
9816 LD ($980B),A
9819 LD A,(IY+$00) Read the special-object id.
981C CP $FF Jump to Turn_GateTheMessage_ClearTheCharacterWhoseTurn at the end of the special-object records.
981E JP Z,Turn_GateTheMessage_ClearTheCharacterWhoseTurn
9821 CP $00 Jump to Turn_GateTheMessage_StepThePointerOnBySevenBytes if this special-object id is zero.
9823 JP Z,Turn_GateTheMessage_StepThePointerOnBySevenBytes
9826 LD ($B6EA),A Update *CurrentCharacter.
9829 CALL ObjectFirstLocation Call ObjectFirstLocation to get object first location.
982C LD ($B70C),IX Update *Pointer_CurrentCharacter.
9830 LD ($B6F6),A Update *B6F6.
9833 SUB A Clear the time-of-day flag at NightDay.
9834 LD ($B702),A Update *NightDay.
9837 LD A,(IY+$00) Read the special-object id.
983A PUSH IY Save IY and point it at $00 - "You".
983C LD IY,$C11B
9840 CALL Condition_SwapAndRetest Call Condition_SwapAndRetest to swap the objects and test visibility again.
9843 POP IY Jump to Turn_GateTheMessage_TestIfInside if Condition_SwapAndRetest did not find the object visible.
9845 JR Z,Turn_GateTheMessage_TestIfInside
Test the flag.
9847 LD A,($980C) Jump to Turn_GateTheMessage_TestIfInside if *980C is 02.
984A CP $02
984C JR Z,Turn_GateTheMessage_TestIfInside
984E LD A,$01 Write 01 (day) to *NightDay.
9850 LD ($B702),A
Test the flag.
9853 LD A,($980C) Jump to Turn_GateTheMessage_TestIfInside if *980C is not 01.
9856 CP $01
9858 JR NZ,Turn_GateTheMessage_TestIfInside
985A INC A Count on from the turn phase.
985B LD ($980C),A Store the result at 980C.
Say "you{5} hear a noise".
985E LD HL,$B027 Point HL at the message and call PrintMessage.
9861 CALL PrintMessage
9864 SUB A Clear the time-of-day flag at NightDay.
9865 LD ($B702),A Update *NightDay.
Turn_GateTheMessage_TestIfInside 9868 LD A,$FF Jump to ActionClimb if this object is inside another object.
986A CP (IX+$01)
986D JP NZ,ActionClimb
This entry point is used by the routine at ActionClimb.
Turn_GateTheMessage_1 9870 LD IX,($B70C) Read *Pointer_CurrentCharacter.
9874 CALL Inglish_KeepTheCharacterSlot Call Inglish_KeepTheCharacterSlot to keep the character slot.
9877 LD A,$00 Take zero, and jump to Turn_GateTheMessage_StoreTheSlotFlag unless Inglish_KeepTheCharacterSlot found this character's slot.
9879 JR NZ,Turn_GateTheMessage_StoreTheSlotFlag
987B INC A Count on from zero.
Turn_GateTheMessage_StoreTheSlotFlag 987C LD ($B6F4),A Store the slot flag at B6F4.
This entry point is used by the routine at Turn_StepTheScriptPointer.
Turn_GateTheMessage_ReadTheScriptPointer 987F LD L,(IY+$02) Read the low byte of the script pointer.
9882 LD H,(IY+$03) Read the high byte of the script pointer.
This entry point is used by the routine at Turn_StepTheScriptPointer.
Test the flag.
Turn_GateTheMessage_TestTheTryCount 9885 LD A,($980B) Jump to Turn_GateTheMessage_StepThePointerOnBySevenBytes if the try count is 06.
9888 CP $06
988A JR Z,Turn_GateTheMessage_StepThePointerOnBySevenBytes
988C LD A,(HL) Read the next script byte.
988D LD DE,$0004 The next field is 04 bytes on.
9890 PUSH HL Point IX at this script byte.
9891 POP IX
9893 AND $0F Jump to Turn_GateTheMessage_TakeThePointer if the low nibble of the script byte is not below 05.
9895 CP $05
9897 JR NC,Turn_GateTheMessage_TakeThePointer
Test the flag.
9899 LD A,($B6F4) Jump to Turn_GateTheMessage_TestTheEntryKind if *B6F4 is not 01.
989C CP $01
989E JR NZ,Turn_GateTheMessage_TestTheEntryKind
98A0 BIT 6,(HL) Jump to Turn_GateTheMessage_TestTheEntryKind if bit 6 of the script byte is set.
98A2 JR NZ,Turn_GateTheMessage_TestTheEntryKind
98A4 SUB A Clear the flag at B6F4.
98A5 LD ($B6F4),A Store the result at B6F4.
98A8 INC A Set A to 01 for Inglish_SaveTheClauseAndAct.
98A9 CALL Inglish_SaveTheClauseAndAct Call Inglish_SaveTheClauseAndAct to save the clause and act.
98AC JR Z,Turn_GateTheMessage_TestTheEntryKind Jump to Turn_GateTheMessage_TestTheEntryKind if Inglish_SaveTheClauseAndAct returned with the zero flag set.
Update the message gate.
98AE LD A,$01 Hold messages back: set the message gate and the message-suppressed flag.
98B0 LD ($B6FA),A
98B3 LD ($B6FB),A
98B6 LD HL,$9901 Point HL at Turn_GateTheMessage_StepThePointerOnBySevenBytes, where the message routine should return.
98B9 PUSH HL Jump to Turn_ApplyTheSavedMatch_TestTheNounPrintFlag to test the noun-print flag.
98BA PUSH IX
98BC JP Turn_ApplyTheSavedMatch_TestTheNounPrintFlag
Turn_GateTheMessage_TestTheEntryKind 98BF LD A,(HL) Jump to Turn_StepTheScriptPointer_StepTwoBytes if the low nibble of the script code is 04.
98C0 AND $0F
98C2 CP $04
98C4 JP Z,Turn_StepTheScriptPointer_StepTwoBytes
98C7 JR C,Turn_StepTheScriptPointer_RunTheScriptEntry Jump to Turn_StepTheScriptPointer_RunTheScriptEntry if the low nibble of the script code is below 04.
98C9 JR Turn_GateTheMessage_StepThePointerOnBySevenBytes Jump to Turn_GateTheMessage_StepThePointerOnBySevenBytes to step on to the next special object.
Turn_GateTheMessage_TakeThePointer 98CB CP $0E Jump to Turn_GateTheMessage_TakeTheCount if the low nibble of the script code is not 0E.
98CD JR NZ,Turn_GateTheMessage_TakeTheCount
98CF LD E,(IX+$01) Read the next byte of this script.
98D2 LD (IY+$02),E Store it as the low byte of the script pointer.
98D5 LD E,(IX+$02) Read the byte after that.
98D8 LD (IY+$03),E Store it as the high byte of the script pointer.
98DB JR Turn_GateTheMessage_ReadTheScriptPointer Jump back to Turn_GateTheMessage_ReadTheScriptPointer to read the script pointer.
Turn_GateTheMessage_TakeTheCount 98DD CP $0C Jump to Turn_GateTheMessage_PickAtRandom if the low nibble of the script code is not 0C.
98DF JR NZ,Turn_GateTheMessage_PickAtRandom
98E1 LD B,(IX+$01) Read the next script byte into B.
98E4 LD A,(IY+$00) Read the special-object id.
98E7 CALL Turn_UseASpecialObject Call Turn_UseASpecialObject to look the id up as a special object.
98EA JR Turn_GateTheMessage_ReadTheScriptPointer Jump back to Turn_GateTheMessage_ReadTheScriptPointer to read the script pointer.
Turn_GateTheMessage_PickAtRandom 98EC CP $0F Jump to Turn_GateTheMessage_TestForNoCode if this script code is not 0F.
98EE JR NZ,Turn_GateTheMessage_TestForNoCode
98F0 CALL Turn_PickAScriptEntry Call Turn_PickAScriptEntry to pick a random script entry.
98F3 JR Turn_GateTheMessage_ReadTheScriptPointer Jump back to Turn_GateTheMessage_ReadTheScriptPointer to read the script pointer.
Turn_GateTheMessage_TestForNoCode 98F5 CP $00 Jump to Turn_GateTheMessage_KeepTheSmaller if this script code is not zero.
98F7 JR NZ,Turn_GateTheMessage_KeepTheSmaller
98F9 ADD HL,DE Step the script pointer in HL on by 04 bytes.
98FA JR Turn_GateTheMessage_TestTheTryCount Jump back to Turn_GateTheMessage_TestTheTryCount to try the next script entry.
Turn_GateTheMessage_KeepTheSmaller 98FC SUB A Clear E before the locations are compared.
98FD LD E,A Clear E.
98FE CALL Turn_PickAScriptEntry_0 Call Turn_PickAScriptEntry_0 to keep the smaller of the location and the roll.
This entry point is used by the routines at Turn_StepTheScriptPointer and ActionClimb.
Turn_GateTheMessage_StepThePointerOnBySevenBytes 9901 LD DE,$0007 Step the pointer on by 07 bytes.
9904 ADD IY,DE
9906 JP Turn_GateTheMessage_ClearTheTryCount Jump back to Turn_GateTheMessage_ClearTheTryCount to try the next special object.
Turn_GateTheMessage_ClearTheCharacterWhoseTurn 9909 SUB A Clear the character whose turn it is.
990A LD ($B6EA),A Update *CurrentCharacter.
990D INC A Count on to 01 for the day flag.
990E LD ($B702),A Update *NightDay.
9911 LD HL,$C11B Point *Pointer_CurrentCharacter at "You".
9914 LD ($B70C),HL
9917 RET Return.
Prev: 97F4 Up: Map Next: 9918