| Routines

05981: 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 | 05981 | PUSH HL | Save HL.
| 05982 | CALL STK_FETCH | Fetch the parameters of the channel code.
| 05985 | LD A,B | Give an error if the expression supplied is a null expression, e.g. OPEN #5,"".
| 05986 | OR C
| 05987 | JR NZ,OPEN_3
This entry point is used by the routine at OPEN_P. Report F - Invalid file name.
REPORT_F | 05989 | RST 8 | Call the error handling routine.
| 05990 | DEFB 14
Continue if no error occurred.
OPEN_3 | 05991 | PUSH BC | The length of the expression is saved.
| 05992 | LD A,(DE) | Fetch the first character.
| 05993 | AND 223 | Convert lower case codes to upper case ones.
| 05995 | LD C,A | Move code to the C register.
| 05996 | LD HL,6010 | The base address of the OPEN stream look-up table.
| 05999 | CALL INDEXER | Index into this table and locate the required offset.
| 06002 | JR NC,REPORT_F | Jump back if not found.
| 06004 | LD C,(HL) | Pass the offset to the BC register pair.
| 06005 | LD B,0
| 06007 | ADD HL,BC | Make HL point to the start of the appropriate subroutine.
| 06008 | POP BC | Fetch the length of the expression before jumping to the subroutine.
| 06009 | JP (HL)