| Routines

16E5: THE 'CLOSE #' COMMAND ROUTINE

The address of this routine is found in the parameter table. This command allows the user to close streams. However for streams +00 to +03 the 'initial' stream data is restored and these streams cannot therefore be closed.
CLOSE | 16E5 | CALL STR_DATA | The existing data for the stream is fetched.
| 16E8 | CALL CLOSE_2 | Check the code in that stream's channel.
| 16EB | LD BC,$0000 | Prepare to make the stream's data zero.
| 16EE | LD DE,$A3E2 | Prepare to identify the use of streams +00 to +03.
| 16F1 | EX DE,HL
| 16F2 | ADD HL,DE | The carry flag will be set with streams +04 to +0F.
| 16F3 | JR C,CLOSE_1 | Jump forward with these streams; otherwise find the correct entry in the initial stream data table.
| 16F5 | LD BC,$15D4
| 16F8 | ADD HL,BC
| 16F9 | LD C,(HL) | Fetch the initial data for streams +00 to +03.
| 16FA | INC HL
| 16FB | LD B,(HL)
CLOSE_1 | 16FC | EX DE,HL | Now enter the data: either zero and zero, or the initial values.
| 16FD | LD (HL),C
| 16FE | INC HL
| 16FF | LD (HL),B
| 1700 | RET |