The STATUS and CONTROL registers of an I/O path assigned to a BUFFER were presented in full in Chapter 5. The following example shows use of registers 2 through 5. All of these registers can be read, and all but the first can be set.
10 ASSIGN @Io TO BUFFER [1000];FORMAT OFF
20 Info("Start",@Io)
30 OUTPUT @Io;PI,1/3
40 Info("After OUTPUT",@Io)
50 ENTER @Io;X
60 Info("After ENTER",@Io)
70 END
80 SUB Info(When$,@Io)
90 PRINT When$
100 PRINT " Total buffer size is ";STATUS(@Io,2)
110 PRINT " Fill pointer is ";STATUS(@Io,3)
120 PRINT " # of bytes in buffer is ";STATUS(@Io,4)
130 PRINT " Empty pointer is ";STATUS(@Io,5)
140 SUBEND
This program produces the following output:
Start
Total buffer size is 1000
Fill pointer is 1
# of bytes in buffer is 0
Empty pointer is 1
After OUTPUT
Total buffer size is 1000
Fill pointer is 17
# of bytes in buffer is 16
Empty pointer is 1
After ENTER
Total buffer size is 1000
Fill pointer is 17
# of bytes in buffer is 8
Empty pointer is 9
|