| Routines

1701: 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 | 1701 | PUSH HL | Save the address of the stream's data.
| 1702 | LD HL,($5C4F) | Fetch the base address of the channel information area (CHANS) and find the channel data for the stream being closed.
| 1705 | ADD HL,BC
| 1706 | INC HL | Step past the subroutine addresses and pick up the code for that channel.
| 1707 | INC HL
| 1708 | INC HL
| 1709 | LD C,(HL)
| 170A | EX DE,HL | Save the pointer.
| 170B | LD HL,$1716 | The base address of the CLOSE stream look-up table.
| 170E | CALL INDEXER | Index into this table and locate the required offset.
| 1711 | LD C,(HL) | Pass the offset to the BC register pair.
| 1712 | LD B,$00
| 1714 | ADD HL,BC | Jump to the appropriate routine.
| 1715 | JP (HL)