![]() |
Routines |
| Prev: A92F | Up: Map | Next: A990 |
|
Used by the routines at ExtractTokenFromText and ProcessTextTokenFormat.
|
||||||||||||||
| ProcessFormatDataByte | A95B | PUSH BC | Stash BC on the stack. | |||||||||||
| A95C | LD IX,$5C42 | IX=NEWPPC (load the buffer pointer). | ||||||||||||
|
Read and process the format data byte.
|
||||||||||||||
| A960 | INC HL | Increment HL by one (move to the format data byte). | ||||||||||||
| A961 | LD A,(HL) | A=*HL (load the format data byte). | ||||||||||||
| A962 | BIT 7,A | Test bit 7 of A (check if this is a command byte). | ||||||||||||
| A964 | INC HL | Increment HL by one (move to the parameter byte). | ||||||||||||
| A965 | JR Z,ProcessFormatDataByte_ProcessBits | Jump to ProcessFormatDataByte_ProcessBits if bit 7 is not set (data byte, not command). | ||||||||||||
| A967 | INC HL | Increment HL by two (skip the parameter bytes for command formats). | ||||||||||||
| A968 | INC HL | |||||||||||||
| ProcessFormatDataByte_ProcessBits | A969 | PUSH AF | Stash AF (the bit 7 test result) on the stack. | |||||||||||
| A96A | AND %01110000 | Keep only bits 4-6 (extract the format command type). | ||||||||||||
| A96C | 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 | A96E | INC IX | Increment IX by one (move to the next buffer position). | |||||||||||
| A970 | SUB $10 | A-=10 (decrease the command type value). | ||||||||||||
| A972 | JR NZ,ProcessFormatDataByte_AdjustBuffer | Jump to ProcessFormatDataByte_AdjustBuffer if we need to skip more positions. | ||||||||||||
| ProcessFormatDataByte_ProcessLowNibble | A974 | LD C,$00 | C=00 (initialise the result counter). | |||||||||||
| A976 | POP AF | Restore AF (the bit 7 test result) from the stack. | ||||||||||||
| A977 | AND %00001111 | Keep only bits 0-3 (extract the low nibble). | ||||||||||||
| A979 | JR Z,ProcessFormatDataByte_End | Jump to ProcessFormatDataByte_End if there's nothing to process. | ||||||||||||
| ProcessFormatDataByte_ProcessLoop | A97B | LD B,A | B=A (store the count in B). | |||||||||||
| ProcessFormatDataByte_ProcessCommand | A97C | CALL RotateAndExtractCharacterCode | Call RotateAndExtractCharacterCode to process the format command. | |||||||||||
| A97F | LD (IX+$00),A | Write A (the processed value) to *IX+00. | ||||||||||||
| A982 | INC IX | Increment IX by one (move to the next buffer position). | ||||||||||||
| A984 | DJNZ ProcessFormatDataByte_ProcessCommand | Decrease counter by one and loop back to ProcessFormatDataByte_ProcessCommand until counter is zero. | ||||||||||||
| ProcessFormatDataByte_End | A986 | LD (IX+$00),$00 | Write 00 (terminator) to *IX+00. | |||||||||||
| A98A | LD A,C | A=C (load the result counter). | ||||||||||||
| A98B | POP BC | Restore BC from the stack. | ||||||||||||
| A98C | AND A | Return if the result counter is zero. | ||||||||||||
| A98D | RET Z | |||||||||||||
| A98E | INC HL | Increment HL by one (move to the next format byte). | ||||||||||||
| A98F | RET | Return. | ||||||||||||
| Prev: A92F | Up: Map | Next: A990 |