| Routines

0C41: THE 'TABLE SEARCH' SUBROUTINE

Used by the routine at PO_MSG.
Input
A | Message table entry number
DE | Message table start address
Output
DE | Address of the first character of message number A
F | Carry flag: suppress (set) or allow (reset) a leading space
PO_SEARCH | 0C41 | PUSH AF | Save the 'entry number'.
| 0C42 | EX DE,HL | HL now holds the base address.
| 0C43 | INC A | Compensate for the 'DEC A' below.
PO_STEP | 0C44 | BIT 7,(HL) | Wait for an 'inverted character'.
| 0C46 | INC HL
| 0C47 | JR Z,PO_STEP
| 0C49 | DEC A | Count through the entries until the correct one is found.
| 0C4A | JR NZ,PO_STEP
| 0C4C | EX DE,HL | DE points to the initial character.
| 0C4D | POP AF | Fetch the 'entry number' and return with carry set for the first thirty two entries.
| 0C4E | CP $20
| 0C50 | RET C
| 0C51 | LD A,(DE) | However if the initial character is a letter then a leading space may be needed.
| 0C52 | SUB "A"
| 0C54 | RET