| Routines

05861: 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 0 to 3 the 'initial' stream data is restored and these streams cannot therefore be closed.
CLOSE | 05861 | CALL STR_DATA | The existing data for the stream is fetched.
| 05864 | CALL CLOSE_2 | Check the code in that stream's channel.
| 05867 | LD BC,0 | Prepare to make the stream's data zero.
| 05870 | LD DE,41954 | Prepare to identify the use of streams 0 to 3.
| 05873 | EX DE,HL
| 05874 | ADD HL,DE | The carry flag will be set with streams 4 to 15.
| 05875 | JR C,CLOSE_1 | Jump forward with these streams; otherwise find the correct entry in the initial stream data table.
| 05877 | LD BC,5588
| 05880 | ADD HL,BC
| 05881 | LD C,(HL) | Fetch the initial data for streams 0 to 3.
| 05882 | INC HL
| 05883 | LD B,(HL)
CLOSE_1 | 05884 | EX DE,HL | Now enter the data: either zero and zero, or the initial values.
| 05885 | LD (HL),C
| 05886 | INC HL
| 05887 | LD (HL),B
| 05888 | RET |