home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
archives
/
os968ka.tar.gz
/
os968ka.tar
/
k6ocmd.asm
< prev
next >
Wrap
Assembly Source File
|
1987-07-01
|
34KB
|
693 lines
nam Kermit68K
ttl Top-level commands subroutines module
* Kermit68K: source file K68CMD
*
* Author: Roberto Bagnara (Bagnara@Iboinfn.Bitnet),
* Bologna University, Physics Department, July 1987.
*
* All rights reserved to Bologna University, Italy.
*
* Permission is granted to any individual or institution
* to use, copy, or redistribute this software so long as
* it is not sold for profit, provided this copyright
* notice is retained.
*
* Modification History:
*
* Version Date Who Comments
*
* 1.0.00 870701 Roberto Bagnara First official release
use DefsFile
Edition equ 0
psect K68Commands,0,0,Edition,0,0
********************************** Parser *****************************ok
* *
* Kermit68K interactive command parser. *
* *
* Entry conditions : none *
* *
* Exit conditions : D1.B destroyed *
* A0.L destroyed *
* *
***********************************************************************
Parser: LEA VersStr(PC),A0 Give version informations
BSR ConWrite
Parser1 TST.B IntMacro(A6) Are we interpreting a macro ?
BEQ.S Parser2 No, see if we are interpreting a file
BSR McCmdIn Yes, get the next line of the macro
TST.B D0 End of macro ?
BNE.S Parser4 No, join the common part
SF IntMacro(A6) Yes, we're no longer interpreting a macro
Parser2 MOVE.B TakLevel(A6),D1 Are we interpreting a take file ?
BLT.S Parser3 No, get a command from terminal
ADD.B #TakeFil0,D1 Yes, compute its channel number
BSR FlCmdIn Get a command line from file
TST.B D0 End of file ?
BNE.S Parser4 No, join the common part
MOVE.B TakLevel(A6),D1 Yes, compute the file channel number
ADD.B #TakeFil0,D1 Add this offset
BSR FilClose Close it
SUBQ.B #1,TakLevel(A6) Continue with outer take file, if any
BRA.S Parser1
Parser3 LEA Prompt(A6),A0 Point to the prompt string
BSR ConWrite Write it
BSR CCmdIn Input a command line
TST.B D0 EOF ?
SEQ Done(A6) Set the termination flag accordingly
BSR NewLine Start a new line
Parser4 SF Display(A6) Turn off the display flag
LEA CmdBuf(A6),A0 Command to parse is here
BSR DoCommd Parse command and execute it
TST.B Done(A6) Done ?
BEQ.S Parser1 No, stay in loop
RTS Yes, return to main
********************************** DoCommd ****************************ok
* *
* Main switcher for commands execution. *
* *
* Entry conditions : A0.L points to the command line *
* *
* Exit conditions : D1.B destroyed *
* A1.L destroyed *
* *
***********************************************************************
DoCommd MOVEA.L A0,A5 This is the pointer to command line
TST.B IntMacro(A6) Are we interpreting a macro ?
BNE.S DoCommd6 Yes, don't search in macro table
MOVE.L A5,-(A7) No, save the pointer to command line
LEA Argumnt1(A6),A0 Put here the command verb, if any
BSR ParsWrd Try to get the command verb
TST.B D0 Success ?
BLT.S DoCommd2 No, return
LEA Argumnt1(A6),A0 Yes, here is the macro name to find
BSR MacFind Search this name in macro table
TST.B D0 Found ?
BEQ.S DoCommd4 No, search in command table
DoCommd1 TST.B (A0)+ Yes, skip the macro name
BNE.S DoCommd1 Loop until end of macro name
MOVE.L A0,MacroPnt(A6) Setup this pointer for reading the macro
ST IntMacro(A6) NOW we are intepreting a macro !
DoCommd2 ADDQ.L #4,A7 Remove the line pointer from stack
DoCommd3 RTS
DoCommd4 MOVE.L (A7)+,A5 Restore the pointer to command line
DoCommd6 LEA CmdTable(PC),A1 Pointer to command table
SF D1 The command verb is not mandatory
BSR ParsKyW Look for a valid command verb
TST.B D0 Ok ?
BLT.S DoCommd3 No, return
LEA DoCmdTab(PC),A1 Start of jump table
BRA IndxJump Jump to appropriate command handler
*** Code for top level commands execution ***
ChkLocl: TST.B Local(A6) Are we running in local mode ?
BNE.S ChkLocl1 Yes, all ok
LEA StLnFStr(PC),A0 No, load pointer to the error message
BSR ConWrite Give error message
ADDQ.L #4,A7 Remove caller's return address
ChkLocl1 RTS
DoBYE: BSR ChkLocl Check mode
SUBA.L A2,A2 No arguments for SetGCmd
MOVEQ #'L',D0 Logout command
BSR SetGCmd Setup for generic commands
MOVEQ #SndGCmdS,D7
BSR KPSwtch Enter the protocol automaton switcher
RTS
*** % command (Treat the rest of the line as a comment) ***
DoCOMMNT: LEA DataBuf(A6),A0 Pointer to temporary buffer
BSR ParsWrd Get a word from the command line
TST.B D0 End of line ?
BGE.S DoCOMMNT No, continue
RTS Yes, return
*** CONNECT command ***
DoCONN: BSR ChkLocl Check mode
TST.L Speed(A6) Is line speed setted ?
BGT.S DoCONN1 Yes, continue
LEA StSpeStr(PC),A0 No, give error message and return
BSR ConWrite
RTS
DoCONN1 LEA ConnStr1(PC),A0 Yes, give the start of connection message
BSR ConWrite
LEA LineName(A6),A0 Write the line name
BSR ConWrite
LEA ConnStr3(PC),A0 Line speed
BSR ConWrite
MOVE.L Speed(A6),D0 Load speed
BSR TypeUNum Write the baud rate
LEA ConnStr5(PC),A0 Escape character
BSR ConWrite
MOVE.B Escape(A6),D0 Get the escape character
CMPI.B #' ',D0 Printable character ?
BGE.S DoCONN3 Yes, print it out
ADDI.B #64,D0 Make it printable
MOVEQ #'^',D2 Prefix character for control
EXG D0,D2 Exchange
BSR ConOut Output prefix
EXG D0,D2 Exchange
DoCONN3 BSR ConOut Output character
MOVEQ #' ',D0 Write a blank
BSR ConOut
MOVEQ #'(',D0 Write an open parenthesis
BSR ConOut
MOVEQ #0,D0 Write the ASCII code of the escape char
MOVE.B Escape(A6),D0
BSR TypeUNum
LEA ConnStr6(PC),A0 Close the parenthesis and give some info
BSR ConWrite
MOVEQ #TextMode,D0 Put line in text mode
MOVEQ #HostLine,D1
BSR ChanCtrl
CMPI.B #AllOk,D0 All ok ?
BEQ.S DoCONN4 Yes, enter the connect loop
LEA CCndLStr(PC),A0 No, point to the error message
BSR ConWrite Write it on the screen
RTS
DoCONN4 MOVEQ #Terminal,D1 Try to get a character from terminal
BSR InpChar
TST.B D1 Character received ?
BNE DoCONN14 No, look at the host line
CMP.B Escape(A6),D0 Escape character ?
BNE DoCONN13 No
BSR ConInp Get a single character command
MOVE.B D0,D3 Uppercase it
BSR UppCase
CMPI.B #'C',D3 Close command ?
BEQ DoCONN12 Yes
CMPI.B #'?',D3 Help command ?
BNE.S DoCONN5 No
LEA ConnStr8(PC),A0 Yes, give the help message
BSR ConWrite
BRA DoCONN14
DoCONN5 CMPI.B #'0',D3 Send null command ?
BNE.S DoCONN6 No
MOVEQ #0,D0 Yes, obey it
BSR HostOut
BRA.S DoCONN14
DoCONN6 CMPI.B #'B',D3 Send break command ?
BNE.S DoCONN7
MOVEQ #SndBreak,D0 Request code
MOVEQ #HostLine,D1 Logical channel number
BSR ChanCtrl Call the channel control routine
BRA.S DoCONN14
DoCONN7 CMPI.B #'S',D3 Show status command ?
BNE.S DoCONN9 No
LEA ConnStr2(PC),A0 Yes, show the communication status
BSR ConWrite
LEA LineName(A6),A0 Write the line name
BSR ConWrite
LEA ConnStr3(PC),A0 Write the line speed
BSR ConWrite
MOVE.L Speed(A6),D0 Load speed
BSR TypeUNum Write the baud rate
BSR NewLine Start a new line
BRA.S DoCONN14
DoCONN9 CMPI.B #'H',D3 Hangup and close command ?
BNE.S DoCONN10 No
*
* Place code for hangup here
*
BRA.S DoCONN12 Close the connection
DoCONN10 CMP.B Escape(A6),D3 Escape character again ?
BNE.S DoCONN11 No
MOVE.B Escape(A6),D0 Yes, send it
BSR HostOut
BRA.S DoCONN14
DoCONN11 MOVEQ #Asc_Bel,D0 Invalid command, ring bell
BSR ConOut
BRA.S DoCONN14
DoCONN12 LEA ConnStr7(PC),A0 Yes, give the end of connection message
BSR ConWrite
RTS Exit from transparent mode
DoCONN13 BSR HostOut Output the character just received
TST.B Duplex(A6) Half duplex ?
BEQ.S DoCONN14 No
BSR ConOut Yes, echo the character to the terminal
DoCONN14 MOVEQ #HostLine,D1 Try to get a character from host
BSR InpChar
TST.B D1 Character received ?
BNE DoCONN4 No, look at the terminal line
BSR HndlPar Yes, handle the parity bit
BSR ConOut Output the character just received
BRA DoCONN4
*** (Local) COPY command ***
DoCOPY: LEA Argumnt1(A6),A0 Source file specification
BSR ParsWrd Get it, if any
LEA Argumnt2(A6),A0 Target file specification
BSR ParsTxt Get it, if any
LEA Argumnt1(A6),A0 Pass arguments addresses ...
LEA Argumnt2(A6),A1 ... to the System subroutine
MOVEQ #CopyFile,D0 Copy file system function wanted
BSR System Call the external handler
LEA NoCopStr(PC),A0 This is the "on failure" error message
BRA CSysErr Check cc and, on failure, give message
*** (Local) CWD command ***
DoCWD: LEA Argumnt1(A6),A0 Directory specification
BSR ParsTxt Get it, if any
LEA Argumnt1(A6),A0 Pass argument address to System
MOVEQ #ChangDir,D0 Change working directory function
BSR System Call the external handler
LEA NoCWDStr(PC),A0 This is the "on failure" error message
BRA CSysErr Check cc and, on failure, give message
*** DEFINE command ***
DoDEFN: TST.B IntMacro(A6) Are we interpreting from a macro ?
BNE DoDEFN11 Yes, error
LEA Argumnt1(A6),A0 Put here the macro name, if any
BSR ParsWrd Try to get it
TST.B D0 Success ?
BLT DoLIST3 No, notify that macro name is missing
LEA Argumnt1(A6),A0 Yes, point to the parsed macro name
BSR MacFind Check if this macro is already defined
TST.B D0 Found ?
BEQ.S DoDEFN4 No, create it
* Yes, erase it from macro table
DoDEFN1 MOVEA.L A0,A1 Macro definition start address
BSR MacSkip Skip to end of macro body
TST.B D0 It was the last one ?
BNE.S DoDEFN3 Yes, simply adjust pointer to table end
MOVE.L MTNxtChF(A6),D0 No, load address of the next byte free
DoDEFN2 MOVE.B (A1)+,(A0)+ Shift the macro table
CMP.L A1,D0 At end of macro table ?
BNE.S DoDEFN2 No, stay in loop
DoDEFN3 MOVE.L A0,MTNxtChF(A6) Next byte free in macro table is here
DoDEFN4 LEA Argumnt1(A6),A1 Point to the parsed macro name
DoDEFN5 MOVE.B (A1)+,(A0)+ Store the macro name in macro table
BNE.S DoDEFN5 Loop until end of macro name
BSR ParsTxt Try to get a one-line macro body
TST.B D0 Success ?
BLT.S DoDEFN6 No, it's a multi-line macro
ADDQ.L #1,A0 Yes, skip the termination null
BRA.S DoDEFN10 Adjust the end pointer and return
DoDEFN6 MOVE.L A0,-(A7) Save the pointer to the macro table
MOVE.B TakLevel(A6),D1 Are we defining from a take file ?
BLT.S DoDEFN7 No, get next macro line from terminal
ADD.B #TakeFil0,D1 Yes, compute its channel number
BSR FlCmdIn Get the next macro line from file
TST.B D0 End of file ?
BEQ.S DoDEFN9 Yes, end of macro body
SF D2 No, set the termination flag to false
BNE.S DoDEFN8 Join the common part
DoDEFN7 BSR CCmdIn Get another line of text from terminal
TST.B D0 EOF on input ?
SEQ D2 Set the termination flag accordingly
BSR NewLine Start a new line on the terminal
DoDEFN8 LEA CmdBuf(A6),A5 The macro line is here
MOVE.L (A7)+,A0 Restore the pointer to the macro table
BSR ParsTxt Try to get it into the macro table
MOVE.B #Asc_CR,(A0)+ Terminate the line whit a CR
TST.B D0 The line was null ?
BLT.S DoDEFN9 Yes, this is an end condition
TST.B D2 Is the termination flag true ?
BEQ.S DoDEFN6 No, continue entering macro lines
DoDEFN9 CLR.B -1(A0) Null terminate the macro body
DoDEFN10 MOVE.L A0,MTNxtChF(A6) Update next byte free in macro table
RTS
DoDEFN11 SUBA.L A0,A0 No guilty
LEA MNstAStr(PC),A1 Error message, can't nest macros
BSR ParsErr Write it
RTS
*** (Local) DELETE command ***
DoDELETE: LEA Argumnt1(A6),A0 File to delete specification
BSR ParsTxt Get it, if any
LEA Argumnt1(A6),A0 Pass argument address to System
MOVEQ #DeletFil,D0 Delete file function wanted
BSR System Call the external handler
LEA NoDelStr(PC),A0 This is the "on failure" error message
BRA CSysErr Check cc and, on failure, give message
*** (Local) DIRECTORY command ***
DoDIR: LEA Argumnt1(A6),A0 File or directory specification
BSR ParsTxt Get it, if any
LEA Argumnt1(A6),A0 Pass argument address to System
MOVEQ #Directry,D0 Directory function wanted
BSR System Call the external handler
LEA NoDirStr(PC),A0 This is the "on failure" error message
BRA CSysErr Check cc and, on failure, give message
*** ECHO command ***
DoECHO: LEA DataBuf(A6),A1 Pointer to temporary buffer
MOVEA.L A1,A0 Pass it to ParsTxt
BSR ParsTxt Get a text string from the command line
TST.B D0 Ok ?
BLT.S DoECHO1 No, return
MOVEA.L A1,A0 Reload pointer
BSR ConWrite Write the string to the terminal line
BSR NewLine Start a new line
DoECHO1 RTS
*** EXIT command ***
DoEXIT: ST Done(A6) Set the termination flag
RTS
*** FINISH command ***
DoFINISH: BSR ChkLocl Check mode
SUBA.L A2,A2 No arguments for SetGCmd
MOVEQ #'F',D0 Finish server command
BSR SetGCmd Set up for generic commands
MOVEQ #SndGCmdS,D7
BSR KPSwtch Enter the protocol automaton switcher
RTS
*** GET command ***
DoGET: BSR ChkLocl Check mode
LEA Argumnt1(A6),A0 Point to file name string
BSR ParsWrd Try to get a file name
TST.B D0 Missing file name ?
BLT.S DoGET1 Yes, give error message
LEA Argumnt2(A6),A0 Point to file as-name string
BSR ParsOuF Look for a valid output file name
LEA CmdBuf(A6),A0 Put here the file name
LEA Argumnt1(A6),A1 Copy from here
MOVEQ #CmdBufLn,D0 Buffers length
BSR CopyStr Copy now
TST.B Local(A6) Are we in local mode ?
SNE Display(A6) Set transaction display flag accordingly
BSR TrnsInit Initialize transaction related variables
MOVE.B #'R',ServrCmd(A6) Get command
MOVEQ #SndSrvIS,D7 Send-Server-Init is the start state
BSR KPSwtch Enter protocol switcher
RTS
DoGET1 SUBA.L A0,A0 No guilty
LEA MsFSpStr(PC),A1 Point to error message
BSR ParsErr Write it
RTS
*** HELP command ***
ScrnMxLL EQU 78
ColumnLn EQU 12
DoHELP: LEA KerCmStr(PC),A0 Write introduction to Kermit68K commands
BSR ConWrite
LEA CmdTable(PC),A0 Point to top-level commands table start
CLR.B D2 Initialize the line length counter
DoHELP1 MOVE.B (A0)+,D0 Get a character from command table
CMP.B #-1,D0 End of table ?
BEQ.S DoHELP2 Yes, now write macro names
BSR.S DoHELP5 No, write the command name
BRA.S DoHELP1 Loop until end of table
DoHELP2 BSR NewLine Start a new line on the screen
CLR.B D2 Re-initialize the line length counter
LEA MacroTbl(A6),A1 Load start address of macro table
CMPA.L MTNxtChF(A6),A1 The macro table is empty ?
BEQ.S DoHELP4 Yes, notify this and return
LEA MacCmStr(PC),A0 No, write introduction to user macros
BSR ConWrite
DoHELP3 MOVEA.L A1,A0 Now A0 points to tha macro name
BSR.S DoHELP5 Write the macro name
BSR MacSkip Skip to next macro name
TST.B D0 The previous was the last macro ?
BEQ.S DoHELP3 No, so write this one
BSR NewLine Yes, start a new line and return
RTS
DoHELP4 LEA NoMacStr(PC),A0 Say that there are no user macros
BSR ConWrite
RTS
DoHELP5 MOVEQ #ColumnLn,D3 Initialize the column length counter
DoHELP6 MOVE.B (A0)+,D0 Get a character from the source string
BEQ.S DoHELP7 End of name, write separators
BSR ConOut Output this character
ADDQ.B #1,D2 Count it
SUBQ.B #1,D3 Decrement the column length counter
BEQ.S DoHELP5 If zero reload it
BRA.S DoHELP6 Loop until end of name
DoHELP7 CMPI.B #ScrnMxLL-ColumnLn,D2 There is room for another column ?
BGT.S DoHELP9 No, start a new line on the screen
MOVEQ #' ',D0 Yes, let's pad the column with blanks
DoHELP8 BSR ConOut Write one blank
ADDQ.B #1,D2 Count it
SUBQ.B #1,D3 At end of column ?
BNE.S DoHELP8 No, repeat
RTS
DoHELP9 BSR NewLine Start a new line on the terminal screen
CLR.B D2 Re-initialize the line length counter
RTS
*** LIST command ***
DoLIST: LEA Argumnt1(A6),A0 Put here the macro name, if any
BSR ParsWrd Try to get the macro name
TST.B D0 Success ?
BLT.S DoLIST3 No, give error and return
LEA Argumnt1(A6),A0 Yes, point to the parsed macro name
BSR MacFind Search it in the macro table
TST.B D0 Found ?
BEQ.S DoLIST4 No, give error and return
DoLIST0 TST.B (A0)+ Skip the macro name
BNE.S DoLIST0
DoLIST1 MOVE.B (A0)+,D0 Type the macro body, get a character
BEQ.S DoLIST2 End of macro body, exit
BSR ConOut Output the character just read
CMPI.B #Asc_CR,D0 It was a carriage return ?
BNE.S DoLIST1 No, continue
MOVEQ #Asc_LF,D0 Yes, output a line feed
BSR ConOut
BRA.S DoLIST1 Stay in loop
DoLIST2 BSR NewLine Start a new line on the terminal
RTS
DoLIST3 SUBA.L A0,A0 No guilty
LEA MsMcNStr(PC),A1 Error message, missing macro name
BSR ParsErr Write it
RTS
DoLIST4 LEA Argumnt1(A6),A0 Here is the guilty word
LEA UnkMcStr(PC),A1 Error message, macro not found
BSR ParsErr Write it
RTS
*** PRINT command ***
DoPRINT: LEA Argumnt1(A6),A0 File to print specification
BSR ParsTxt Get it, if any
LEA Argumnt1(A6),A0 Pass argument address to System
MOVEQ #PrntFile,D0 Print file function wanted
BSR System Call the external handler
LEA NoPriStr(PC),A0 This is the "on failure" error message
BRA CSysErr Check cc and, on failure, give message
*** RECEIVE command ***
DoRECVE: LEA Argumnt2(A6),A0 Point to file as-name string
BSR ParsOuF Look for a valid output file name
TST.B D0 Ok ?
BGE.S DoRECVE1 Yes, file must be stored under this name
CMPI.B #-3,D0 Missing file specification ?
BEQ.S DoRECVE1 Yes, no problem
RTS No, some other error, return
DoRECVE1 TST.B Local(A6) Are we in local mode ?
SNE Display(A6) Set transaction display flag accordingly
BSR TrnsInit Setup transaction related variables
MOVEQ #RecInitS,D7 Receive-Init is the start state
BSR KPSwtch Enter protocol switcher
RTS
*** RENAME command ***
DoRENAME: LEA Argumnt1(A6),A0 Old file name specification
BSR ParsWrd Get it, if any
LEA Argumnt2(A6),A0 New file name specification
BSR ParsTxt Get it, if any
LEA Argumnt1(A6),A0 Pass arguments addresses ...
LEA Argumnt2(A6),A1 ... to the System subroutine
MOVEQ #RenamFil,D0 Rename file function wanted
BSR System Call the external handler
LEA NoRenStr(PC),A0 This is the "on failure" error message
BRA CSysErr Check cc and, on failure, give message
*** SEND command ***
DoSEND: LEA Argumnt1(A6),A0 Point to file name string
BSR ParsInF Try to get a valid input file name
TST.B D0 Some error ?
BLT.S DoSEND1 Yes, handle it
LEA Argumnt2(A6),A0 Point to file as-name string
BSR ParsTxt Try to get an as name for this file
TST.B Local(A6) Are we in local mode ?
SNE Display(A6) Set transaction display flag accordingly
BSR TrnsInit Initialize transaction related variables
MOVEQ #SndInitS,D7 Send-Init is the start state
BSR KPSwtch Enter protocol switcher
RTS
DoSEND1 CMPI.B #-3,D0 Missing file specification ?
BNE.S DoSEND2 No, error already given
SUBA.L A0,A0 No guilty
LEA MsFSpStr(PC),A1 Point to error message
BSR ParsErr Write it
DoSEND2 RTS
*** (Local) SPACE command ***
DoSPACE: LEA Argumnt1(A6),A0 Directory or device specification
BSR ParsTxt Get it, if any
LEA Argumnt1(A6),A0 Pass argument address to System
MOVEQ #SpacInfo,D0 Disk usage query function wanted
BSR System Call the external handler
LEA NoSpaStr(PC),A0 This is the "on failure" error message
BRA CSysErr Check cc and, on failure, give message
*** STATISTICS command ***
DoSTATS: LEA StatStr1(PC),A0 Header line and characters sent string
MOVE.L ChrsSent(A6),D6 Characters sent this transaction
MOVE.L TChsSent(A6),D7 Total characters sent
BSR.S DoSTATS1 Display this
LEA StatStr2(PC),A0 Data characters sent string
MOVE.L DChsSent(A6),D6 Data characters sent this transaction
MOVE.L TDChSent(A6),D7 Total data characters sent
BSR.S DoSTATS1 Display this
LEA StatStr3(PC),A0 NAKs received string
MOVE.L NAKsRecd(A6),D6 NAKs received this transaction
MOVE.L TNAKRecd(A6),D7 Total NAKs received
BSR.S DoSTATS1 Display this
LEA StatStr4(PC),A0 Packets sent string
MOVE.L PcksSent(A6),D6 Packets sent this transaction
MOVE.L TPckSent(A6),D7 Total packets sent
BSR.S DoSTATS1 Display this
LEA StatStr5(PC),A0 Characters received string
MOVE.L ChrsRecd(A6),D6 Characters received this transaction
MOVE.L TChsRecd(A6),D7 Total characters received
BSR.S DoSTATS1 Display this
LEA StatStr6(PC),A0 Data characters received string
MOVE.L DChsRecd(A6),D6 Data characters received this transaction
MOVE.L TDChRecd(A6),D7 Total data characters received
BSR.S DoSTATS1 Display this
LEA StatStr7(PC),A0 NAKs received string
MOVE.L NAKsSent(A6),D6 NAKs sent this transaction
MOVE.L TNAKSent(A6),D7 Total NAKs sent
BSR.S DoSTATS1 Display this
LEA StatStr8(PC),A0 Packets received string
MOVE.L PcksRecd(A6),D6 Packets received this transaction
MOVE.L TPckRecd(A6),D7 Total packets received
BSR.S DoSTATS1 Display this
RTS
DoSTATS1 BSR ConWrite Write the string
MOVE.L D6,D0 Total for last transaction
BSR.S DoSTATS2 Write number
MOVE.L D7,D0 Total since start of Krmit68K
BSR.S DoSTATS2 Write number
BSR NewLine Start a new line
RTS
DoSTATS2 SF D1 Unsigned conversion wanted
MOVEQ #12,D2 Field length
MOVEQ #10,D3 Base 10
LEA DataBuf+34(A6),A0 Point to the end of a temporary buffer
BSR IntToAs Convert the number into a string
BSR ConWrite Write the obtained string
RTS
*** % command (Forward the rest of line to system command processor) ***
DoSYSCMD: LEA Argumnt1(A6),A0 Put here the system command
BSR ParsTxt Get it, if any
LEA Argumnt1(A6),A0 Pass argument address to System
MOVEQ #SysCommd,D0 System command function wanted
BSR System Call the external handler
LEA NoSyCStr(PC),A0 This is the "on failure" error message
BRA CSysErr Check cc and, on failure, give message
*** TAKE command ***
DoTAKE: CMPI.B #MaxTakeF,TakLevel(A6) Take level number at our limit ?
BEQ.S DoTAKE1 Yes, give error and return
LEA Argumnt1(A6),A0 Point to the file name buffer
BSR ParsInF Try to get a valid input file name
TST.B D0 Some error ?
BLT.S DoTAKE2 Yes
BSR ChkWild Check the specified file name
TST.B D0 Wildcarded name ?
BNE.S DoTAKE4 Yes, give error and return
MOVE.B TakLevel(A6),D1 Get the take level number
ADDQ.B #1,D1 Increment this temporary variable
ADD.B #TakeFil0,D1 Compute the new file channel number
MOVEQ #ReadOp,D0 We want open the file for input
BSR FilOpen Open the new take file
*
* Warning, the cc is not checked !!!
*
ADDQ.B #1,TakLevel(A6) Finally increment the take level
RTS
DoTAKE1 LEA TFNDpStr(PC),A1 Say take file nested too deeply
SUBA.L A0,A0 No guilty word
BSR ParsErr Call the error messages routine
RTS
DoTAKE2 CMPI.B #-3,D0 Has a file name been specified ?
BNE.S DoTAKE3 Yes, message already given, return
LEA MsFSpStr(PC),A1 Give missing file specification error
SUBA.L A0,A0 No guilty word
BSR ParsErr Write the error message
DoTAKE3 RTS
DoTAKE4 LEA POuFStr1(PC),A1 Give illegal wildcard error message
BSR ParsErr Call the error messages routine
RTS
*** (Local) TYPE command ***
DoTYPE: LEA Argumnt1(A6),A0 File to type specification
BSR ParsTxt Get it, if any
LEA Argumnt1(A6),A0 Pass argument address to System
MOVEQ #TypeFile,D0 Type file function wanted
BSR System Call the external handler
LEA NoTypStr(PC),A0 This is the "on failure" error message
* BRA CSysErr Check cc and, on failure, give message
CSysErr TST.B D0 System operation failed ?
BNE.S CSysErr1 No, return
BSR ConWrite Yes, write corresponding error message
BSR NewLine Start a new line
CSysErr1 RTS
ends
END