Prev: 46639 Up: Map Next: 46806
46643: Select Jump If Not Zero
Used by the routines at UnlinkNextDisplayRecord and ProcessDisplayEntry.
Plants the JR NZ opcode for the two tests at 46661 and 46678, then reads the character record.
SelectJumpIfNotZero 46643 LD A,32 Use the JR NZ opcode (32).
This entry point is used by the routine at SelectJumpIfZero.
SelectJumpIfNotZero_WriteOpcode 46645 LD (46665),A Write the opcode into the jumps at 46665 and 46680.
46648 LD (46680),A
46651 LD IX,(45454) Read the pointer at 45452+2.
46655 LD L,(IX+4) Read the handler address from bytes 4-5 of the record.
46658 LD H,(IX+5)
46661 BIT 7,(IX+7) Jump to SelectJumpIfNotZero_LocationActionFlags if a marker on the character record is set. The opcode at 46665 is modified by SelectJumpIfNotZero_WriteOpcode.
46665 JR NZ,SelectJumpIfNotZero_LocationActionFlags
46667 LD HL,0 Clear the pointer.
SelectJumpIfNotZero_LocationActionFlags 46670 EX (SP),HL Swap HL with the return address.
46671 PUSH HL Save that address, and read the location and the action flags.
46672 LD L,(IX+2)
46675 LD H,(IX+3)
46678 BIT 5,H Jump ahead to SelectJumpIfNotZero_ReturnWithPointers if bit 5 is present. The opcode at 46680 is modified by SelectJumpIfNotZero_WriteOpcode.
46680 JR NZ,SelectJumpIfNotZero_ReturnWithPointers
46682 LD HL,0 Clear the pointer.
SelectJumpIfNotZero_ReturnWithPointers 46685 EX (SP),HL Leave the location pointer (or 0000 when bit 5 is clear) on the stack in place of the address saved there.
46686 JP (HL) Return to the caller (its address is now in HL), leaving the location pointer and the handler address on the stack.
46687 LD A,(40975) Jump to SelectJumpIfNotZero_MessagePrintMessage if the display mode is 5.
46690 CP 5
46692 JR Z,SelectJumpIfNotZero_MessagePrintMessage
46694 CP 6 Jump to SelectJumpIfNotZero_MessagePrintMessage when the display mode is 6.
46696 JR Z,SelectJumpIfNotZero_MessagePrintMessage
46698 LD A,(45427) Jump ahead to SelectJumpIfNotZero_TestDisplayFlag if bit 7 of display mode flag at DisplayModeFlag is clear.
46701 BIT 7,A
46703 JR Z,SelectJumpIfNotZero_TestDisplayFlag
SelectJumpIfNotZero_MessagePrintMessage 46705 LD HL,26709 Take the message, then call PrintTextAndHandleControlCharacters to print the message.
46708 CALL PrintTextAndHandleControlCharacters
46711 RET Return.
Test the display flag, and use the display data pointer when that flag is set.
SelectJumpIfNotZero_TestDisplayFlag 46712 LD HL,45421 Test bit 0 of the display flag and point HL at the display data pointer.
46715 BIT 0,(HL)
46717 LD HL,45426
Build this display entry when the flag is clear.
46720 CALL NZ,ProcessDisplayEntry Call ProcessDisplayEntry if bit 0 of this byte is set.
46723 CALL SelectJumpIfNotZero Call SelectJumpIfNotZero to plant the JR NZ opcode and test the character record.
46726 LD A,(45421) Read the display flag and take the display data pointer.
46729 LD HL,45426
SelectJumpIfNotZero_BitDisplayFlag 46732 LD DE,(45446) Jump ahead to SelectJumpIfNotZero_ClearStackedPointers if bit 0 of display flag at DisplayFlag is clear.
46736 PUSH DE
46737 BIT 0,A
46739 JR Z,SelectJumpIfNotZero_ClearStackedPointers
46741 CALL RestoreSavedCharacterRecord Call RestoreSavedCharacterRecord to restore the saved character record, then jump to SelectJumpIfNotZero_MessagePrintMessageAgain with the message at 1459.
46744 LD HL,1459
46747 JR SelectJumpIfNotZero_MessagePrintMessageAgain
Clear the stacked pointers, then print the message at 1499.
SelectJumpIfNotZero_ClearStackedPointers 46749 LD HL,0 Push three zero words for the message.
46752 PUSH HL
46753 PUSH HL
46754 PUSH HL
46755 LD HL,1499 Take the message at 1499.
SelectJumpIfNotZero_MessagePrintMessageAgain 46758 PUSH HL Take the message, then call PrintTextAndHandleControlCharacters to print the message.
46759 LD HL,26772
46762 CALL PrintTextAndHandleControlCharacters
46765 RET Return.
46766 LD A,(40976) Jump to SelectJumpIfNotZero_MessagePrintMessage if the display mode is 5.
46769 CP 5
46771 JR Z,SelectJumpIfNotZero_MessagePrintMessage
46773 CP 6 Jump to SelectJumpIfNotZero_MessagePrintMessage when the display mode is 6.
46775 JR Z,SelectJumpIfNotZero_MessagePrintMessage
46777 LD A,(45433) Jump back to SelectJumpIfNotZero_MessagePrintMessage while bit 7 of display mode flag (45433) is present.
46780 BIT 7,A
46782 JR NZ,SelectJumpIfNotZero_MessagePrintMessage
46784 LD HL,45422 Take the display flag and take the display mode flag.
46787 BIT 0,(HL)
46789 LD HL,45432
Build the alternate display entry.
46792 CALL NZ,ProcessDisplayEntryAlternate Call ProcessDisplayEntryAlternate if bit 0 of this byte is set.
46795 CALL SelectJumpIfZero Call SelectJumpIfZero to plant the JR Z opcode.
46798 LD A,(45422) Jump back to SelectJumpIfNotZero_BitDisplayFlag to check flag and set display parameter.
46801 LD HL,45432
46804 JR SelectJumpIfNotZero_BitDisplayFlag
View the equivalent code in;
Prev: 46639 Up: Map Next: 46806