| Routines

0C0A: THE 'MESSAGE PRINTING' SUBROUTINE

Used by the routines at SAVE_ETC, SA_CONTRL, PO_SCR, NEW and MAIN_EXEC. This subroutine is used to print messages and tokens.
Input
A | Message table entry number
DE | Message table address (CASSETTE, BLOCK_HDR-1, SCROLL, REPORTS, COMMA_SPC-1 or COPYRIGHT-1)
PO_MSG | 0C0A | PUSH HL | The high byte of the last entry on the machine stack is made zero so as to suppress trailing spaces (see below).
| 0C0B | LD H,$00
| 0C0D | EX (SP),HL
| 0C0E | JR PO_TABLE | Jump forward.
This entry point is used by the routine at PO_ANY. Enter here when expanding token codes.
PO_TOKENS | 0C10 | LD DE,$0095 | The base address of the token table.
| 0C13 | PUSH AF | Save the code on the stack. (Range +00 to +5A, RND to COPY).
The table is searched and the correct entry printed.
PO_TABLE | 0C14 | CALL PO_SEARCH | Locate the required entry.
| 0C17 | JR C,PO_EACH | Print the message/token.
| 0C19 | LD A," " | A 'space' will be printed before the message/token if required (bit 0 of FLAGS reset).
| 0C1B | BIT 0,(IY+$01)
| 0C1F | CALL Z,PO_SAVE
The characters of the message/token are printed in turn.
PO_EACH | 0C22 | LD A,(DE) | Collect a code.
| 0C23 | AND $7F | Cancel any 'inverted bit'.
| 0C25 | CALL PO_SAVE | Print the character.
| 0C28 | LD A,(DE) | Collect the code again.
| 0C29 | INC DE | Advance the pointer.
| 0C2A | ADD A,A | The 'inverted bit' goes to the carry flag and signals the end of the message/token; otherwise jump back.
| 0C2B | JR NC,PO_EACH
Now consider whether a 'trailing space' is required.
| 0C2D | POP DE | For messages, D holds +00; for tokens, D holds +00 to +5A.
| 0C2E | CP $48 | Jump forward if the last character was a '$'.
| 0C30 | JR Z,PO_TR_SP
| 0C32 | CP $82 | Return if the last character was any other before 'A'.
| 0C34 | RET C
PO_TR_SP | 0C35 | LD A,D | Examine the value in D and return if it indicates a message, RND, INKEY$ or PI.
| 0C36 | CP $03
| 0C38 | RET C
| 0C39 | LD A," " | All other cases will require a 'trailing space'.
This routine continues into PO_SAVE.