| Routines

05889: THE 'CLOSE-2' SUBROUTINE

Used by the routine at CLOSE. The code of the channel associated with the stream being closed has to be 'K', 'S', or 'P'.
Input
BC | Offset from the stream data table (STRMS)
HL | Address of the offset in the stream data table
CLOSE_2 | 05889 | PUSH HL | Save the address of the stream's data.
| 05890 | LD HL,(23631) | Fetch the base address of the channel information area (CHANS) and find the channel data for the stream being closed.
| 05893 | ADD HL,BC
| 05894 | INC HL | Step past the subroutine addresses and pick up the code for that channel.
| 05895 | INC HL
| 05896 | INC HL
| 05897 | LD C,(HL)
| 05898 | EX DE,HL | Save the pointer.
| 05899 | LD HL,5910 | The base address of the CLOSE stream look-up table.
| 05902 | CALL INDEXER | Index into this table and locate the required offset.
| 05905 | LD C,(HL) | Pass the offset to the BC register pair.
| 05906 | LD B,0
| 05908 | ADD HL,BC | Jump to the appropriate routine.
| 05909 | JP (HL)