Prev: 171E Up: Map Next: 175D
1736: THE 'OPEN #' COMMAND ROUTINE
The address of this routine is found in the parameter table.
This command allows the user to OPEN streams. A channel code must be supplied and it must be 'K', 'k', 'S', 's', 'P', or 'p'.
Note that no attempt is made to give streams +00 to +03 their initial data.
Input
Output
OPEN 1736 RST $28 Use the calculator to exchange the stream number and the channel code.
1737 DEFB $01 exchange
1738 DEFB $38 end_calc
1739 CALL STR_DATA Fetch the data for the stream.
173C LD A,B Jump forward if both bytes of the data are zero, i.e. the stream was in a closed state.
173D OR C
173E JR Z,OPEN_1
1740 EX DE,HL Save HL.
1741 LD HL,($5C4F) Fetch CHANS - the base address of the channel information and find the code of the channel associated with the stream being OPENed.
1744 ADD HL,BC
1745 INC HL
1746 INC HL
1747 INC HL
1748 LD A,(HL)
1749 EX DE,HL Return HL.
174A CP "K" The code fetched from the channel information area must be 'K', 'S' or 'P'; give an error if it is not.
174C JR Z,OPEN_1
174E CP "S"
1750 JR Z,OPEN_1
1752 CP "P"
1754 JR NZ,REPORT_O_2
OPEN_1 1756 CALL OPEN_2 Collect the appropriate data in DE.
1759 LD (HL),E Enter the data into the two bytes in the stream information area.
175A INC HL
175B LD (HL),D
175C RET Finally return.
Prev: 171E Up: Map Next: 175D