Prev: B62F Up: Map Next: B6D6
B633: Select Jump If Not Zero
Used by the routines at UnlinkNextDisplayRecord and ProcessDisplayEntry.
Plants the JR NZ opcode for the two tests at B645 and B656, then reads the character record.
SelectJumpIfNotZero B633 LD A,$20 Use the JR NZ opcode (20).
This entry point is used by the routine at SelectJumpIfZero.
SelectJumpIfNotZero_WriteOpcode B635 LD ($B649),A Write the opcode into the jumps at B649 and B658.
B638 LD ($B658),A
B63B LD IX,($B18E) Read the pointer at B18C+02.
B63F LD L,(IX+$04) Read the handler address from bytes 04-05 of the record.
B642 LD H,(IX+$05)
B645 BIT 7,(IX+$07) Jump to SelectJumpIfNotZero_LocationActionFlags if a marker on the character record is set. The opcode at B649 is modified by SelectJumpIfNotZero_WriteOpcode.
B649 JR NZ,SelectJumpIfNotZero_LocationActionFlags
B64B LD HL,$0000 Clear the pointer.
SelectJumpIfNotZero_LocationActionFlags B64E EX (SP),HL Swap HL with the return address.
B64F PUSH HL Save that address, and read the location and the action flags.
B650 LD L,(IX+$02)
B653 LD H,(IX+$03)
B656 BIT 5,H Jump ahead to SelectJumpIfNotZero_ReturnWithPointers if bit 5 is present. The opcode at B658 is modified by SelectJumpIfNotZero_WriteOpcode.
B658 JR NZ,SelectJumpIfNotZero_ReturnWithPointers
B65A LD HL,$0000 Clear the pointer.
SelectJumpIfNotZero_ReturnWithPointers B65D EX (SP),HL Leave the location pointer (or 0000 when bit 5 is clear) on the stack in place of the address saved there.
B65E JP (HL) Return to the caller (its address is now in HL), leaving the location pointer and the handler address on the stack.
B65F LD A,($A00F) Jump to SelectJumpIfNotZero_MessagePrintMessage if the display mode is 05.
B662 CP $05
B664 JR Z,SelectJumpIfNotZero_MessagePrintMessage
B666 CP $06 Jump to SelectJumpIfNotZero_MessagePrintMessage when the display mode is 06.
B668 JR Z,SelectJumpIfNotZero_MessagePrintMessage
B66A LD A,($B173) Jump ahead to SelectJumpIfNotZero_TestDisplayFlag if bit 7 of display mode flag at DisplayModeFlag is clear.
B66D BIT 7,A
B66F JR Z,SelectJumpIfNotZero_TestDisplayFlag
SelectJumpIfNotZero_MessagePrintMessage B671 LD HL,$6855 Take the message, then call PrintTextAndHandleControlCharacters to print the message.
B674 CALL PrintTextAndHandleControlCharacters
B677 RET Return.
Test the display flag, and use the display data pointer when that flag is set.
SelectJumpIfNotZero_TestDisplayFlag B678 LD HL,$B16D Test bit 0 of the display flag and point HL at the display data pointer.
B67B BIT 0,(HL)
B67D LD HL,$B172
Build this display entry when the flag is clear.
B680 CALL NZ,ProcessDisplayEntry Call ProcessDisplayEntry if bit 0 of this byte is set.
B683 CALL SelectJumpIfNotZero Call SelectJumpIfNotZero to plant the JR NZ opcode and test the character record.
B686 LD A,($B16D) Read the display flag and take the display data pointer.
B689 LD HL,$B172
SelectJumpIfNotZero_BitDisplayFlag B68C LD DE,($B186) Jump ahead to SelectJumpIfNotZero_ClearStackedPointers if bit 0 of display flag at DisplayFlag is clear.
B690 PUSH DE
B691 BIT 0,A
B693 JR Z,SelectJumpIfNotZero_ClearStackedPointers
B695 CALL RestoreSavedCharacterRecord Call RestoreSavedCharacterRecord to restore the saved character record, then jump to SelectJumpIfNotZero_MessagePrintMessageAgain with the message at 05B3.
B698 LD HL,$05B3
B69B JR SelectJumpIfNotZero_MessagePrintMessageAgain
Clear the stacked pointers, then print the message at 05DB.
SelectJumpIfNotZero_ClearStackedPointers B69D LD HL,$0000 Push three zero words for the message.
B6A0 PUSH HL
B6A1 PUSH HL
B6A2 PUSH HL
B6A3 LD HL,$05DB Take the message at 05DB.
SelectJumpIfNotZero_MessagePrintMessageAgain B6A6 PUSH HL Take the message, then call PrintTextAndHandleControlCharacters to print the message.
B6A7 LD HL,$6894
B6AA CALL PrintTextAndHandleControlCharacters
B6AD RET Return.
B6AE LD A,($A010) Jump to SelectJumpIfNotZero_MessagePrintMessage if the display mode is 05.
B6B1 CP $05
B6B3 JR Z,SelectJumpIfNotZero_MessagePrintMessage
B6B5 CP $06 Jump to SelectJumpIfNotZero_MessagePrintMessage when the display mode is 06.
B6B7 JR Z,SelectJumpIfNotZero_MessagePrintMessage
B6B9 LD A,($B179) Jump back to SelectJumpIfNotZero_MessagePrintMessage while bit 7 of display mode flag (B179) is present.
B6BC BIT 7,A
B6BE JR NZ,SelectJumpIfNotZero_MessagePrintMessage
B6C0 LD HL,$B16E Take the display flag and take the display mode flag.
B6C3 BIT 0,(HL)
B6C5 LD HL,$B178
Build the alternate display entry.
B6C8 CALL NZ,ProcessDisplayEntryAlternate Call ProcessDisplayEntryAlternate if bit 0 of this byte is set.
B6CB CALL SelectJumpIfZero Call SelectJumpIfZero to plant the JR Z opcode.
B6CE LD A,($B16E) Jump back to SelectJumpIfNotZero_BitDisplayFlag to check flag and set display parameter.
B6D1 LD HL,$B178
B6D4 JR SelectJumpIfNotZero_BitDisplayFlag
View the equivalent code in;
Prev: B62F Up: Map Next: B6D6