can you also run basterm with the emulator for x16?
thanks.
greetings
Code: Select all
REM V* - JUNE 2024
SERIAL.IN = 0 : REM DEFINE THIS FIRST FOR PERFORMANCE
SCREEN 1 : REM 80 COL, IF YOUR EYES CAN HANDLE IT
REM SCREEN 3 : REM 40 COL, IF FLAT SCREEN OR CAN ADJUST THE EDGES
REM SCREEN 9 : REM 64 COL, BUT NICE FOR SORT-OF 40-COL ON A CRT OR COMPOSITE
REM PRINT CHR$($0F) : REM ENABLE ISO-MODE (USE THIS IF CONNECTING TO ASCII/IBM THINGS)
PRINT CHR$($0E) : REM UPPER/LOWER PETSCII (USE IF CONNECTING TO COMMODORE/PARTICLES BBS)
COLOR 1,0
CLS
DIM BAUD.DIV.HI(22)
DIM BAUD.DIV.LO(22)
DIM BAUD.RATE$(22)
RESTORE BAUD.DIVS
FOR I = 1 TO 22
READ HI:READ LO:READ RATE$
BAUD.DIV.HI(I) = HI
BAUD.DIV.LO(I) = LO
BAUD.RATE$(I) = RATE$
NEXT I
BAUD.CURR = 9 : REM DEFAULT TO 2400 BAUD
SERIAL.REG.BASE = $9FE0 : REM DEFAULT IO7 LOW (ADJUST AS NEEDED)
REM WHEN DLAB==0 (BIT 7 OF REG.BASE+3)
REM --------------------
REG.READ.RBR = SERIAL.REG.BASE+0
REM REG.READ.IER = SERIAL.REG.BASE+1
REM REG.READ.IIR = SERIAL.REG.BASE+2
REG.READ.LCR = SERIAL.REG.BASE+3
REM REG.READ.MCR = SERIAL.REG.BASE+4
REM REG.READ.LSR = SERIAL.REG.BASE+5
REM REG.READ.MSR = SERIAL.REG.BASE+6
REM REG.READ.SCR = SERIAL.REG.BASE+7
REG.WRITE.THR = SERIAL.REG.BASE+0
REM REG.WRITE.IER = SERIAL.REG.BASE+1
REG.WRITE.FCR = SERIAL.REG.BASE+2
REG.WRITE.LCR = SERIAL.REG.BASE+3
REG.WRITE.MCR = SERIAL.REG.BASE+4
REM REG.WRITE.NA1 = SERIAL.REG.BASE+5
REG.WRITE.MSR = SERIAL.REG.BASE+6
REM REG.WRITE.SCR = SERIAL.REG.BASE+7
REM WHEN DLAB==1 (BIT 7 OF SERIAL.REG.BASE+3)
REM --------------------
REM REG.READ.DLL = SERIAL.REG.BASE+0
REM REG.READ.DLM = SERIAL.REG.BASE+1
REM IIR,LCR,MCR SAME
REM REG.READ.LSR = SERIAL.REG.BASE+5
REM REG.READ.MSR = SERIAL.REG.BASE+6
REG.WRITE.DLL = SERIAL.REG.BASE+0
REG.WRITE.DLM = SERIAL.REG.BASE+1
REM FCR,LCR,MCR SAME
GOSUB SERIAL.INIT
LOCAL.ECHO = 0
PRINT
PRINT "(8-N-1)"
PRINT "F1: TOGGLE LOCAL ECHO (DEFAULT OFF)"
PRINT "F2: DECREASE BAUD"
PRINT "F3: INCREASE BAUD"
MAIN.LOOP:
GET A$
A = ASC(A$)
IF A = 0 THEN GOTO SKIP.XMIT
SEND=1
IF A = 133 THEN SEND=0:LOCAL.ECHO = NOT LOCAL.ECHO : REM F1 TOGGLE LOCAL ECHO
IF A = 137 THEN SEND=0:GOSUB DECREASE.BAUD : REM F2 DECREASE BAUD RATE
IF A = 134 THEN SEND=0:GOSUB INCREASE.BAUD : REM F3 INCREASE BAUD RATE
IF SEND=0 THEN GOTO SKIP.XMIT
IF LOCAL.ECHO <> 0 THEN PRINT CHR$(A);
POKE REG.WRITE.THR, A
SKIP.XMIT:
SERIAL.IN = PEEK(REG.READ.RBR)
IF (SERIAL.IN <> 0) THEN PRINT CHR$(SERIAL.IN);
GOTO MAIN.LOOP
REM ****************************************************
INCREASE.BAUD:
BAUD.CURR = BAUD.CURR+1
IF BAUD.CURR > 22 THEN BAUD.CURR = 1
GOSUB SERIAL.INIT
RETURN
DECREASE.BAUD:
BAUD.CURR = BAUD.CURR-1
IF BAUD.CURR < 1 THEN BAUD.CURR = 22
GOSUB SERIAL.INIT
RETURN
SERIAL.INIT:
POKE REG.WRITE.LCR,$83 : REM SET DLAB==1 (AND SET 8 DATA BIT, 1 STOP BIT)
POKE REG.WRITE.DLL,BAUD.DIV.LO(BAUD.CURR) : REM LSB (LO)
POKE REG.WRITE.DLM,BAUD.DIV.HI(BAUD.CURR) : REM MSB (HI)
POKE REG.WRITE.FCR,$C1 : REM 14 BYTE FIFO, ENABLE FIFO
A$ = "(" + BAUD.RATE$(BAUD.CURR) + ")"
PRINT A$;
X = PEEK(REG.READ.LCR) : REM STORE CURRENT BIT MASK
X = X AND $7F : REM SET DLAB == 0
POKE REG.WRITE.LCR, X
X = $02 : REM SET RTS BIT 1 0000 0010
POKE REG.WRITE.MCR, X
X = $20 : REM SET DSR BIT 5 0010 0000
POKE REG.WRITE.MSR, X
RETURN
BAUD.DIVS:
DATA $48,$00," 50":REM 1 50
DATA $20,$BA," 110":REM 2 110
DATA $0C,$00," 300":REM 3 300
DATA $08,$00," 450":REM 4 450
DATA $06,$00," 600":REM 5 600
DATA $04,$00," 900":REM 6 900
DATA $03,$00," 1200":REM 7 1200
DATA $02,$00," 1800":REM 8 1800
DATA $01,$80," 2400":REM 9 2400
DATA $01,$00," 3600":REM 10 3600
DATA $00,$C0," 4800":REM 11 4800
DATA $00,$80," 7200":REM 12 7200
DATA $00,$60," 9600":REM 13 9600
DATA $00,$40," 14400":REM 14 14400
DATA $00,$30," 19200":REM 15 19200
DATA $00,$20," 28800":REM 16 28800
DATA $00,$18," 38400":REM 17 38400
DATA $00,$10," 57600":REM 18 57600
DATA $00,$08,"115200":REM 19 115200
DATA $00,$04,"230400":REM 20 230400
DATA $00,$02,"460800":REM 21 460800
DATA $00,$01,"921600":REM 22 921600