home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
tbsource.lha
/
TBSource
/
ShellTerm
/
STv1.05.S
< prev
next >
Wrap
Text File
|
1993-12-21
|
44KB
|
2,183 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 *
* *
*************************************************
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"
LF: EQU 10
CR: EQU 13
CTRL_O: EQU $0F
CTRL_P: EQU $10
QUIT_KEY: EQU CTRL_P
STATS_KEY: EQU CTRL_O
FALSE: EQU 0
TRUE: EQU 1
BUFLEN: EQU 1024
section ST,CODE
push d2-d7/a2-a6
push d0/a0
sub.l a1,a1 ;Find our task
lib Exec,FindTask
move.l d0,OurTask
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
Cont0.2: bsr ConvASCII
tst.w d0
beq Cont1
move.w d0,SerUnit
Cont1: cmp.b #' ',(a0)
bne Cont1.1
add.l #1,a0
Cont1.1: tst.b (a0)
beq Cont1.2
move.l a0,SerName
Cont1.2:
;Create read reply port for serial.device (or modem0.device etc.)
MainStart: 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 WriteDefaults
;open serial.device
move.l SerName,a0
move.l SerUnit,d0
move.l IORRequest,a1
move.b #SERF_SHARED,IO_SERFLAGS(a1)
move.b DataBits,IO_READLEN(a1)
move.b DataBits,IO_WRITELEN(a1)
move.b StopBits,IO_STOPBITS(a1)
clr.l d1 ;no flags
lib Exec,OpenDevice
tst.l d0
bne NoSerial
move.w #$1,SerOpen ;just to tell if open
;Copy info from one req to the other
move.l IORRequest,a0
move.l IOWRequest,a1
move.l IO_DEVICE(a0),IO_DEVICE(a1)
move.l IO_UNIT(a0),IO_UNIT(a1)
add.l #48,a0 ;get start of ioser
add.l #48,a1
move.l #34,d0
lib Exec,CopyMem
lea.l StartText1,a0
bsr Printer
bsr DoPhoneBook
;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 #QUIT_KEY,Buffer1
beq Menu
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
bra Looper
Menu: lea.l MenuText1,a0
bsr Printer
Menu1: move.l _stdin,d1
lib Dos,FGetC
cmp.l #-1,d0
beq ShutDown
cmp.l #'p',d0
beq Prefs
cmp.l #'P',d0
beq Prefs
cmp.l #'s',d0
beq DoStats
cmp.l #'S',d0
beq DoStats
cmp.l #'c',d0
beq ClearBoth
cmp.l #'C',d0
beq ClearBoth
cmp.l #'d',d0
beq Dialer
cmp.l #'D',d0
beq Dialer
cmp.l #'o',d0
beq DoCTRL_P
cmp.l #'O',d0
beq DoCTRL_P
cmp.l #'f',d0
beq ResetFont
cmp.l #'F',d0
beq ResetFont
cmp.l #'x',d0
beq ClearScreen
cmp.l #'X',d0
beq ClearScreen
cmp.l #'r',d0
beq DoReset
cmp.l #'R',d0
beq DoReset
cmp.l #'h',d0
beq DoHangUp
cmp.l #'H',d0
beq DoHangUp
cmp.l #'?',d0
beq DoInfo
cmp.l #'q',d0
beq Quit
cmp.l #'Q',d0
beq Quit
cmp.l #'e',d0
beq Exit1
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
DoStats: lea.l StatsText2,a0
bsr Printer
lea.l CRLFText1,a0
bsr Printer
bsr GiveStats
bsr GetAnyKey
bra Menu
ClearBoth: lea.l ClearText1,a0
bsr Printer
clr.l Received
clr.l Sent
bra Menu
DoCTRL_P: move.b #CTRL_P,Buffer1
bsr Writer
lea.l CTRL_PText1,a0
bsr Printer
add.l #1,Sent
bra Exit
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
DoInfo: lea.l InfoText1,a0
bsr Printer
lea.l AuthorText1,a0
bsr Printer
bsr GetAnyKey
bra Menu
Quit: lea.l QuitText1,a0
bsr Printer
lea.l CRLFText1,a0
bsr Printer
bsr GiveStats
bra ShutDown
Exit: lea.l TerminalText1,a0
bsr Printer
bra Looper1
Dialer: lea.l DialerText1,a0
bsr Printer
Dialer0.1: lea.l DialerText2,a0
bsr Printer
Dialer0.2: bsr PrintEntries
Dialer0.3: bsr PrintSelect
Dialer0.4: lea.l DialerText3,a0
bsr Printer
Dialer1: move.l _stdin,d1
lib Dos,FGetC
cmp.l #-1,d0
beq Menu
cmp.l #'0',d0
beq DoEntry0
cmp.l #'1',d0
beq DoEntry1
cmp.l #'2',d0
beq DoEntry2
cmp.l #'3',d0
beq DoEntry3
cmp.l #'4',d0
beq DoEntry4
cmp.l #'5',d0
beq DoEntry5
cmp.l #'6',d0
beq DoEntry6
cmp.l #'7',d0
beq DoEntry7
cmp.l #'8',d0
beq DoEntry8
cmp.l #'9',d0
beq DoEntry9
cmp.l #'D',d0
beq DialList
cmp.l #'d',d0
beq DialList
cmp.l #'E',d0
beq Exit1
cmp.l #'e',d0
beq Exit1
cmp.l #'M',d0
beq MainMenu
cmp.l #'m',d0
beq MainMenu
cmp.l #'-',d0
beq MainMenu
cmp.l #'S',d0
beq SingleDial
cmp.l #'s',d0
beq SingleDial
cmp.l #'R',d0
beq Relist
cmp.l #'r',d0
beq Relist
cmp.l #'C',d0
beq ClearList
cmp.l #'c',d0
beq ClearList
cmp.l #'A',d0
beq SelectAll
cmp.l #'a',d0
beq SelectAll
cmp.l #'h',d0
beq DialerHelp
cmp.l #'H',d0
beq DialerHelp
cmp.l #'?',d0
beq DialerHelp
bra Dialer1
DialerHelp: lea.l HelpText1,a0
bsr Printer
bra Dialer0.4
ClearList: lea.l ClearText2,a0
bsr Printer
clr.l EntrySelected1
clr.l EntrySelected5
clr.w EntrySelected9
bra DoEntry_OUT1
SelectAll: lea.l AllText1,a0
bsr Printer
move.l #$01010101,EntrySelected1
move.l #$01010101,EntrySelected5
move.w #$0101,EntrySelected9
bra DoEntry_OUT1
DoEntry1: bchg.b #0,EntrySelected1
bra DoEntry_OUT
DoEntry2: bchg.b #0,EntrySelected2
bra DoEntry_OUT
DoEntry3: bchg.b #0,EntrySelected3
bra DoEntry_OUT
DoEntry4: bchg.b #0,EntrySelected4
bra DoEntry_OUT
DoEntry5: bchg.b #0,EntrySelected5
bra DoEntry_OUT
DoEntry6: bchg.b #0,EntrySelected6
bra DoEntry_OUT
DoEntry7: bchg.b #0,EntrySelected7
bra DoEntry_OUT
DoEntry8: bchg.b #0,EntrySelected8
bra DoEntry_OUT
DoEntry9: bchg.b #0,EntrySelected9
bra DoEntry_OUT
DoEntry0: bchg.b #0,EntrySelected0
DoEntry_OUT: lea.l EntryTextXIV,a0
bsr Printer
DoEntry_OUT1: bsr PrintSelect
lea.l SelectionText1,a0
bsr Print