Prev: 43311 Up: Map Next: 43408
43355: Process Format Data Byte
Used by the routines at ExtractTokenFromText and ProcessTextTokenFormat.
Input
HL Pointer to format data byte
Output
A Result value
F Zero flag set if end of format reached
ProcessFormatDataByte 43355 PUSH BC Stash BC on the stack.
43356 LD IX,23618 IX=NEWPPC (load the buffer pointer).
Read and process the format data byte.
43360 INC HL Increment HL by one (move to the format data byte).
43361 LD A,(HL) A=*HL (load the format data byte).
43362 BIT 7,A Test bit 7 of A (check if this is a command byte).
43364 INC HL Increment HL by one (move to the parameter byte).
43365 JR Z,ProcessFormatDataByte_ProcessBits Jump to ProcessFormatDataByte_ProcessBits if bit 7 is not set (data byte, not command).
43367 INC HL Increment HL by two (skip the parameter bytes for command formats).
43368 INC HL
ProcessFormatDataByte_ProcessBits 43369 PUSH AF Stash AF (the bit 7 test result) on the stack.
43370 AND %01110000 Keep only bits 4-6 (extract the format command type).
43372 JR Z,ProcessFormatDataByte_ProcessLowNibble Jump to ProcessFormatDataByte_ProcessLowNibble if the command type is zero (simple format).
Adjust the buffer pointer based on the command type.
ProcessFormatDataByte_AdjustBuffer 43374 INC IX Increment IX by one (move to the next buffer position).
43376 SUB 16 A-=16 (decrease the command type value).
43378 JR NZ,ProcessFormatDataByte_AdjustBuffer Jump to ProcessFormatDataByte_AdjustBuffer if we need to skip more positions.
ProcessFormatDataByte_ProcessLowNibble 43380 LD C,0 C=0 (initialise the result counter).
43382 POP AF Restore AF (the bit 7 test result) from the stack.
43383 AND %00001111 Keep only bits 0-3 (extract the low nibble).
43385 JR Z,ProcessFormatDataByte_End Jump to ProcessFormatDataByte_End if there's nothing to process.
ProcessFormatDataByte_ProcessLoop 43387 LD B,A B=A (store the count in B).
ProcessFormatDataByte_ProcessCommand 43388 CALL RotateAndExtractCharacterCode Call RotateAndExtractCharacterCode to process the format command.
43391 LD (IX+0),A Write A (the processed value) to *IX+0.
43394 INC IX Increment IX by one (move to the next buffer position).
43396 DJNZ ProcessFormatDataByte_ProcessCommand Decrease counter by one and loop back to ProcessFormatDataByte_ProcessCommand until counter is zero.
ProcessFormatDataByte_End 43398 LD (IX+0),0 Write 0 (terminator) to *IX+0.
43402 LD A,C A=C (load the result counter).
43403 POP BC Restore BC from the stack.
43404 AND A Return if the result counter is zero.
43405 RET Z
43406 INC HL Increment HL by one (move to the next format byte).
43407 RET Return.
Prev: 43311 Up: Map Next: 43408