C-4
Appendix C, DEMONSTRATION PROGRAMS
290 V%=11: CALL IBTMO(DEV%,V%)
300 '....set status print flag........................
310 INPUT "Display status byte y/n "; R$
320 IF R$="Y" OR R$="y" THEN DS% = 1 ELSE DS% = 0
330 '....main loop....................................
340 WHILE 1 ' infinite loop
350 INPUT "command (00 to exit) ";A$
360 IF A$="00" THEN END
370 A$ = A$ + CHR$(13) ' terminator is <CR>
380 GOSUB 480 ' write A$ to bus
390 S% = 0 ' initialize S%
400 WHILE (S% AND 1)=0 ' while command not complete
410 GOSUB 530 ' serial poll, returns S%
420 IF DS% THEN PRINT "S%= ";S%
430 IF (S% AND 128) THEN GOSUB 500: PRINT B$ ' read bus into B$ and print
440 WEND
445 IF (S% AND 4) THEN PRINT "parameter error"
450 IF (S% AND 2) THEN PRINT "invalid command"
460 WEND
470 '....end of main loop.............................
480 '....write string to bus..........................
490 CALL IBWRT(DEV%,A$): RETURN
500 '....read string from bus.........................
510 B$ = SPACE$(32) ' B$ is buffer
520 CALL IBRD(DEV%,B$): RETURN
530 '......serial poll................................
540 CALL IBRSP(DEV%,S%): RETURN