home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
tbsource.lha
/
TBSource
/
ShellTerm
/
ST1.17.S
< prev
next >
Wrap
Text File
|
1993-12-21
|
59KB
|
2,986 lines
*************************************************
* *
* (C)opyright 1992-93 *
* *
* 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 *
* *
* Version 1.10 20/10/1992 *
* *
* Hopefully fixed bug in FindWord *
* Added: PublicPorts *
* *
* Version 1.11 13/11/1992 <-Friday the 13th *
* *
* Version for Mika Henttinen *
* *
* Version 1.12 30/12/1992 *
* *
* Changed parser to Commodore's own ReadArgs *
* *
* Version 1.13 02/01/1993 *
* *
* Added 'Execute Command' *
* *
* Version 1.14 06/02/1993 *
* *
* Fixed bug at start clearing CLI pointer's *
* last byte *
* *
* Version 1.15 10/02/1993 *
* *
* Made sure that the Modify Mode in the dialer *
* is turned off when the dialer is quit *
* *
* Version 1.16 24/03/1993 *
* *
* Fixed bug with opening device! *
* *
* Version 1.17 25/03/1993 *
* *
* Added optional port *
* *
*************************************************
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
lea.l CLTemplate1,a0
move.l a0,d1
lea.l CLArray1,a0
move.l a0,d2
clr.l d3
lib Dos,ReadArgs
move.l d0,RDArgs1
beq NoRDArgs
move.l CLArray1,a0
lea.l FileNameBuf1,a1
tst.b (a0)
beq Parse2
CLCopyLoop: move.b (a0)+,(a1)+
tst.b -1(a1)
bne CLCopyLoop
Parse2: tst.l OptPortName
beq Parse3 ;No port specified
lib Exec,CreateMsgPort
move.l d0,OptPort
beq NoMsgPort
;Add port to public lists
move.l OptPort,a1
move.l OptPortName,a0
move.l a0,LN_NAME(a1)
lib Exec,AddPort
Parse3:
;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
;Add port to public lists
move.l SRRPort,a1
lea.l RPortText1,a0
move.l a0,LN_NAME(a1)
lib Exec,AddPort
;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
;Create write reply port for serial.device (or modem0.device etc.)
lib Exec,CreateMsgPort
move.l d0,SWRPort
beq NoMsgPort
;Add port to public lists
move.l SWRPort,a1
lea.l WPortText1,a0
move.l a0,LN_NAME(a1)
lib Exec,AddPort
;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
bsr SetSerParams
; 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 #'M',d0
beq DoExecute
cmp.l #'?',d0
beq DoInfo
cmp.l #'Q',d0
beq Quit
cmp.l #'E',d0
beq Exit1
bra Menu1
Exit1: bclr.b #0,ModifyMode ;Clear modify bit
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_OUT
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