488 CONTROLLER
32
First, we check STATUS until it indicates that there has been an address change:
200
PRINT#1,"STATUS1"
210
INPUT#2 ST$
220
'Has there been no Address Change?
230
IF MID$(ST$,7,1)="0" THEN 200
240
'Are we still in the idle state?*
250
STATE$=MID$(ST$,9,1)
260
IF STATE$="I" THEN 200
270
'Are we addressed to listen?
280
IF STATE$="L" THEN 400
290
'Are we addressed to talk?
300
IF STATE$="T" THEN 500
310
PRINT "BAD ADDRESSED STATE VALUE: ";ST$: STOP
*This means “are we still in a state where there is no communication.”
If we are addressed to listen, then we ENTER a line from the controller and print it out.
400 'Listen
state
410 PRINT#1,"ENTER"
420 LINE
INPUT#1,A$
430 PRINT
A$
440 GOTO
200
If we are addressed to talk, then we INPUT a line from the keyboard and OUTPUT it to the controller.
500 'Talk
state
510
LINE INPUT A$
520 PRINT#1,"OUTPUT;";A$
530 GOTO
200