Prev: 43341 Up: Map Next: 43408
43355: Process Format Data Byte
Used by the routines at PrintTextToken and 43341.
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 43355 PUSH BC IX=NEWPPC, saving the count.
43356 LD IX,23618
Read and process the format data byte.
43360 INC HL Step to the format byte and go to ProcessFormatDataByte_ProcessBits if bit 7 is clear.
43361 LD A,(HL)
43362 BIT 7,A
43364 INC HL
43365 JR Z,ProcessFormatDataByte_ProcessBits
43367 INC HL Step on two places.
43368 INC HL
ProcessFormatDataByte_ProcessBits 43369 PUSH AF Keep the format byte.
43370 AND %01110000 Keep bits 4-6, which name the format command.
43372 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 43374 INC IX Jump back to ProcessFormatDataByte_AdjustBuffer while at least 16 is still left.
43376 SUB 16
43378 JR NZ,ProcessFormatDataByte_AdjustBuffer
ProcessFormatDataByte_ProcessLowNibble 43380 LD C,0 Reset the count in C.
43382 POP AF Restore the format byte from the stack.
43383 AND %00001111 Keep only bits 0-3 (extract the low nibble).
43385 JR Z,ProcessFormatDataByte_End Go to ProcessFormatDataByte_End if the low four bits are clear.
ProcessFormatDataByte_ProcessLoop 43387 LD B,A Use the low digit as the repeat count.
ProcessFormatDataByte_ProcessCommand 43388 CALL RotateAndExtractCharacterCode Call RotateAndExtractCharacterCode to unpack the next letter.
43391 LD (IX+0),A Write A (the processed value) to *IX+0.
43394 INC IX Step the text pointer on one byte.
43396 DJNZ ProcessFormatDataByte_ProcessCommand Count the next entry and repeat from ProcessFormatDataByte_ProcessCommand.
ProcessFormatDataByte_End 43398 LD (IX+0),0 Write 0 (terminator) to *IX+0.
43402 LD A,C Take the bit offset from C.
43403 POP BC Restore BC from the stack.
43404 AND A Return if the bit offset is zero.
43405 RET Z
43406 INC HL Step to the next byte of the format data.
43407 RET Return.
Prev: 43341 Up: Map Next: 43408