| Routines

05918: THE 'STREAM DATA' SUBROUTINE

Used by the routines at CLOSE and OPEN. This subroutine returns in the BC register pair the stream data for a given stream.
Output
BC | Offset from the stream data table (STRMS)
HL | Address of the offset in the stream data table
STR_DATA | 05918 | CALL FIND_INT1 | The given stream number is taken off the calculator stack.
| 05921 | CP 16 | Give an error if the stream number is greater than 15.
| 05923 | JR C,STR_DATA1
This entry point is used by the routines at OPEN and CAT_ETC. Report O - Invalid stream.
REPORT_O_2 | 05925 | RST 8 | Call the error handling routine.
| 05926 | DEFB 23
Continue with valid stream numbers.
STR_DATA1 | 05927 | ADD A,3 | Range now 3 to 18.
| 05929 | RLCA | And now 6 to 36.
| 05930 | LD HL,23568 | The base address of the stream data area.
| 05933 | LD C,A | Move the stream code to the BC register pair.
| 05934 | LD B,0
| 05936 | ADD HL,BC | Index into the data area and fetch the the two data bytes into the BC register pair.
| 05937 | LD C,(HL)
| 05938 | INC HL
| 05939 | LD B,(HL)
| 05940 | DEC HL | Make the pointer address the first of the data bytes before returning.
| 05941 | RET