| Routines

175D: THE 'OPEN-2' SUBROUTINE

Used by the routine at OPEN. The appropriate stream data bytes for the channel that is associated with the stream being opened are found.
OPEN_2 | 175D | PUSH HL | Save HL.
| 175E | CALL STK_FETCH | Fetch the parameters of the channel code.
| 1761 | LD A,B | Give an error if the expression supplied is a null expression, e.g. OPEN #5,"".
| 1762 | OR C
| 1763 | JR NZ,OPEN_3
This entry point is used by the routine at OPEN_P. Report F - Invalid file name.
REPORT_F | 1765 | RST $08 | Call the error handling routine.
| 1766 | DEFB $0E
Continue if no error occurred.
OPEN_3 | 1767 | PUSH BC | The length of the expression is saved.
| 1768 | LD A,(DE) | Fetch the first character.
| 1769 | AND $DF | Convert lower case codes to upper case ones.
| 176B | LD C,A | Move code to the C register.
| 176C | LD HL,$177A | The base address of the OPEN stream look-up table.
| 176F | CALL INDEXER | Index into this table and locate the required offset.
| 1772 | JR NC,REPORT_F | Jump back if not found.
| 1774 | LD C,(HL) | Pass the offset to the BC register pair.
| 1775 | LD B,$00
| 1777 | ADD HL,BC | Make HL point to the start of the appropriate subroutine.
| 1778 | POP BC | Fetch the length of the expression before jumping to the subroutine.
| 1779 | JP (HL)