| Routines

171E: 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 | 171E | CALL FIND_INT1 | The given stream number is taken off the calculator stack.
| 1721 | CP $10 | Give an error if the stream number is greater than +0F.
| 1723 | JR C,STR_DATA1
This entry point is used by the routines at OPEN and CAT_ETC. Report O - Invalid stream.
REPORT_O_2 | 1725 | RST $08 | Call the error handling routine.
| 1726 | DEFB $17
Continue with valid stream numbers.
STR_DATA1 | 1727 | ADD A,$03 | Range now +03 to +12.
| 1729 | RLCA | And now +06 to +24.
| 172A | LD HL,$5C10 | The base address of the stream data area.
| 172D | LD C,A | Move the stream code to the BC register pair.
| 172E | LD B,$00
| 1730 | ADD HL,BC | Index into the data area and fetch the the two data bytes into the BC register pair.
| 1731 | LD C,(HL)
| 1732 | INC HL
| 1733 | LD B,(HL)
| 1734 | DEC HL | Make the pointer address the first of the data bytes before returning.
| 1735 | RET