Prev: A94D Up: Map Next: A990
A95B: Process Format Data Byte
Used by the routines at PrintTextToken and A94D.
Reads the next format byte and skips the extra bytes when its top bit is set.
Input
HL Pointer to format data byte
Output
A Result value
F Zero flag set if end of format reached
ProcessFormatDataByte A95B PUSH BC IX=NEWPPC, saving the count.
A95C LD IX,$5C42
Read and process the format data byte.
A960 INC HL Step to the format byte and go to ProcessFormatDataByte_ProcessBits if bit 7 is clear.
A961 LD A,(HL)
A962 BIT 7,A
A964 INC HL
A965 JR Z,ProcessFormatDataByte_ProcessBits
A967 INC HL Step on two places.
A968 INC HL
ProcessFormatDataByte_ProcessBits A969 PUSH AF Keep the format byte.
A96A AND %01110000 Keep bits 4-6, which name the format command.
A96C JR Z,ProcessFormatDataByte_ProcessLowNibble Jump ahead to ProcessFormatDataByte_ProcessLowNibble when the format command is empty.
Adjust the buffer pointer based on the command type.
ProcessFormatDataByte_AdjustBuffer A96E INC IX Jump back to ProcessFormatDataByte_AdjustBuffer while at least 10 is still left.
A970 SUB $10
A972 JR NZ,ProcessFormatDataByte_AdjustBuffer
ProcessFormatDataByte_ProcessLowNibble A974 LD C,$00 Reset the count in C.
A976 POP AF Restore the format byte from the stack.
A977 AND %00001111 Keep only bits 0-3 (extract the low nibble).
A979 JR Z,ProcessFormatDataByte_End Go to ProcessFormatDataByte_End if the low four bits are clear.
ProcessFormatDataByte_ProcessLoop A97B LD B,A Use the low digit as the repeat count.
ProcessFormatDataByte_ProcessCommand A97C CALL RotateAndExtractCharacterCode Call RotateAndExtractCharacterCode to unpack the next letter.
A97F LD (IX+$00),A Write A (the processed value) to *IX+00.
A982 INC IX Step the text pointer on one byte.
A984 DJNZ ProcessFormatDataByte_ProcessCommand Count the next entry and repeat from ProcessFormatDataByte_ProcessCommand.
ProcessFormatDataByte_End A986 LD (IX+$00),$00 Write 00 (terminator) to *IX+00.
A98A LD A,C Take the bit offset from C.
A98B POP BC Restore BC from the stack.
A98C AND A Return if the bit offset is zero.
A98D RET Z
A98E INC HL Step to the next byte of the format data.
A98F RET Return.
Prev: A94D Up: Map Next: A990