1 BORDER 0: PAPER 0: INK 7: BRIGHT 1: CLS 5 REM ** port addr ** 10 LET port=131 15 LET THR=port+0 20 LET RHR=port+0 25 LET DLL=port+0 30 LET IER=port+4 35 LET DLM=port+4 40 LET FCR=port+8 45 LET ISR=port+8 50 LET LCR=port+12 55 LET MCR=port+16 60 LET LSR=port+20 65 LET MSR=port+24 70 LET SPR=port+28 75 LET EFR=port+8 80 LET XON1=port+16 85 LET XOFF1=port+24 100 REM ** LCR value ** 101 REM b7 divisor latch 102 REM b6 set break 103 REM b5 set parity 104 REM b4 even parity 105 REM b3 parity enable 106 REM b2 stop bits 2 107 REM b1 word length 8b 108 REM b0 word length 110 LET LCRVAL=BIN 00000111 120 REM 115200bps 125 LET DLLVAL = 4 130 LET DLMVAL = 0 150 REM select UART [0,2] 155 OUT SPR,0 200 REM ** baudrate ** 205 OUT LCR,128+LCRVAL 210 OUT DLL,DLLVAL 215 OUT DLM,DLMVAL 250 REM FIFO polled mode enab. 255 REM inter. & DMA disable 260 OUT FCR,BIN 00000001 300 REM access to EFR 305 OUT LCR,191 350 REM en. MCR spec., CTSRTS 355 OUT EFR,BIN 11011010 360 OUT XON1,17 365 OUT XOFF1,19 400 REM general reg. set. 405 OUT LCR,LCRVAL 450 REM normal mode, no IR 455 OUT MCR,BIN 00000010 500 REM no interrupts 505 OUT IER,0 580 PRINT "t=transmit"'"r=receive" 590 LET a$=INKEY$ 591 IF a$="t" THEN GO TO 600 592 IF a$="r" THEN GO TO 700 595 IF a$="" THEN GO TO 590 599 STOP 600 REM ** transmit ** 605 OUT THR,CODE "a" 606 OUT THR,CODE "b" 607 OUT THR,CODE "c" 608 OUT THR,13 609 OUT THR,10 615 BEEP .001,20: PAUSE 2 620 GO TO 600 700 REM ** receive ** 705 LET st=IN(LSR): IF (st/2 = INT(st/2)) THEN GO TO 705 710 LET ch=IN(RHR) 715 IF ch<>10 THEN PRINT CHR$(ch); 720 BEEP .001,20 725 IF ch = 10 THEN PRINT 799 GO TO 700