Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'MINIMAL TERMINAL By Antoni Gual 15/11/02
'Serial Comms with QB.
CONST TIMEOUT = .2 'seconds
'CS0,CD0,DS0,OP0,RS makes comms work with a simple 3 wire connection"
'change COM2 TO COM1 if your modem is there. QB does not operate with COM3 and 4
OPEN "COM2: 9600,N,8,1,CS0,CD0,DS0,OP0,RS" FOR RANDOM AS #1
'screen header
COLOR 14, 1
CLS : PRINT "AGV QB Terminal: Key in your message, ENTER to send, ESC to quit":
PRINT STRING$(80, 45); : VIEW PRINT 3 TO 25: COLOR 7, 1
'send and receive loop
DO
'get key
K$ = INKEY$
'if key pressed then process it
IF LEN(K$) THEN
SELECT CASE ASC(K$)
'enter ends message and sends it to port
CASE 13:
IF LEN(TX$) THEN PRINT #1, TX$: TX$ = ""
'backspace erases rightmost char
CASE 8
IF LEN(TX$) THEN
'erase it in the user string
TX$ = LEFT$(TX$, LEN(TX$) - 1)
'erase it in the screen
p = POS(0): LOCATE , p - 1: PRINT " "; : LOCATE , p - 1
END IF
'escape quits
CASE 27
EXIT DO
'any other key is added to message
CASE ELSE
TX$ = TX$ + K$: PRINT K$;
END SELECT
END IF
'read port and add chars to receive buffer
WHILE NOT EOF(1)
RX$ = RX$ + INPUT$(LOC(1), 1)
T! = TIMER + TIMEOUT
WEND
'if timeout is exceeded we suppose line end
'display received message and clear buffer
IF TIMER > T! THEN
IF LEN(RX$) THEN COLOR 15, 1: PRINT RX$; : COLOR 7, 1: RX$ = ""
T! = TIMER + TIMEOUT
END IF
LOOP
CLOSE
END