home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d01xx
/
d0144.lha
/
AnalytiCalc
/
AnalySources.Arc
/
AnalASM.Ftn
< prev
next >
Wrap
Text File
|
1987-11-08
|
7KB
|
219 lines
c AnalytiCalc Amiga specific terminal I/O routines.
c note ttyini is also special and opens console window...
Subroutine SWRT(ibuf,isz)
c write isz bytes from ibuf onto console window
Include dos.inc
Integer*4 Isz,i
Integer*4 Amiga
External Amiga
C common/consfh/fh
CHARACTER*1 OARRY(100)
InTeGer*4 OSWIT,OCNTR
C COMMON/OAR/OSWIT,OCNTR,OARRY
C COMMON OAR SWITCHES OUTPUT OFF IF OSWIT=2
InTeGer*4 IPS1,IPS2,MODFLG
C COMMON/ICPOS/IPS1,IPS2,MODFLG
InTeGer*4 XTCFG,IPSET,XTNCNT
CHARACTER*1 XTNCMD(80)
C COMMON/XCMD/XTNCNT,XTNCMD,XTCFG,IPSET
C VARY FLAG ITERATION COUNT
INTEGER KALKIT
C COMMON/VARYIT/KALKIT
InTeGer*4 FORMFG,RCFGX,PZAP,RCONE
InTeGer*4 RCMODE,IRCE1,IRCE2
C COMMON/FFGG/FORMFG,RCFGX,PZAP,RCONE,RCMODE,IRCE1,
C 1 IRCE2
C FORMFG FLAGS FORMAT OF DISPLAY GLOBALLY
C RCFGX FLAGS WHETHER TO DO AUTO RECALCULATION. IF 1, INHIBITS
C AUTO RECALC (USE R COMMAND TO DO A CALC.). 17 COMMAND TURNS
C RCFGX ON.
C PZAP CONTROLS WHETHER TO REDRAW SCREEN. IF ZERO, NORMAL. IF 1
C (NONZERO ANYHOW), INHIBITS RE DISPLAY. V COMMAND RESETS TO 0
C AND VM INHIBITS. (SETS TO 1).
INTEGER*4 FH
C FILE HANDLE FOR CONSOLE I/O (RAW)
C COMMON/CONSFH/FH
CHARACTER*1 ARGSTR(52,4)
C COMMON/ARGSTR/ARGSTR
COMMON/XVXTCD/OSWIT,OCNTR,OARRY,IPS1,IPS2,MODFLG,
1 XTNCNT,XTNCMD,XTCFG,IPSET,KALKIT,
2 FORMFG,RCFGX,PZAP,RCONE,RCMODE,IRCE1,
3 IRCE2,FH,ARGSTR
If(fh.ne.0)I=amiga(Write,fh,ibuf,isz)
return
end
Subroutine ttyin(IIMODE,line)
c read 132 char line off console
C iimode=0 in Command-Mostly mode, 1 in Enter mostly mode.
Integer*4 iact,n,IIMODE
include dos.inc
Integer*4 Amiga
External Amiga
C common/consfh/fh
CHARACTER*1 OARRY(100)
InTeGer*4 OSWIT,OCNTR
C COMMON/OAR/OSWIT,OCNTR,OARRY
C COMMON OAR SWITCHES OUTPUT OFF IF OSWIT=2
InTeGer*4 IPS1,IPS2,MODFLG
C COMMON/ICPOS/IPS1,IPS2,MODFLG
InTeGer*4 XTCFG,IPSET,XTNCNT
CHARACTER*1 XTNCMD(80)
C COMMON/XCMD/XTNCNT,XTNCMD,XTCFG,IPSET
C VARY FLAG ITERATION COUNT
INTEGER KALKIT
C COMMON/VARYIT/KALKIT
InTeGer*4 FORMFG,RCFGX,PZAP,RCONE
InTeGer*4 RCMODE,IRCE1,IRCE2
C COMMON/FFGG/FORMFG,RCFGX,PZAP,RCONE,RCMODE,IRCE1,
C 1 IRCE2
C FORMFG FLAGS FORMAT OF DISPLAY GLOBALLY
C RCFGX FLAGS WHETHER TO DO AUTO RECALCULATION. IF 1, INHIBITS
C AUTO RECALC (USE R COMMAND TO DO A CALC.). 17 COMMAND TURNS
C RCFGX ON.
C PZAP CONTROLS WHETHER TO REDRAW SCREEN. IF ZERO, NORMAL. IF 1
C (NONZERO ANYHOW), INHIBITS RE DISPLAY. V COMMAND RESETS TO 0
C AND VM INHIBITS. (SETS TO 1).
INTEGER*4 FH
Character*1 wrkchr,lstchr
Integer*4 iescst
C FILE HANDLE FOR CONSOLE I/O (RAW)
C COMMON/CONSFH/FH
CHARACTER*1 ARGSTR(52,4)
C COMMON/ARGSTR/ARGSTR
COMMON/XVXTCD/OSWIT,OCNTR,OARRY,IPS1,IPS2,MODFLG,
1 XTNCNT,XTNCMD,XTCFG,IPSET,KALKIT,
2 FORMFG,RCFGX,PZAP,RCONE,RCMODE,IRCE1,
3 IRCE2,FH,ARGSTR
character*1 line(132)
InTeGer*4 RRWACT,RCLACT
C COMMON/RCLACT/RRWACT,RCLACT
InTeGer*4 idol1,idol2,idol3,idol4,idol5,idol6,
1 IDOL7,IDOL8
C common/dollr/idol1,idol2,idol3,idol4,idol5,idol6,
C 1 IDOL7,IDOL8
InTeGer*4 PROW,PCOL,DROW,DCOL,DRWV,DCLV,LLCMD,LLDSP
C COMMON/DCTL/PROW,PCOL,DROW,DCOL,DRWV,DCLV
InTeGer*4 IPGMAX,LPGMXF,IPGMOD,LPGMOD
C COMMON/FILEMX/IPGMAX,LPGMXF,IPGMOD,LPGMOD
C LENGTHS (IN K) OF FILES FOR VALUES OR FORMULAS ARE IPGMAX,LPGMXF
C IPGMOD AND LPGMOD CONTROL PACKING MODE IN THE CORRESPONDING FILES
InTeGer*4 KLVL
C COMMON/KLVL/KLVL
InTeGer*4 IOLVL,IGOLD
C COMMON/IOLVL/IOLVL
C IOLVL IS LUN FOR XQTCMD TO USE (NORMALLY 3 FOR INDIRECT FILES OR 5
C FOR TERMINAL. WE USE 5,6 FOR TERMINAL INPUT, OUTPUT NORMALLY.
COMMON/RDD/RRWACT,RCLACT,idol1,idol2,idol3,idol4,idol5,idol6,
1 IDOL7,IDOL8,PROW,PCOL,DROW,DCOL,DRWV,DCLV,LLCMD,LLDSP,
2 IPGMAX,LPGMXF,IPGMOD,LPGMOD,KLVL,IOLVL,IGOLD
Integer*4 Kone
Character*1 xlf
CCC InTeGer*4 LLCMD,LLDSP
CCC InTeGer*4 PROW,PCOL,DROW,DCOL,DRWV,DCLV
CCC COMMON/DCTL/PROW,PCOL,DROW,DCOL,DRWV,DCLV,LLCMD,LLDSP
xlf=char(10)
iescst=0
Kone=1
wrkchr=char(0)
c initially, no ESC seen
c Set up to read raw: device OK.
c If we see an ESC character then look for either a return
c (to terminate in any case) or some character whose value is
c greater than 64. However ESC O will be passed and the scan will
c continue.
C implement deletion of last character also with DEL or with
C backspace keys
c
c Initially zero entire buffer so we later can find length via looking
c for anything non-zero. Also serves to put in terminators for things
c like the INDX function to prevent them from running on indefinitely.
do 1 n=1,132
1 line(n)=char(0)
c if mode 0, (command mostly) then / is NOT special
if(fh.eq.0)goto 1000
c Here begin the read loop
n=1
4000 continue
lstchr=wrkchr
wrkchr=char(0)
C zero wrkchr for safety
iact=amiga(Read,fh,wrkchr,Kone)
If(Iact.le.0)goto 4000
If(ichar(wrkchr).eq.0)goto 4000
CCC Add this to just read the line
CC iact=amiga(Read,fh,line,132)
4050 Continue
If(ichar(wrkchr).ne.8.and.ichar(wrkchr).ne.127)goto 4100
C back up a character and try again
c Last char was backspace or DEL, so back up by one, echo backspace.
n=max0(1,(n-1))
lstchr=char(8)
C echo a backspace
C 8 is ASCII backspace...
ii=Amiga(Write,fh,Lstchr,Kone)
Goto 4000
4100 Continue
c C.R. is 13, LF is 10, FF is 14, so terminate on any of these
c traditional line terminators.
If(ichar(wrkchr).lt.16)goto 5000
c Normal character, just echo it.
ii=Amiga(Write,fh,wrkchr,kone)
c echo the character back
c Then store it.
line(n)=wrkchr
n=min0(n+1,131)
if(ichar(wrkchr).eq.27.or.ichar(Wrkchr).eq.155)iescst=1
c <ESC>O is actually an escape sequence initiator
If(iescst.eq.1.and.wrkchr.eq.'O'.and.ichar(lstchr)
1 .eq.27) goto 4200
c Otherwise an escape sequence ends in a letter
If(Iescst.eq.0)goto 4200
ii=ichar(wrkchr)
If(ii.eq.91)goto 4200
c 91 is ascii for [
If(ii.gt.64.and.ii.lt.127)Return
C terminate read at end of any escape sequence
c from A to z except [ are possible esc seq delimiters.
4200 Continue
c The above condition terminates an ESC sequence after ESC and any other
c characters followed by (and including) any character greater than 'A'
c which should take care of just about every ANSI escape sequence.
if(n.lt.131)goto 4000
c Terminate even if we never get C.R. but not 'till we've got
c all there is to get...
Return
5000 continue
c Echo line terminator
line(n)=wrkchr
ii=Amiga(Write,fh,wrkchr,kone)
If(ichar(wrkchr).eq.13)ii=Amiga(Write,fh,xlf,Kone)
c echo lf after cr
c done reading now.
Return
1000 Continue
C fakeout fallback position, reading workbench window
Read(*,1500)line
1500 format(132a1)
return
end
subroutine swset(i)
integer*4 i
c dummy setup sub
return
end
subroutine exitqq
c exit routine ... just do fortran stop to make it complete
stop "AnalytiCalc exiting..."
end
subroutine system(line)
include dos.inc
c execute an amigados command
integer*4 inp,outp
character*80 line
logical*4 succ
Logical*4 Amiga
External Amiga
succ=amiga(Execute,line(1:80),inp,outp)
return
end