Code:
'****************************************************************
'* Name : Overlay.BAS *
'* Author : [Grant Taylor VE3XTV / ZL1WTT] *
'* Notice : Copyright (c) 2010 *
'* : All Rights Reserved *
'* Date : Start date 30/12/2010 *
'* Version : 6.0 *
'* Notes : onging project *
'* : *
'****************************************************************
' Using STV5730A as a video overlay for text information
' With a Microcontroller
' Definitions
DEFINE OSC 20 ' 20 MHz Oscillator frequency
DEFINE HSER_RCSTA 90h ' Set receive register to receiver enabled
DEFINE HSER_TXSTA 20h ' Set transmit register to transmitter enabled
DEFINE HSER_BAUD 9600 ' Set baud rate
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
Dpin var PORTB.0 ' I2C Data pin
Cpin var PORTB.1 ' I2C Clock pin
DA VAR PORTB.2 ' Data out
CL VAR PORTB.3 ' Clock out
EN VAR PORTB.4 ' Chip enable or chip select
'Variables
RC VAR BYTE ' Row count
CC VAR BYTE ' Character counter
LC VAR BYTE ' Line counter
wData VAR WORD ' Write data
Echo var byte ' Storage for serial character
TAB VAR BYTE ' TAB to move across a line
TP VAR WORD ' Temp variable holder
T VAR BYTE ' Time variable holder
T1 VAR BYTE ' Time variable holder
T10 VAR BYTE ' Time variable holder
NC VAR BYTE ' Number count
J VAR WORD ' Table counter variable
C VAR BYTE ' Counter variable
Co VAR BYTE ' Counter out variable
L VAR WORD ' Line counter
Sz VAR BYTE ' Text size
H VAR BYTE ' Hex number
AS VAR BYTE ' ASCII number
D VAR BYTE [28] ' ASCII Digits
CS var byte [7] ' callsign position array
Cx VAR BIT ' Date bit
Tx VAR BIT ' Date bit
SumA VAR BYTE ' Check output pins
SumB VAR BYTE ' Check output pins
AD0 VAR WORD ' Create ad0 to store result
AD1 VAR WORD ' Create ad1 to store result
X VAR BIT ' Callsign set bit
Init:
TRISA = %000011 ' Set as both
ADCON1 = %00000010 ' Set PORTA analog and LEFT justify result
TRISB = %00000011 ' Set as both
TRISC = %11111111 ' Set as both
H=$30 : Tx=1 : Cx=0 : X=0
' STV5730A initialize
initSTV:
High Cl :High DA :High EN ' Start up data
Pause 250 ' 250ms wait
wData=$3000 : GoSub Send ' Send 3000 in Hex
wData=$3000 : GoSub Send ' Send 3000 in Hex
wData=$00DB : GoSub Send ' Send 00DB in Hex
wData=$1000 : GoSub Send ' Send 1000 in Hex
wData=$00CC : GoSub Send ' Init registers (point to register 12)
wData=$1000 : GoSub Send ' Zoom
wData=$1000 : GoSub Send ' Colour
wData=$1ACE : GoSub Send ' Control set to NTSC
wData=$15A1 : GoSub Send ' Position
wData=$183C : GoSub Send ' Mode
wData=$00C0 : GoSub Send ' Set row attributes
For RC=0 TO 10 ' Rows from 0 to 10
wData=$10C4 : GoSub Send
Next RC
CC=0: LC=0 ' Set line and row to 0
GOSUB CLS ' Clear video screen
PAUSE 250
CC=0: LC=0 ' Set line and row to 0
GOSUB CLS ' Clear video screen
GOTO com_set
CLS:
wData=lc*256+CC ' Line and row data
GoSub Send ' Send data to STV5730A
wData=$1F0B ' Set character to " "
GoSub Send ' Send data to STV5730A
CC=CC+1
IF CC>=28 Then ' Max character count of 28
CC=0
lc=LC+1
EndIF
IF Lc=11 THEN ' Max line count of 11
RETURN
ELSE
GoTo CLS
ENDIF
Send: ' Send data to STV5730A
PAUSEUS 250 ' Deylay of 250 uS
Low EN ' Set chip select low
GoSub Serial ' Send 16 bit word
High EN ' Set chip select pin high
High Cl ' Set clock pin high
High DA ' Set data pin high
Return
Serial: ' Serial out routine
DA=wData.15 ' Bring Do pin high or low, depending upon bit
PULSOUT CL,1 ' Bring Clock line high and then low
DA=wData.14 ' Same as above
PULSOUT CL,1 ' Same as above
DA=wData.13
PULSOUT CL,1
DA=wData.12
PULSOUT CL,1
DA=wData.11
PULSOUT CL,1
DA=wData.10
PULSOUT CL,1
DA=wData.9
PULSOUT CL,1
DA=wData.8
PULSOUT CL,1
DA=wData.7
PULSOUT CL,1
DA=wData.6
PULSOUT CL,1
DA=wData.5
PULSOUT CL,1
DA=wData.4
PULSOUT CL,1
DA=wData.3
PULSOUT CL,1
DA=wData.2
PULSOUT CL,1
DA=wData.1
PULSOUT CL,1
DA=wData.0
PULSOUT CL,1
Return
PC_time: ' Time comport
T=0
I2CREAD Dpin,Cpin,$A3,$02,[T]
GOSUB Tcon
CS[0]=T
I2CREAD Dpin,Cpin,$A3,$03,[T]
GOSUB Tcon
CS[1]=T
I2CREAD Dpin,Cpin,$A3,$04,[T]
T=T&$3F
GOSUB Tcon
CS[2]=T
hserout ["Time h,m,s"]
GOSUB linefeed ' Send text followed by carriage return and linefeed
GOSUB linefeed ' Carriage return and linefeed
hserout [DEC CS(2),":",DEC CS(1),".",DEC CS(0)] ' Send text followed by carriage return and linefeed
GOSUB linefeed
GOSUB linefeed ' Carriage return and linefeed
RETURN
PC_date: ' Date comport
I2CREAD Dpin,Cpin,$A3,$05,[T]
T=T&$3F
GOSUB Tcon
CS[3]=T
I2CREAD Dpin,Cpin,$A3,$06,[T]
T=T&$07
GOSUB Tcon
CS[4]=T
I2CREAD Dpin,Cpin,$A3,$07,[T]
T=T&$1F
GOSUB Tcon
CS[5]=T
I2CREAD Dpin,Cpin,$A3,$08,[T]
GOSUB Tcon
CS[6]=T
hserout ["Date d,m,y"] ' Send text followed by carriage return and linefeed
GOSUB linefeed
GOSUB linefeed ' Carriage return and linefeed
IF CS[4]=0 THEN hserout ["Sun",13,10]
IF CS[4]=1 THEN hserout ["Mon",13,10]
IF CS[4]=2 THEN hserout ["Tues",13,10]
IF CS[4]=3 THEN hserout ["Wed",13,10]
IF CS[4]=4 THEN hserout ["Thurs",13,10]
IF CS[4]=5 THEN hserout ["Fri",13,10]
IF CS[4]=6 THEN hserout ["Sat",13,10]
GOSUB linefeed ' Carriage return and linefeed
hserout [DEC CS(3),"/",DEC CS(5),"/20",DEC CS(6)] ' Send text followed by carriage return and linefeed
GOSUB linefeed
GOSUB linefeed ' Carriage return and linefeed
RETURN
Tcon:
T=T&$7F
T1 =($0F&T)
T10=(T/$10)*10
T=T10+T1
RETURN
Set_time:
T10=(T10-H)*$10
T1 =T1-H
Co=T10+T1
RETURN
vcon:
CS[1]=T DIG 0 ' Read the position of digit 2
CS[0]=T DIG 1 ' Read the position of digit 1
RETURN
v_time: ' Display time via the video
J=J+1
I2CREAD Dpin,Cpin,$A3,$05,[T]
T=T&$3F
SumB=t
IF Cx=1 AND SumA<>SumB THEN GOSUB v_date
IF Tx=1 AND J=250 THEN GOSUB Temp
wData=$700
GOSUB Send
I2CREAD Dpin,Cpin,$A3,$04,[T]
T=T&$3F
GOSUB Tcon
GOSUB vcon
for C=0 to 2 ' Read data out to STV5730A
LOOKUP2 C,[CS[0],CS[1],$26],Co
wData=$1300+Co
gosub Send
NEXT C
I2CREAD Dpin,Cpin,$A3,$03,[T]
GOSUB Tcon
GOSUB vcon
FOR C=0 to 2 ' Read data out to STV5730A
LOOKUP2 C,[CS[0],CS[1],$26],Co
wData=$1300+Co
GOSUB Send
NEXT C
I2CREAD Dpin,Cpin,$A3,$02,[T]
GOSUB Tcon
GOSUB vcon
FOR C=0 to 1 ' Read data out to STV5730A
LOOKUP2 C,[CS[0],CS[1]],Co
wData=$1300+Co
gosub Send
NEXT C
Hserin 40,v_time,[echo]
IF ECHO=27 THEN
GOSUB linefeed
hserout ["Exit"]
GOSUB linefeed
GOSUB linefeed
GOSUB CLS
CC=0: Lc=0 : L=0 : Cx=0 : Tx=0
RETURN
ENDIF
GOTO v_time:
v_date: ' Display date via the video
wData=$800
gosub Send
I2CREAD Dpin,Cpin,$A3,$05,[T]
T=T&$3F
SumA=t
GOSUB Tcon
GOSUB vcon
for C=0 to 2 ' Read data out to STV5730A
LOOKUP2 C,[CS[0],CS[1],$28],Co
wData=$1300+Co
GOSUB Send
next C
I2CREAD Dpin,Cpin,$A3,$07,[T]
T=T&$1F
GOSUB Tcon
GOSUB vcon
for C=0 to 2 ' Read data out to STV5730A
LOOKUP2 C,[CS[0],CS[1],$28],Co
wData=$1300+Co
GOSUB Send
next C
I2CREAD Dpin,Cpin,$A3,$08,[T]
GOSUB Tcon
GOSUB vcon
FOR C=0 to 3 ' Read data out to STV5730A
LOOKUP2 C,[2,0,CS[0],CS[1]],Co
wData=$1300+Co
GOSUB Send
NEXT C
RETURN
Tempcom: ' Read temperture
GOSUB Tmp1
IF D(3)=$0B THEN
D(3)=32
ELSE
D(3)=D(3)+H
ENDIF
IF D(2)<$0A THEN D(2)=D(2)+H
IF D(2)=$0B THEN D(2)=32
IF D(2)=$0A THEN D(2)=45
hserout ["temp 1 ",D(2),D(3),D(4)+H,"C"]
GOSUB linefeed
GOSUB Tmp2
IF D(3)=$0B THEN
D(3)=32
ELSE
D(3)=D(3)+H
ENDIF
IF D(2)<$0A THEN D(2)=D(2)+H
IF D(2)=$0B THEN D(2)=32
IF D(2)=$0A THEN D(2)=45
hserout ["temp 2 ",D(2),D(3),D(4)+H,"C"]
GOSUB linefeed
GOSUB linefeed
RETURN
Temp: ' Display Temperture via the video
wData=$70C
gosub Send
for C=0 to 10 ' Read data out to STV5730A
LOOKUP2 C,[$1F,$2E,$36,$39,$2E,$3B,$2A,$3D,$3E,$3B,$2E],Co
wData=$1300+Co
gosub Send
next C
GOSUB Tmp1
wData=$80C
gosub Send
for C=0 to 5 ' Read data out to STV5730A
LOOKUP2 C,[$1,$0B,D(2),D(3),D(4),$0E],Co
wData=$1300+Co
gosub Send
next C
GOSUB Tmp2
wData=$814
gosub Send
for C=0 to 5 ' Read data out to STV5730A
LOOKUP2 C,[$2,$0B,D(2),D(3),D(4),$0E],Co
wData=$1300+Co
gosub Send
next C
Tx=1
J=0
RETURN
Tmp1:
ADCIN 0,AD0 ' Read ADC one
Tp=AD0/64
GOSUB Temp_C
RETURN
Tmp2:
ADCIN 1,AD1 ' Read ADC two
Tp=AD1/64
GOSUB Temp_C
RETURN
Temp_C:
IF Tp>=559 THEN
J=(Tp-559)*100 ' Calulate out temperture in +
C=J/205
ELSE
J=(Tp-354)*100 ' Calulate out temperture in -
C=100-(J/205)
ENDIF
GOSUB AtoDcaL
RETURN
AtoDcaL:
D(4)=C DIG 0 ' Read the position of digit 5
D(3)=C DIG 1 ' Read the position of digit 4
D(2)=C DIG 2 ' Read the position of digit 3
D(1)=C DIG 3 ' Read the position of digit 2
D(0)=C DIG 4 ' Read the position of digit 1
IF D(0)+D(1)+D(2)+D(3)=0 THEN D(3)=$0B ' Add space in (Hex B)
IF D(0)+D(1)+D(2)=0 THEN D(2)=$0B
IF D(0)+D(1)=0 THEN D(1)=$0B
IF D(0)=0 THEN D(0)=$0B
RETURN
' Comport setup
com_set:
wData=0 : Sz=0
L=0 : TAB=0 : J=0
CC=0: Lc=0 : Cx=0 : Tx=0
hserout ["Video overlay"] ' Send text followed by carriage return and linefeed
GOSUB linefeed
hserout ["by Grant VE3XTV"] ' Send text followed by carriage return and linefeed
GOSUB linefeed ' Carriage return and linefeed
com_start: ' Comport start up
IF Sz=0 THEN
wData=$00CC
GoSub Send
wData=$1000
GoSub Send
ENDIF
IF Sz=1 THEN
wData=$00CC
GoSub Send
wData=$1555
GoSub Send
ENDIF
IF Sz=2 THEN
wData=$00CC
GoSub Send
wData=$1AAA
GoSub Send
ENDIF
IF Sz=3 THEN
wData=$00CC
GoSub Send
wData=$1FFF
GoSub Send
ENDIF
com:
FOR NC=1 TO 10
Hserin 4000,com_start,[echo] ' Get a echo from serial port
IF ECHO=13 THEN
GOTO getinfo
GOTO com
ENDIF
IF NC=1 THEN D(0)=ECHO ' Store last 10 ASCII digits
IF NC=2 THEN D(1)=ECHO
IF NC=3 THEN D(2)=ECHO
IF NC=4 THEN D(3)=ECHO
IF NC=5 THEN D(4)=ECHO
IF NC=6 THEN D(5)=ECHO
IF NC=7 THEN D(6)=ECHO
IF NC=8 THEN D(7)=ECHO
IF NC=9 THEN D(8)=ECHO
IF NC=10 THEN D(9)=ECHO
hserout [echo] ' Send echo out serial port
NEXT NC
Goto com
getinfo:
GOSUB linefeed
IF D(0)=67 AND D(1)=76 AND D(2)=83 THEN ' CLS Clear screen
GOSUB CLS
GOSUB linefeed
hserout ["Clear screen"]
GOSUB linefeed
GOSUB linefeed
CC=0: Lc=0 : L=0 : Cx=0 : Tx=0
GOTO com
ENDIF
IF D(0)=67 THEN ' C?????? set callsign
CS[0]=D(1) : CS[1]=D(2) : CS[2]=D(3) : CS[3]=D(4) : CS[4]=D(5) : CS[5]=D(6)
GOSUB linefeed
hserout ["Set to ",CS(0),CS(1),CS(2),CS(3),CS(4),CS(5)]
GOSUB linefeed
GOSUB linefeed
GOTO com
ENDIF
IF D(0)=68 AND D(1)=67 THEN ' DC display callsign
GOSUB DC
GOSUB linefeed
hserout ["callsign"]
GOSUB linefeed
GOSUB linefeed
GOTO com
ENDIF
IF D(0)=84 AND D(1)=89 AND D(2)=80 AND D(3)=69 THEN ' TYPE keyboard mode
GOSUB linefeed
hserout ["Kybd mode"]
GOSUB linefeed
GOSUB linefeed
GOTO TYPE
ENDIF ' Font size=1
IF D(0)=72 AND D(1)=49 THEN
Sz=0
GOSUB linefeed
hserout ["size=1"]
GOSUB linefeed
GOSUB linefeed
ENDIF
IF D(0)=72 AND D(1)=50 THEN
Sz=1
GOSUB linefeed
hserout ["size=2"] ' Font size=2
GOSUB linefeed
GOSUB linefeed
ENDIF
IF D(0)=72 AND D(1)=51 THEN
Sz=2
GOSUB linefeed
hserout ["size=3"] ' Font size=3
GOSUB linefeed
GOSUB linefeed
ENDIF
IF D(0)=72 AND D(1)=52 THEN
Sz=3
GOSUB linefeed
hserout ["size=4"] ' Font size=4
GOSUB linefeed
GOSUB linefeed
ENDIF
IF D(0)=82 AND D(1)=68 THEN ' 82 and 68 is RD to read callsign
GOSUB linefeed
GOSUB Rdata
ENDIF
IF D(0)=87 AND D(1)=68 THEN ' 82 and 68 WD write data
GOSUB linefeed
GOSUB Memstore
hserout ["Writing data"]
GOSUB linefeed
GOSUB linefeed
GOTO com
ENDIF
IF D(0)=84 AND D(1)=73 AND D(2)=77 AND D(3)=69 THEN ' TIME display time on PC
GOSUB linefeed
hserout ["Time is"]
GOSUB linefeed
GOSUB linefeed
GOSUB PC_time
GOTO com
ENDIF
IF D(0)=68 AND D(1)=65 AND D(2)=84 AND D(3)=69 THEN ' DATE display time on PC
GOSUB linefeed
hserout ["Date is"]
GOSUB linefeed
GOSUB linefeed
GOSUB PC_date
GOTO com
ENDIF
IF D(0)=83 AND D(1)=84 THEN ' ST Set time format "hh:mm" enter to set
T10=D(2) : T1=D(3)
GOSUB Set_time
I2CWRITE Dpin,Cpin,$A2,$04,[Co]
T10=D(5) : T1=D(6)
GOSUB Set_time
I2CWRITE Dpin,Cpin,$A2,$03,[Co]
GOSUB linefeed
hserout [D(2),D(3),":",D(5),D(6)]
GOSUB linefeed
GOSUB linefeed
GOTO com
ENDIF
IF D(0)=83 AND D(1)=83 THEN ' SS Set seconds format "ss" enter to set
GOSUB linefeed
hserout [D(2),D(3)," secs"]
GOSUB linefeed
GOSUB linefeed
T10=D(2) : T1=D(3)
GOSUB Set_time
I2CWRITE Dpin,Cpin,$A2,$02,[Co]
GOTO com
ENDIF
IF D(0)=83 AND D(1)=68 THEN ' SD Set date format "dd/MM/YY" enter to set
T10=D(2) : T1=D(3)
GOSUB Set_time
I2CWRITE Dpin,Cpin,$A2,$05,[Co]
T10=D(5) : T1=D(6)
GOSUB Set_time
I2CWRITE Dpin,Cpin,$A2,$07,[Co]
T10=D(8) : T1=D(9)
GOSUB Set_time
I2CWRITE Dpin,Cpin,$A2,$08,[Co]
GOSUB linefeed
hserout [D(2),D(3),"/",D(5),D(6),"/",D(8),D(9)]
GOSUB linefeed
GOSUB linefeed
GOTO com
ENDIF
IF D(0)=83 AND D(1)=87 THEN ' SW Set week day format "w" enter to set
GOSUB linefeed
hserout [D(2)," day"]
GOSUB linefeed
GOSUB linefeed
T10=0 : T1=D(2)
GOSUB Set_time
I2CWRITE Dpin,Cpin,$A2,$06,[Co]
GOTO com
ENDIF
IF D(0)=68 AND D(1)=84 AND D(2)<>77 AND D(3)<>80 THEN ' DT Display time via video
J=0
GOSUB linefeed
hserout ["time"]
GOSUB linefeed
GOSUB linefeed
GOSUB v_time
ENDIF
IF D(0)=68 AND D(1)=68 THEN ' DD Display date via video
Cx=1
GOSUB linefeed
hserout ["date"]
GOSUB linefeed
GOSUB linefeed
GOSUB v_date
ENDIF
IF D(0)=68 AND D(1)=84 AND D(2)=77 AND D(3)=80 THEN ' DTMP display temperature via video
Tx=1
GOSUB linefeed
hserout ["Dis temp"]
GOSUB linefeed
GOSUB linefeed
GOSUB temp
ENDIF
IF D(0)=84 AND D(1)=69 AND D(2)=77 AND D(3)=80 THEN ' TEMP display temperature
GOSUB linefeed
hserout ["Temp is"]
GOSUB linefeed
GOSUB linefeed
GOSUB Tempcom
GOTO com
ENDIF
IF D(0)=72 AND D(1)=69 AND D(2)=76 AND D(3)=80 THEN ' HELP infomation
GOSUB linefeed
hserout ["CLS clear disp"]
GOSUB linefeed
hserout ["DC display callsign"]
GOSUB linefeed
hserout ["DTMP display temp"]
GOSUB linefeed
hserout ["DT dis time"]
GOSUB linefeed
hserout ["DD disp date"]
GOSUB linefeed
hserout ["H1,H2,H3,H4 font sizes 1x up to 4x"]
GOSUB linefeed
hserout ["TYPE keyboard text mode, video overlay"]
GOSUB linefeed
hserout ["TIME time on PC"]
GOSUB linefeed
hserout ["DATE date on PC"]
GOSUB linefeed
hserout ["TEMP display temp on PC"]
GOSUB linefeed
GOSUB linefeed
hserout ["Setup info"]
GOSUB linefeed
hserout ["RD read data"]
GOSUB linefeed
hserout ["WD write data"]
GOSUB linefeed
hserout ["C?????? set callsign"]
GOSUB linefeed
hserout ["SS set secs format 'ss'"]
GOSUB linefeed
hserout ["ST set time format 'hh:mm'"]
GOSUB linefeed
hserout ["SD set date format 'dd/MM/YY'"]
GOSUB linefeed
hserout ["SW set week day format 'w'"]
GOSUB linefeed
GOSUB linefeed
GOTO com
ENDIF
GOTO com_start
Rdata:
GOSUB linefeed
hserout ["Font size=",DEC Sz+1]
GOSUB linefeed
GOSUB Memread
GOSUB linefeed
hserout ["Callsign=",CS(0),CS(1),CS(2),CS(3),CS(4),CS(5)] ' Send message
GOSUB linefeed
GOSUB linefeed
GOSUB linefeed
rETURN
Memstore: ' Store Callsign
FOR C=0 TO 5
WRITE C,CS[C]
NEXT C
RETURN
Memread: ' Read Callsign
FOR C=0 TO 5
READ C,CS[C]
NEXT C
RETURN
DCLS: ' Clear the screen set to ' '
FOR C=0 TO 27
D[C]=32
NEXT C
RETURN
com1:
GOSUB DCLS
FOR NC=1 TO 28
Hserin 4000,com1,[echo] ' Get a echo from serial port
IF ECHO=13 THEN GOTO TYPE1
IF ECHO=9 THEN GOSUB Tabspace
IF ECHO=92 THEN
GOSUB CLS : CC=0: Lc=0 : L=0
GOTO com1 : ENDIF
IF ECHO=8 THEN
GOSUB Backspace : ENDIF
IF ECHO=27 THEN
GOSUB linefeed
hserout ["Exit"]
GOSUB linefeed
GOSUB linefeed
GOTO com : ENDIF
IF NC=1 THEN D(0)=ECHO ' Store last 28 ASCII digits
IF NC=2 THEN D(1)=ECHO
IF NC=3 THEN D(2)=ECHO
IF NC=4 THEN D(3)=ECHO
IF NC=5 THEN D(4)=ECHO
IF NC=6 THEN D(5)=ECHO
IF NC=7 THEN D(6)=ECHO
IF NC=8 THEN D(7)=ECHO
IF NC=9 THEN D(8)=ECHO
IF NC=10 THEN D(9)=ECHO
IF NC=11 THEN D(10)=ECHO
IF NC=12 THEN D(11)=ECHO
IF NC=13 THEN D(12)=ECHO
IF NC=14 THEN D(13)=ECHO
IF NC=15 THEN D(14)=ECHO
IF NC=16 THEN D(15)=ECHO
IF NC=17 THEN D(16)=ECHO
IF NC=18 THEN D(17)=ECHO
IF NC=19 THEN D(18)=ECHO
IF NC=20 THEN D(19)=ECHO
IF NC=21 THEN D(20)=ECHO
IF NC=22 THEN D(21)=ECHO
IF NC=23 THEN D(22)=ECHO
IF NC=24 THEN D(23)=ECHO
IF NC=25 THEN D(24)=ECHO
IF NC=26 THEN D(25)=ECHO
IF NC=27 THEN D(26)=ECHO
IF NC=28 THEN D(27)=ECHO
hserout [echo] ' Send echo out serial port
NEXT NC
Goto com1
Tabspace:
TAB=TAB+7
FOR C=1 TO 7
Echo=32
hserout [echo]
NEXT C
RETURN
Backspace:
NC=NC-1
IF NC<=1 THEN NC=1
LOOKUP2 Nc,[0,D(0),D(1),D(2),D(3),D(4),D(5),D(6),D(7),D(8),D(9),D(10),D(11),D(12),D(13),D(14),D(15),D(16),D(17),D(18),D(19),D(20),D(21),D(22),D(23),D(24),D(25),D(26),D(27)],Co
Co=Echo
hserout [echo]
Hserin 2000,com_start,[echo] ' Get a echo from serial port
IF ECHO=8 THEN GOTO Backspace
RETURN
DC: ' Display callsign
GOSUB DCLS
GOSUB Memread
FOR C=0 TO 5
AS=CS[C]
GOSUB Convert
D[C]=AS
NEXT C
X=1
GOSUB Display
X=0
RETURN
TYPE: ' Conversion for the video overlay
GOSUB linefeed
GOTO com1
TYPE1:
GOSUB linefeed
AS=D(0)
GOSUB Convert
D(0)=AS
AS=D(1)
GOSUB Convert
D(1)=AS
AS=D(2)
GOSUB Convert
D(2)=AS
AS=D(3)
GOSUB Convert
D(3)=AS
AS=D(4)
GOSUB Convert
D(4)=AS
AS=D(5)
GOSUB Convert
D(5)=AS
AS=D(6)
GOSUB Convert
D(6)=AS
AS=D(7)
GOSUB Convert
D(7)=AS
AS=D(8)
GOSUB Convert
D(8)=AS
AS=D(9)
GOSUB Convert
D(9)=AS
AS=D(10)
GOSUB Convert
D(10)=AS
AS=D(11)
GOSUB Convert
D(11)=AS
AS=D(12)
GOSUB Convert
D(12)=AS
AS=D(13)
GOSUB Convert
D(13)=AS
AS=D(14)
GOSUB Convert
D(14)=AS
AS=D(15)
GOSUB Convert
D(15)=AS
AS=D(16)
GOSUB Convert
D(16)=AS
AS=D(17)
GOSUB Convert
D(17)=AS
AS=D(18)
GOSUB Convert
D(18)=AS
AS=D(19)
GOSUB Convert
D(19)=AS
AS=D(20)
GOSUB Convert
D(20)=AS
AS=D(21)
GOSUB Convert
D(21)=AS
AS=D(22)
GOSUB Convert
D(22)=AS
AS=D(23)
GOSUB Convert
D(23)=AS
AS=D(24)
GOSUB Convert
D(24)=AS
AS=D(25)
GOSUB Convert
D(25)=AS
AS=D(26)
GOSUB Convert
D(26)=AS
AS=D(27)
GOSUB Convert
D(27)=AS
GOSUB Display
GOTO com1
Convert: ' Convert from ACSII to TROM data of the STV5730A
IF AS>=48 AND AS<=57 THEN
AS=AS-48
RETURN
ENDIF
IF AS>=65 AND AS<=90 THEN
AS=AS-53
RETURN
ENDIF
IF AS>=97 AND AS<=122 THEN
AS=AS-55
RETURN
ENDIF
IF AS>=46 AND AS<=47 THEN
AS=AS-7
RETURN
ENDIF
IF AS=45 THEN
AS=$A
RETURN
ENDIF
IF AS=32 THEN
AS=$B
RETURN
ENDIF
IF AS=34 THEN
AS=$6F
RETURN
ENDIF
IF AS=58 THEN
AS=$26
RETURN
ENDIF
IF AS=39 THEN
AS=$29
RETURN
ENDIF
IF AS=42 THEN
AS=$5F
RETURN
ENDIF
IF AS=43 THEN
AS=$5E
RETURN
ENDIF
IF AS=63 THEN
AS=$70
RETURN
ENDIF
IF AS=60 THEN
AS=$7B
RETURN
ENDIF
IF AS=62 THEN
AS=$7A
RETURN
ENDIF
IF AS=94 THEN
AS=$7C
RETURN
ENDIF
IF AS=124 THEN
AS=$7D
RETURN
ENDIF
IF AS=35 THEN
AS=$6E
RETURN
ENDIF
IF AS=36 THEN
AS=$71
RETURN
ENDIF
IF AS=37 THEN
AS=$79
RETURN
ENDIF
IF AS=64 THEN
AS=$45
RETURN
ENDIF
IF AS=61 THEN
AS=$78
ELSE
AS=$B
ENDIF
RETURN
Display: ' Font size 1 to 4
IF Sz=0 THEN GOSUB Size_1
IF Sz=1 THEN GOSUB Size_2
IF Sz=2 THEN GOSUB Size_3
IF Sz=3 THEN GOSUB Size_4
RETURN
Size_1:
wData=L+tab
gosub Send
IF X=0 THEN
J=27
ELSE
J=5
ENDIF
FOR C=0 TO J
LOOKUP2 c,[D(0),D(1),D(2),D(3),D(4),D(5),D(6),D(7),D(8),D(9),D(10),D(11),D(12),D(13),D(14),D(15),D(16),D(17),D(18),D(19),D(20),D(21),D(22),D(23),D(24),D(25),D(26),D(27)],Co
wData=$1300+Co
gosub Send
NEXT C
L=L+$100
IF L=$B00 THEN L=0
TAB=0
RETURN
Size_2:
wData=L+tab
gosub Send
FOR C=0 TO 13
LOOKUP2 c,[D(0),D(1),D(2),D(3),D(4),D(5),D(6),D(7),D(8),D(9),D(10),D(11),D(12),D(13)],Co
wData=$1300+Co
gosub Send
NEXT C
L=L+$100
IF L=$600 THEN L=0
TAB=0
RETURN
Size_3:
wData=L+tab
gosub Send
FOR C=0 TO 9
LOOKUP2 c,[D(0),D(1),D(2),D(3),D(4),D(5),D(6),D(7),D(8),D(9)],Co
wData=$1300+Co
gosub Send
NEXT C
L=L+$100
IF L=$400 THEN L=0
TAB=0
RETURN
Size_4:
wData=L+tab
gosub Send
FOR C=0 TO 6
LOOKUP2 c,[D(0),D(1),D(2),D(3),D(4),D(5),D(6)],Co
wData=$1300+Co
gosub Send
NEXT C
L=L+$100
IF L=$300 THEN L=0
TAB=0
RETURN
linefeed:
hserout [13,10]
return
Bookmarks