Prev: B033 Up: Map Next: B09A
B049: Link Character When Flagged
When the action flag is set, stores this character on the display list and allocates a record for the next one. Reached through the standard command table at Table_CommandHandlerLookup_Standard, dispatched by AFE0.
LinkCharacterWhenFlagged B049 BIT 1,E Jump ahead to LinkCharacterWhenFlagged_0 if bit 1 is clear.
B04B JR Z,LinkCharacterWhenFlagged_0
B04D LD HL,$088B Point HL at 088B and store its low byte at IY+00.
B050 LD (IY+$00),L
B053 LD (IY+$01),H Store H at IY+01.
B056 RES 1,E Clear the link bit on this character.
LinkCharacterWhenFlagged_0 B058 PUSH HL Keep the character record.
B059 PUSH DE
B05A PUSH IY
B05C PUSH IX
B05E LD IY,$9FEC Use the character script entry list (CharacterScriptEntryList+01).
B062 LD DE,$0000 Call IncrementPointerAndCompare to step pointer and compare.
B065 CALL IncrementPointerAndCompare
B068 LD A,$02 Call AllocateMemory to allocate 02 bytes.
B06A CALL AllocateMemory
B06D LD HL,($A02B) Store the low byte of the word at ActiveTextPointer as the record's flag byte.
B070 LD (IX+$00),L
B073 LD (IX+$01),H Store the moved marker.
B076 PUSH IX Store the low byte of the pointer in the previous record.
B078 POP HL
B079 LD (IY-$02),L
B07C LD (IY-$01),H Store the high byte of the pointer in the previous record.
B07F POP IX Restore the saved character record, the saved schedule entry, the saved source and the saved pointer from the stack.
B081 POP IY
B083 POP DE
B084 POP HL
LinkCharacterWhenFlagged_Loop B085 CALL SaveTextPointer Call SaveTextPointer to save the text pointer.
B088 CP $90 See whether the text byte is the link marker.
B08A JR NZ,LinkCharacterWhenFlagged_Loop Go back to LinkCharacterWhenFlagged_Loop until the text byte is the link marker.
B08C LD A,B Jump back to LinkCharacterWhenFlagged_Loop while the low nibble of B or C is not zero.
B08D AND $0F
B08F OR C
B090 JR NZ,LinkCharacterWhenFlagged_Loop
B092 LD HL,($A029) Write C0 through the pointer at SavedTextPointer and jump back to CopyDisplayIfNeeded to copy display if needed.
B095 LD (HL),$C0
B097 JP CopyDisplayIfNeeded
Prev: B033 Up: Map Next: B09A