![]() |
Routines |
| Prev: 58112 | Up: Map | Next: 58230 |
|
Used by the routine at Paint_MessageBuffer.
Count characters in the current message row (until $ + or ]), centre that run within 32 columns, then draw it via Draw_MessageCharacter.
|
||||||||||
|
Count characters until a row or message end, then centre and draw the run.
|
||||||||||
| Centre_AndDrawMessageRow | 58186 | PUSH HL | Stash HL and IX on the stack. | |||||||
| 58187 | PUSH IX | |||||||||
| 58189 | LD C,255 | Start the character count at 255 (pre-increment). | ||||||||
|
Count characters until $ + or ] to measure the current message row.
|
||||||||||
| Centre_AndDrawMessageRow_Count | 58191 | INC C | Advance the character count. | |||||||
| 58192 | LD A,(IX+0) | Fetch the next buffer byte through IX. | ||||||||
| 58195 | CP 36 | Is it $ + or ] (row/message end)?, then if $ stop counting at Centre_AndDrawMessageRow_Centre. | ||||||||
| 58197 | JR Z,Centre_AndDrawMessageRow_Centre | |||||||||
| 58199 | CP 43 | Is it a new-row marker (+)? If so, stop counting at Centre_AndDrawMessageRow_Centre. | ||||||||
| 58201 | JR Z,Centre_AndDrawMessageRow_Centre | |||||||||
| 58203 | CP 93 | Is it the message terminator (])? If so, stop counting at Centre_AndDrawMessageRow_Centre. | ||||||||
| 58205 | JR Z,Centre_AndDrawMessageRow_Centre | |||||||||
| 58207 | INC IX | Advance IX to the next buffer byte. | ||||||||
| 58209 | JR Centre_AndDrawMessageRow_Count | Jump to Centre_AndDrawMessageRow_Count to keep counting. | ||||||||
|
Centre the counted run within 32 columns and draw it via Draw_MessageCharacter.
|
||||||||||
| Centre_AndDrawMessageRow_Centre | 58211 | POP IX | Restore IX from the stack. | |||||||
| 58213 | LD (56737),A | Remember the terminator byte in 56737. | ||||||||
| 58216 | LD A,32 | Compute (32−length)/2 as a left-indent. | ||||||||
| 58218 | SUB C | Subtract the row width from 32 to get the left pad. | ||||||||
| 58219 | SRL A | Halve that pad so the row is centred. | ||||||||
| 58221 | LD B,0 | Clear B. | ||||||||
| 58223 | LD C,A | Keep the indent in BC. | ||||||||
| 58224 | ADD HL,BC | Add it to the row's attribute address. | ||||||||
| 58225 | CALL Draw_MessageCharacter | Call Draw_MessageCharacter to draw the centred row. | ||||||||
| 58228 | POP HL | Restore HL from the stack. | ||||||||
| 58229 | RET | Return. | ||||||||
| Prev: 58112 | Up: Map | Next: 58230 |