home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
tbsource.lha
/
TBSource
/
ShellTerm
/
STv1.09.S
< prev
Wrap
Text File
|
1993-12-21
|
57KB
|
2,854 lines
*************************************************
* *
* (C)opyright 1992 *
* *
* by Tomi Blinnikka *
* *
* Don´t try to understand the code *
* *
* Version 0.01 28/05/1992 *
* -0.99ö *
* *
* Version 1.00 04/08/1992 *
* *
* BUGS: Lots! No phonebook. *
* *
* Version 1.01 05/08/1992 *
* *
* BUGS: Some. Dialer problems. *
* *
* Version 1.02 06/08/1992 *
* *
* BUGS: Less. Still dialer problems. *
* *
* Version 1.03 08/08/1992 *
* *
* BUGS: *
* *
* Version 1.04 11/08/1992 *
* *
* Released *
* *
* BUGS: Send CTRL-P didn't work *
* *
* Version 1.05 15/08/1992 *
* *
* Version 1.06 28/08/1992 *
* *
* Added prefs file and swap BS & DEL *
* See docs for more info *
* *
* Version 1.07 30/08/1992 *
* *
* Version 1.08 04/09/1992 *
* *
* Added cursor remap *
* *
* Version 1.09 06/09/1992 *
* *
*************************************************
INCLUDE "JMPLibs.i"
INCLUDE "exec/types.i"
INCLUDE "exec/nodes.i"
INCLUDE "exec/lists.i"
INCLUDE "exec/ports.i"
INCLUDE "exec/memory.i"
INCLUDE "exec/devices.i"
INCLUDE "exec/io.i"
INCLUDE "exec/tasks.i"
INCLUDE "libraries/dosextens.i"
INCLUDE "libraries/dos.i"
INCLUDE "devices/serial.i"
INCLUDE "XREF:2.0.xref"
INCLUDE "XREF:exec.xref"
INCLUDE "XREF:dos.xref"
CTRL_B: EQU 2
CTRL_F: EQU 6
BS: EQU 8
TAB: EQU 9
LF: EQU 10
CR: EQU 13
CTRL_N: EQU $E
CTRL_O: EQU $F
CTRL_P: EQU $10
DEL: EQU 127
CSI: EQU $9B
Cursor_Up: EQU 'A'
Cursor_Down: EQU 'B'
Cursor_Left: EQU 'D'
Cursor_Right: EQU 'C'
MENU_KEY: EQU CTRL_P
STATS_KEY: EQU CTRL_O
FALSE: EQU 0
TRUE: EQU 1
BUFLEN: EQU 1024
ENTRYLENGTH: EQU 20
section ST,CODE
push d2-d7/a2-a6
push d0/a0
openlib Dos,NoDos ;Keep at beginning
CLIStart: lib Dos,Output
move.l d0,_stdout
lib Dos,Input
move.l d0,_stdin
move.l d0,d1
lib Dos,IsInteractive
tst.l d0
beq NotInteractive
pull d0/a0
clr.b -1(a0,d0.l)
cmp.b #'?',(a0)
beq Usage
cmp.w #'-?',(a0)
beq Usage
cmp.w #'-h',(a0)
beq Usage
tst.b (a0)
beq Cont1.3
Cont1: lea.l FileNameBuf1,a1
move.l a1,a2
add.l #128,a2
Cont1.1: tst.b (a0)
beq Cont1.2
cmp.b #' ',(a0)
beq Cont1.2
cmp.b #TAB,(a0)
beq Cont1.2
cmp.b #LF,(a0)
beq Cont1.2
cmp.b #CR,(a0)
beq Cont1.2
move.b (a0)+,(a1)+
cmp.l a1,a2
bne Cont1.1
Cont1.2: clr.b (a1)
Cont1.3:
;Create read reply port for serial.device (or modem0.device etc.)
MainStart: openlib Utility,NoUtility ;Keep at beginning
lib Exec,CreateMsgPort
move.l d0,SRRPort
beq NoMsgPort
;Create read IOReq for serial.device (or for other device, but size is EXTSER)
move.l #IOEXTSER_SIZE,d0
move.l SRRPort,a0
lib Exec,CreateIORequest
move.l d0,IORRequest
beq NoIOReq
move.l IORRequest,a1
move.w #CMD_READ,IO_COMMAND(a1)
or.b #IOF_QUICK,IO_FLAGS(a1)
lea.l Buffer3,a0
move.l a0,IO_DATA(a1)
move.l #1,IO_LENGTH(a1)
;Create write reply port for serial.device (or modem0.device etc.)
lib Exec,CreateMsgPort
move.l d0,SWRPort
beq NoMsgPort
;Create write IOReq for serial.device (or for other device, but size is EXTSER)
move.l #IOEXTSER_SIZE,d0
move.l SWRPort,a0
lib Exec,CreateIORequest
move.l d0,IOWRequest
beq NoIOReq
bsr LoadPrefsFile
bsr OpenSerial
tst.l d0
bne ShutDown
lea.l StartText1,a0
bsr Printer
;Change mode for CLI to RAW:
move.l _stdin,d1
move.l #TRUE,d2
lib Dos,SetMode
;Flush extra text
move.l _stdin,d1
lib Dos,Flush
Looper: move.l _stdin,d1
move.l #5000,d2
lib Dos,WaitForChar
tst.l d0
beq Looper1
move.l _stdin,d1
lea.l Buffer1,a0
move.l a0,d2
move.l #1,d3
lib Dos,Read
cmp.b #MENU_KEY,Buffer1
beq Menu
move.b CPAssign,d0
cmp.b Buffer1,d0
beq DoCTRL_P2
bsr DoCLIInput
Looper1: move.l #BUFLEN,d0
move.l #1,d1
bsr Read
tst.l d0
beq Looper
lea.l Buffer3,a0
clr.b 0(a0,d0.l) ;null terminated, please!
bsr DoSerialInput
move.l _stdout,d1
lea.l Buffer4,a1
bsr GetLength
move.l d0,d3
lea.l Buffer4,a0
move.l a0,d2
lib Dos,Write
bsr DoCapture
bra Looper
Menu: bsr DoANSI
lea.l MenuText1,a0
bsr Printer
Menu1: move.l _stdin,d1
lib Dos,FGetC
cmp.l #-1,d0
beq ShutDown
cmp.l #'a',d0
bcs Menu2
cmp.l #'z',d0
bhi Menu2
sub.l #32,d0
Menu2: cmp.l #'P',d0
beq Prefs
cmp.l #'S',d0
beq DoStats
cmp.l #'C',d0
beq ClearBoth
cmp.l #'D',d0
beq Dialer
cmp.l #'B',d0
beq DoBreak
cmp.l #'O',d0
beq DoCTRL_P
cmp.l #'F',d0
beq ResetFont
cmp.l #'X',d0
beq ClearScreen
cmp.l #'R',d0
beq DoReset
cmp.l #'H',d0
beq DoHangUp
cmp.l #'L',d0
beq DoOpenCapture
cmp.l #'K',d0
beq DoCloseCapture
cmp.l #'+',d0
beq DoUpLoad
cmp.l #'-',d0
beq DoDownLoad
cmp.l #'?',d0
beq DoInfo
cmp.l #'Q',d0
beq Quit
cmp.l #'E',d0
beq Exit1
bra Menu1
Exit1: lea.l ExitText1,a0
bsr Printer
bra Looper1
ResetFont: lea.l ResetFText1,a0
bsr Printer
lea.l PlainText1,a0
bsr Printer
bra Menu
ClearScreen: lea.l ClearSText1,a0
bsr Printer
bra Exit
DoANSI: tst.b UseANSI
beq DoANSI_OUT
lea.l ClearSText1,a0
bsr Printer
DoANSI_OUT: rts
DoStats: lea.l StatsText2,a0
bsr Printer
bsr DoANSI
bsr GiveStats
bsr GetAnyKey
bra Menu
ClearBoth: lea.l ClearText1,a0
bsr Printer
clr.l Received
clr.l Sent
bra Menu
DoBreak: bsr SendBREAK
lea.l BreakText2,a0
bsr Printer
bra Exit
DoCTRL_P: move.b #CTRL_P,Buffer1
bsr Writer
lea.l CTRL_PText1,a0
bsr Printer
add.l #1,Sent
bra Exit
DoCTRL_P2: move.b #CTRL_P,Buffer1
bsr Writer
add.l #1,Sent
bra Looper
DoReset: lea.l ResetText1,a0
bsr Printer
lea.l ResetText2,a1
bsr GetLength
lea.l ResetText2,a0
bsr Writer2
bra Exit
DoHangUp: lea.l HangUpText1,a0
bsr Printer
move.l #3*50,d1
lib Dos,Delay
lea.l HangUpText2,a1
bsr GetLength
lea.l HangUpText2,a0
bsr Writer2
move.l #2*55,d1
lib Dos,Delay
lea.l HangUpText3,a1
bsr GetLength
lea.l HangUpText3,a0
bsr Writer2
bra Exit
DoOpenCapture: lea.l OpenCaptureText1,a0
bsr Printer
tst.l CaptureFile
bne DoOpenCapture_ERR2
lea.l FileNameBuf2,a0
move.l #128,d3
bsr GetString
tst.b FileNameBuf2
beq DoOpenCapture_OUT
lea.l FileNameBuf2,a0
move.l a0,d1
move.l #MODE_READWRITE,d2
lib Dos,Open
move.l d0,CaptureFile
beq DoOpenCapture_ERR1
DoOpenCapture_OUT: bra Menu
DoOpenCapture_ERR1: lea.l CaptureErrorText1,a0
bsr Printer
bra Menu
DoOpenCapture_ERR2: lea.l CaptureErrorText2,a0
bsr Printer
bra Menu
DoCloseCapture: lea.l CloseCaptureText1,a0
bsr Printer
move.l CaptureFile,d1
beq DoCloseCapture
lib Dos,Close
clr.l CaptureFile
DoCloseCapture_OUT: bra Menu
DoUpLoad: lea.l ULText2,a0
bsr Printer
lea.l ULProgram,a0
tst.b (a0)
beq DoUpLoad9
lea.l FileNameBuf2,a0
move.l #128,d3
bsr GetString
bsr MakeCmdString
tst.b ULDir
beq DoUpLoad1
lea.l ULDir,a0
move.l a0,d1
move.l #ACCESS_READ,d2
lib Dos,Lock
move.l d0,ULLock
bne DoUpLoad2
DoUpLoad1: lea.l NoULDirText1,a0
bsr Printer
bra DoUpLoad5
DoUpLoad2: move.l ULLock,d1
lib Dos,CurrentDir
move.l d0,OldLock
DoUpLoad5: lea.l ULText3,a0
bsr Printer
lea.l FileNameBuf3,a0
move.l a0,d1
clr.l d2
clr.l d3
lib Dos,Execute
;change back to dir where we started from
move.l OldLock,d1
beq DoUpLoad7
lib Dos,CurrentDir
clr.l OldLock
DoUpLoad7: move.l ULLock,d1
beq DoUpLoad8
lib Dos,UnLock
clr.l ULLock
DoUpLoad8:
bra Exit
DoUpLoad9: lea.l NoULDLProgText1,a0
bsr Printer
bra Exit
DoDownLoad: lea.l DLText2,a0
bsr Printer
tst.b DLProgram
beq DoDownLoad9
;change to the dl dir
tst.b DLDir
beq DoDownLoad1
lea.l DLDir,a0
move.l a0,d1
move.l #ACCESS_READ,d2
lib Dos,Lock
move.l d0,DLLock
bne DoDownLoad2
DoDownLoad1: lea.l NoDLDirText1,a0
bsr Printer
bra DoDownLoad5
DoDownLoad2: move.l DLLock,d1
lib Dos,CurrentDir
move.l d0,OldLock
DoDownLoad5: lea.l DLProgram,a0
move.l a0,d1
clr.l d2
clr.l d3
lib Dos,Execute
;change back to dir where we started from
move.l OldLock,d1
beq DoDownLoad7
lib Dos,CurrentDir
clr.l OldLock
DoDownLoad7: move.l DLLock,d1
beq DoDo