| Routines

03137: 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 | 03137 | PUSH AF | Save the 'entry number'.
| 03138 | EX DE,HL | HL now holds the base address.
| 03139 | INC A | Compensate for the 'DEC A' below.
PO_STEP | 03140 | BIT 7,(HL) | Wait for an 'inverted character'.
| 03142 | INC HL
| 03143 | JR Z,PO_STEP
| 03145 | DEC A | Count through the entries until the correct one is found.
| 03146 | JR NZ,PO_STEP
| 03148 | EX DE,HL | DE points to the initial character.
| 03149 | POP AF | Fetch the 'entry number' and return with carry set for the first thirty two entries.
| 03150 | CP 32
| 03152 | RET C
| 03153 | LD A,(DE) | However if the initial character is a letter then a leading space may be needed.
| 03154 | SUB "A"
| 03156 | RET