home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
pocketbk
/
comms
/
freevt04
/
FREEVT.OPL
< prev
next >
Wrap
Text File
|
1995-04-25
|
12KB
|
623 lines
APP freevt
type $1003
path "\fvt"
ext "fvt"
icon "\opd\freevt.pic"
ENDA
PROC freevt:
global col%,row%,w1%,w2%,scrs%,scre%,stat%
global baud%,datab%,pari%,sbit%,hs1%,hs2%,hs3%,hs4%,hsa%(8),proto%
global backs%,enter%,mini$(21),mhang$(21),mdiap$(21),mdias$(21),mcon$(21)
local f%,s%,ta%,p$(2),t$(4),lit$(80),address%,alen%
local li$(80)
cache 5000,7000
cls
rem Init of global parameters
hsa%(1)=0 :rem RTS/CTS
hsa%(2)=3 :rem XON/XOFF+RTS/CTS
hsa%(3)=4 :rem NONE
hsa%(4)=7 :rem XON/XOFF
hsa%(5)=8 :rem RTS/CTS+DTR/DSR
hsa%(6)=11:rem ALL
hsa%(7)=12:rem DTR/DSR
hsa%(8)=15:rem DTR/DSR+XON/XOFF
col%=1 :rem startcolumn
row%=1 :rem startrow
scrs%=1 :rem start default scrollingregion
scre%=25:rem end
baud%=16:rem baudrate (=19200)
pari%=0 :rem parity (=none)
datab%=8:rem databits
sbit%=1 :rem stopbits
hs1%=2 :rem 4 params. for handshake
hs2%=1 :rem at this stage only hs1% is used
hs3%=1
hs4%=1
proto%=6:rem defaultprotocoll (=YModem)
backs%=8:rem BS sends BS, not DEL
enter%=13:rem enter sends CR, not LF
mini$="ATZ~"
mhang$="ATH0~"
mdiap$="ATDT"
mdias$="~"
mcon$="CONNECT"
lopen "TTY:A"
rsset:(baud%,pari%,datab%,sbit%,11,&FFFFFFFE)
w1%=gcreate(0,0,479,150,1,0)
w2%=gcreate(0,151,479,9,1,0)
guse w1%
gfont 13:gstyle 0
gat 0,5
cursor w1%
guse w2%
gat 0,0
glineto 479,0
gfont 4:gstyle 4
gat 0,8:gprint " FreeVT V0.4 "
gat 0,8
glineto 479,8
if cmd$(2)<>""
if exist(cmd$(2))
loadp:(cmd$(2))
endif
endif
pstat:
guse w1%
gupdate off
do
t$=""
ta%=key
if (ta%<255) and (ta%>0)
t$=chr$(ta%)
endif
li$=lreadl$:
if li$<>""
p$=right$(li$,1)
if asc(p$)<32
li$=left$(li$,len(li$)-1)
endif
endif
if li$<>""
mat:(col%,row%)
if (col%+len(li$))>81
lit$=left$(li$,81-col%)
li$=right$(li$,len(li$)-(81-col%))
gprintb lit$,(6*len(lit$))
col%=1
row%=row%+1
if row%>25
gscroll 0,-6
row%=25
endif
mat:(col%,row%)
endif
gprintb li$,len(li$)*6
col%=col%+len(li$)
endif
if p$<>""
if asc(p$)<32
if p$=chr$(27)
intervt:
elseif p$=chr$(13)
col%=1
elseif p$=chr$(10)
row%=row%+1
elseif p$=chr$(9)
col%=((((col%-1)/8)+1)*8)+1
elseif p$=chr$(8)
backsp:
elseif p$=chr$(7)
beep 5,300
endif
else
if p$=chr$(127)
delete:
endif
endif
mat:(col%,row%)
p$=""
endif
if col%<1
col%=1
elseif col%>81
col%=1
row%=row%+1
endif
if row%<1
row%=1
elseif row%>25
gscroll 0,-6
row%=25
endif
if ta%>255
if ta%>255 and ta%<260
t$=chr$(27)+"["+chr$(ta%-191)
elseif ta%=290
vtmenu:(0)
elseif ta%>512 and ta%<768 and ta%<>632
if kmod=10
ta%=ta%-(%a-%A)
endif
vtmenu:(ta%)
endif
endif
if t$<>""
if t$=chr$(8)
t$=chr$(backs%)
elseif t$=chr$(13)
t$=chr$(enter%)
endif
alen%=len(t$)
ioa(-1,2,stat%,#uadd(addr(t$),1),alen%)
iosignal
endif
until (ta%=632)
lclose
ENDP
PROC intervt:
local i$(2),vs$(40),t$(10),px%,py%,m%,ti%
ti%=second
ti%=ti%+2
if ti%>60
ti%=ti%-60
endif
vs$=""
do
i$=lread$:
if i$<>""
vs$=vs$+i$
endif
until (i$<>"") and (loc("RSnHrqxCDABfhlIEu=)mgKJPLMic>",i$)) or ti%=second
if vs$="[J"
gscroll 0,(26-row%)*6,0,row%*6,479,(26-row%)*6
gat (col%-1)*6,(row%*6)-1
gprintb "",((81-col%)*6)
gat (col%-1)*6,(row%*6)-1
elseif vs$="[1J"
gscroll 0,-6*(row%-1),0,0,479,6*(row%-1)
gat 0,((row%*6)-1)
gprintb "",((col%-1)*6)
gat (col%-1)*6,(row%*6)-1
elseif vs$="[2J"
gcls
col%=1
row%=1
elseif vs$="[7m"
gstyle 4
elseif vs$="[4m"
gstyle 2
elseif vs$="[m"
gstyle 0
elseif left$(vs$,1)="[" and right$(vs$,1)="A"
if (len(vs$)-2)>0
t$=mid$(vs$,2,len(vs$)-2)
row%=row%-val(t$)
else
row%=row%-1
endif
if row%<1
row%=1
endif
elseif left$(vs$,1)="[" and right$(vs$,1)="B"
if (len(vs$)-2)>0
t$=mid$(vs$,2,len(vs$)-2)
row%=row%+val(t$)
else
row%=row%+1
endif
if row%>25
row%=25
endif
elseif left$(vs$,1)="[" and right$(vs$,1)="C"
if (len(vs$)-2)>0
t$=mid$(vs$,2,len(vs$)-2)
col%=col%+val(t$)
else
col%=col%+1
endif
if col%>80
col%=80
endif
elseif left$(vs$,1)="[" and right$(vs$,1)="D"
if (len(vs$)-2)>0
t$=mid$(vs$,2,len(vs$)-2)
col%=col%-val(t$)
else
col%=col%-1
endif
if col%<1
col%=1
endif
elseif left$(vs$,1)="[" and ((right$(vs$,1)="f") or (right$(vs$,1)="H"))
vs$=mid$(vs$,2,len(vs$)-2)
m%=loc(vs$,";")
if m%=0
col%=1
row%=1
else
if m%>1
row%=val(left$(vs$,(m%-1)))
if row%<1
row%=1
endif
elseif m%=1
row%=1
endif
if m%<len(vs$)
col%=val(right$(vs$,len(vs$)-m%))
if col%<1
col%=1
endif
endif
endif
elseif vs$="[K"
gat (col%-1)*6,(row%*6)-1
gprintb "",((81-col%)*6)
gat (col%-1)*6,(row%*6)-1
elseif vs$="[1K"
gat 0,((row%*6)-1)
gprintb "",((col%-1)*6)
gat (col%-1)*6,(row%*6)-1
elseif vs$="[2K"
gat 0,((row%*6)-1)
gprintb "",(80*6)
gat (col%-1)*6,(row%*6)-1
elseif left$(vs$,1)="[" and right$(vs$,1)="L"
py%=1
if left$(vs$,1)="[" and len(vs$)>2
vs$=mid$(vs$,2,len(vs$)-2)
py%=val(vs$)
endif
gscroll 0,py%*6,0,(row%*6)-1,479,(scre%*6)-((row%*6)-1)
elseif left$(vs$,1)="[" and right$(vs$,1)="r"
vs$=mid$(vs$,2,len(vs$)-2)
if vs$<>"" and loc(vs$,";")
m%=loc(vs$,";")
scrs%=val(left$(vs$,m%-1))
scre%=val(right$(vs$,len(vs$)-m%))
if scrs%>25
scrs%=25
elseif scrs%<1
scrs%=1
endif
if scre%>25
scre%=25
elseif scre%<1
scre%=1
endif
endif
elseif vs$="D"
row%=row%+1
if row%>scre%
row%=scre%
gscroll 0,-6,0,scrs%*6,479,(scre%*6)-(scrs%*6)
endif
elseif vs$="M"
row%=row%-1
if row%<scrs%
row%=scrs%
gscroll 0,6,0,(scrs%-1)*6,479,(scre%*6)-(scrs%*6)
endif
elseif vs$="E"
row%=row%+1
if row%>25
gscroll 0,-6
row%=25
endif
elseif vs$="c"
guse w1%
gcls
row%=1
col%=1
mat:(col%,row%)
gstyle 0
scrs%=1
scre%=25
cursor w1%
elseif vs$="[?25l" or vs$="[?50l"
cursor off
elseif vs$="[?25h" or vs$="[?50h"
cursor w1%
endif
ENDP
PROC delete:
col%=col%-1
if col%<1
col%=80
row%=row%-1
if row%<1
row%=1
col%=1
endif
endif
mat:(col%,row%)
ENDP
PROC backsp:
col%=col%-1
if col%<1
col%=80
row%=row%-1
if row%<1
row%=1
col%=1
endif
endif
mat:(col%,row%)
ENDP
PROC mat:(col%,row%)
gat ((col%-1)*6),((row%*6)-1)
ENDP
PROC lread$:
local err%,len%,bl%,buf$(2)
err%=iow(-1,10,len%,bl%)
if len%<>0 and not err%
err%=ioread(-1,uadd(addr(buf$),1),1)
pokeb addr(buf$),1
else
buf$=""
endif
return buf$
ENDP
PROC lreadl$:
local err%,len%,bl%,buf$(80)
err%=iow(-1,10,len%,bl%)
buf$=""
if err%>=0
if len%>79
len%=79
endif
if len%>0
err%=iow(-1,1,#uadd(addr(buf$),1),len%)
pokeb addr(buf$),len%
else
buf$=""
gupdate on
gupdate off
endif
endif
return buf$
ENDP
PROC vtmenu:(ta%)
local men%,ho$(10),fi$(128),tmp&,tmp2&
ho$="lsxcrSRPph"
if ta%=0
minit
mcard "File","Load settings",%l,"Save settings",-%s,"Exit",%x
mcard "Display","Clear screen",%c,"Reset terminal",%r
mcard "Transfer","Send",%S,"Receive",%R,"Protocoll",%P
mcard "Options","Port",%p,"Handshake",%h,"Translations",%T
mcard "Modem","Hangup",%H,"Initialize",%I,"Dial",%D,"Setup",%U
men%=menu
else
men%=ta%-512
endif
if men%=%c
gcls
row%=1
col%=1
mat:(col%,row%)
elseif men%=%p
pari%=pari%+1
datab%=datab%-7
dinit "Port"
dchoice baud%,"Speed:","50,75,110,134,150,300,600,1200,1800,2000,2400,3600,4800,7200,9600,19200"
dchoice datab%,"Databits:","8,7,6,5"
dchoice pari%,"Parity:","None,Even,Odd"
dchoice sbit%,"Stopbits:","1,2"
dialog
pari%=pari%-1
datab%=9-datab%
rsset:(baud%,pari%,datab%,sbit