nam Kermit68K ttl REMOTE and SHOW commands subroutines module * Kermit68K: source file K68CM3 * * 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 K68Commands3,0,0,Edition,0,0 *** Code for REMOTE commands execution *** Rm1FlOp MOVE.B D0,D7 Save command 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 Remote file specified ? BLT.S Rm1FlOp1 No, give error message MOVEA.L A1,A2 Yes MOVE.B D7,D0 Restore command SUBA.L A3,A3 Terminate the SetGCmd arguments list BSR SetGCmd Setup data buffer and involved variables MOVEQ #SndSrvIS,D7 BSR KPSwtch Enter the protocol automaton switcher RTS Rm1FlOp1 LEA Rm1FOStr(PC),A0 BSR ConWrite RTS Rm2FlOp MOVE.B D0,D7 Save command LEA DataBuf(A6),A1 Pointer to temporary buffer MOVEA.L A1,A0 Pass it to ParsTxt BSR ParsWrd Get a text string from the command line TST.B D0 Remote file 1 specified ? BLT.S Rm2FlOp1 No, give error message MOVEA.L A1,A2 Yes LEA 1(A0),A1 MOVEA.L A1,A0 Pass it to ParsTxt BSR ParsTxt Get a text string from the command line TST.B D0 Remote file 2 specified ? BLT.S Rm2FlOp1 No, give error message MOVEA.L A1,A3 Yes MOVE.B D7,D0 Restore command SUBA.L A4,A4 Terminate the SetGCmd arguments list BSR SetGCmd Setup data buffer and involved variables MOVEQ #SndSrvIS,D7 BSR KPSwtch Enter the protocol automaton switcher RTS Rm2FlOp1 LEA Rm2FOStr(PC),A0 BSR ConWrite RTS *** REMOTE command *** DoREMOT: BSR ChkLocl Check mode LEA REMTable(PC),A1 Pointer to REMOTE commands table ST D1 Keyword specification is mandatory BSR ParsKyW Look for a valid REMOTE command TST.B D0 Ok ? BLT.S DoREMOT1 No, return LEA DoRemTab(PC),A1 Pointer to REMOTE jump table BRA IndxJump Join common jump routine DoREMOT1 RTS *** REMOTE COPY command *** DoRemCOP: MOVEQ #'K',D0 Copy command BSR Rm2FlOp Call the remote file operation routine RTS *** REMOTE CWD command *** DoRmCWD: SUBA.L A2,A2 No SetGCmd arguments by default 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 Remote directory specified ? BLT.S DoRmCWD1 No, no arguments MOVEA.L A1,A2 Yes SUBA.L A3,A3 Nullify next argument pointer DoRmCWD1 MOVEQ #'C',D0 Change working directory command BSR SetGCmd MOVEQ #SndGCmdS,D7 BSR KPSwtch Enter the protocol automaton switcher RTS *** REMOTE DELETE command *** DoRemDEL: MOVEQ #'E',D0 Delete command BSR Rm1FlOp Call the remote file operation routine RTS *** REMOTE DIRECTORY command *** DoRmDIR: SUBA.L A2,A2 No SetGCmd arguments by default 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 Remote file or directory specified ? BLT.S DoRmDIR1 No, no arguments MOVEA.L A1,A2 Yes SUBA.L A3,A3 Nullify next argument pointer DoRmDIR1 MOVEQ #'D',D0 Remote directory command BSR SetGCmd Setup data buffer and involved variables MOVEQ #SndSrvIS,D7 BSR KPSwtch Enter the protocol automaton switcher RTS *** REMOTE HELP command *** DoRmHELP: SUBA.L A2,A2 No arguments for SetGCmd MOVEQ #'H',D0 Remote help command BSR SetGCmd Setup data buffer and involved variables MOVEQ #SndSrvIS,D7 BSR KPSwtch Enter the protocol automaton switcher RTS *** REMOTE HOST command *** DoRemHOS: LEA DataBuf(A6),A1 MOVEA.L A1,A0 BSR ParsTxt LEA CmdBuf(A6),A0 MOVEQ #CmdBufLn,D0 BSR CopyStr BSR TrnsInit MOVE.B #'C',ServrCmd(A6) MOVEQ #SndSrvIS,D7 BSR KPSwtch Enter the protocol automaton switcher RTS *** REMOTE KERMIT command *** DoRemKER: RTS *** REMOTE PRINT command *** DoRemPRI: MOVEQ #'S',D0 BSR Rm1FlOp Call the remote file operation routine RTS *** REMOTE RENAME command *** DoRemREN: MOVEQ #'R',D0 Rename command BSR Rm2FlOp Call the remote file operation routine RTS *** REMOTE SET command *** DoRemSET: RTS *** REMOTE SPACE command *** DoRmSPA: SUBA.L A2,A2 No SetGCmd arguments by default 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 Remote directory specified ? BLT.S DoRmSPA1 No, no arguments MOVEA.L A1,A2 Yes SUBA.L A3,A3 Nullify next argument pointer DoRmSPA1 MOVEQ #'U',D0 Remote space query command BSR SetGCmd Setup for generic commands MOVEQ #SndGCmdS,D7 BSR KPSwtch Enter the protocol automaton switcher RTS *** REMOTE SUBMIT command *** DoRemSUB: MOVEQ #'P',D0 Submit command BSR Rm1FlOp Call the remote file operation routine RTS *** REMOTE TYPE command *** DoRemTYP: MOVEQ #'T',D0 Type command BSR Rm1FlOp Call the remote file operation routine RTS *** REMOTE WHO command *** DoRmWHO: SUBA.L A2,A2 No SetGCmd arguments by default 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 Remote user name specified ? BLT.S DoRmWHO1 No, no arguments MOVEA.L A1,A2 Yes SUBA.L A3,A3 Nullify next argument pointer DoRmWHO1 MOVEQ #'W',D0 Remote who command BSR SetGCmd Setup data buffer and involved variables MOVEQ #SndSrvIS,D7 BSR KPSwtch Enter the protocol automaton switcher RTS *** SHOW command *** DoSHOW: LEA SHOWTabl(PC),A1 Pointer to SHOW parameters table ST D1 BSR ParsKyW Look for a valid SHOW option TST.B D0 Ok ? BLT.S DoSHOW1 No, return LEA DoShoTab(PC),A1 Pointer to SHOW jump table BRA IndxJump Join common jump routine DoSHOW1 RTS *** SHOW VERSION command *** DoShoVer: LEA VersStr(PC),A0 Show the current Kermit68K version BSR ConWrite LEA ShVerStr(PC),A0 And then the warning BSR ConWrite RTS *** SHOW PARAMETERS command *** DoShoP: LEA ShPStr1(PC),A0 Line name BSR ConWrite LEA LineName(A6),A0 BSR ConWrite LEA ShPStr2(PC),A0 Line speed BSR ConWrite MOVE.L Speed(A6),D0 Load it BLT.S DoShoP0 Negative, unknown speed BSR TypeUNum Write the baud rate BRA.S DoShoP01 DoShoP0 LEA ShPStr3(PC),A0 Say unknown speed BSR ConWrite DoShoP01 LEA ShPStr4(PC),A0 Mode BSR ConWrite TST.B Local(A6) BEQ.S DoShoP1 LEA ShPStr5(PC),A0 BRA.S DoShoP2 DoShoP1 LEA ShPStr6(PC),A0 DoShoP2 BSR ConWrite LEA ShPStr7(PC),A0 Parity selected BSR ConWrite MOVE.B Parity(A6),D0 CMPI.B #'E',D0 BEQ.S DoShoP3 CMPI.B #'O',D0 BEQ.S DoShoP4 CMPI.B #'M',D0 BEQ.S DoShoP5 CMPI.B #'S',D0 BEQ.S DoShoP6 LEA ShPStr12(PC),A0 none BRA.S DoShoP7 DoShoP3 LEA ShPStr8(PC),A0 even BRA.S DoShoP7 DoShoP4 LEA ShPStr9(PC),A0 odd BRA.S DoShoP7 DoShoP5 LEA ShPStr10(PC),A0 mark BRA.S DoShoP7 DoShoP6 LEA ShPStr11(PC),A0 space DoShoP7 BSR ConWrite LEA ShPStr13(PC),A0 Duplex BSR ConWrite TST.B Duplex(A6) BEQ.S DoShoP8 LEA ShPStr14(PC),A0 BRA.S DoShoP9 DoShoP8 LEA ShPStr15(PC),A0 DoShoP9 BSR ConWrite LEA ShPStr16(PC),A0 Flow control BSR ConWrite MOVE.B Flow(A6),D0 BEQ.S DoShoP11 CMPI.B #1,D0 Flow(A6) BNE.S DoShoP10 LEA ShPStr17(PC),A0 BRA.S DoShoP12 DoShoP10 MOVEQ #0,D2 BSR DoShoP42 BRA.S DoShoP13 DoShoP11 LEA ShPStr12(PC),A0 DoShoP12 BSR ConWrite DoShoP13 LEA ShPStr18(PC),A0 Handshake BSR ConWrite TST.B TurnFlag(A6) BNE.S DoShoP14 LEA ShPStr12(PC),A0 BSR ConWrite BRA.S DoShoP15 DoShoP14 MOVE.B TurnChar(A6),D0 MOVEQ #0,D2 BSR DoShoP42 DoShoP15 LEA ShPStr19(PC),A0 BSR ConWrite MOVE.B TimInFlg(A6),D0 OR.B SndPSFlg(A6),D0 BEQ.S DoShoP16 LEA ShPStr20(PC),A0 BSR ConWrite DoShoP16 LEA ShPStr21(PC),A0 BSR ConWrite MOVE.B OTimInt(A6),D0 Send timeout interval BSR DoShoP40 MOVE.B ITimInt(A6),D0 Receive timeout interval BSR DoShoP41 TST.B TimInFlg(A6) BEQ.S DoShoP17 MOVEQ #'*',D0 BSR ConOut DoShoP17 LEA ShPStr22(PC),A0 BSR ConWrite MOVE.B OPadNumb(A6),D0 Send padding BSR DoShoP40 MOVE.B IPadNumb(A6),D0 Receive padding BSR DoShoP41 LEA ShPStr23(PC),A0 BSR ConWrite MOVE.B OPadChar(A6),D0 Send padding character BSR DoShoP40 MOVE.B IPadChar(A6),D0 Receive padding character BSR DoShoP41 LEA ShPStr24(PC),A0 BSR ConWrite MOVE.B OStPckCh(A6),D0 Send packet start character BSR DoShoP40 MOVE.B IStPckCh(A6),D0 Receive packet start character BSR DoShoP41 LEA ShPStr25(PC),A0 BSR ConWrite MOVE.B OEOL(A6),D0 Send End-Of-Line character BSR DoShoP40 MOVE.B IEOL(A6),D0 Receive End-Of-Line character BSR DoShoP41 LEA ShPStr26(PC),A0 BSR ConWrite MOVE.B OMPckSiz(A6),D0 Send max packet size BSR DoShoP40 TST.B SndPSFlg(A6) BEQ.S DoShoP18 MOVEQ #'*',D0 BRA.S DoShoP19 DoShoP18 MOVEQ #' ',D0 DoShoP19 BSR ConOut MOVE.B IMPckSiz(A6),D0 Receive max packet size MOVEQ #8,D2 BSR DoShoP42 LEA ShPStr27(PC),A0 BSR ConWrite MOVE.B BlChkRq(A6),D0 Block check type MOVEQ #0,D2 BSR DoShoP42 LEA ShPStr28(PC),A0 BSR ConWrite MOVE.B Delay(A6),D0 Delay MOVEQ #0,D2 BSR DoShoP42 LEA ShPStr29(PC),A0 BSR ConWrite MOVE.B RtryInit(A6),D0 Retry limit for initial connection MOVEQ #0,D2 BSR DoShoP42 LEA ShPStr30(PC),A0 BSR ConWrite MOVE.B RtryPack(A6),D0 Retry limit for normal packets MOVEQ #0,D2 BSR DoShoP42 TST.B Bit8Flag(A6) BEQ.S DoShoP20 LEA ShPStr31(PC),A0 BSR ConWrite MOVE.B Bit8Quot(A6),D0 8-th bit prefix BSR ConOut DoShoP20 TST.B ReptFlag(A6) BEQ.S DoShoP21 LEA ShPStr32(PC),A0 BSR ConWrite MOVE.B ReptQuot(A6),D0 Repeat prefix BSR ConOut DoShoP21 LEA ShPStr33(PC),A0 BSR ConWrite TST.B FNameCnv(A6) File name BEQ.S DoShoP22 LEA ShPStr34(PC),A0 BRA.S DoShoP23 DoShoP22 LEA ShPStr35(PC),A0 DoShoP23 BSR ConWrite LEA ShPStr36(PC),A0 BSR ConWrite TST.B Binary(A6) File type BEQ.S DoShoP24 LEA ShPStr37(PC),A0 BRA.S DoShoP25 DoShoP24 LEA ShPStr38(PC),A0 DoShoP25 BSR ConWrite LEA ShPStr39(PC),A0 BSR ConWrite TST.B Warning(A6) File warning BEQ.S DoShoP26 LEA ShPStr40(PC),A0 BRA.S DoShoP27 DoShoP26 LEA ShPStr41(PC),A0 DoShoP27 BSR ConWrite LEA ShPStr42(PC),A0 BSR ConWrite TST.B Quiet(A6) File display BNE.S DoShoP28 LEA ShPStr40(PC),A0 BRA.S DoShoP29 DoShoP28 LEA ShPStr41(PC),A0 DoShoP29 BSR ConWrite LEA ShPStr43(PC),A0 BSR ConWrite TST.B Keep(A6) Incomplete file disposition BEQ.S DoShoP30 LEA ShPStr44(PC),A0 BRA.S DoShoP31 DoShoP30 LEA ShPStr45(PC),A0 DoShoP31 BSR ConWrite BSR NewLine RTS DoShoP40 MOVEQ #11,D2 Use a 11 characters field BRA.S DoShoP42 Join common part DoShoP41 MOVEQ #9,D2 Use a 9 characters field DoShoP42 LEA DataBuf+34(A6),A0 Point to the end of a temporary buffer EXT.W D0 Extend to word EXT.L D0 Extend to long word ST D1 Unsigned conversion wanted MOVEQ #10,D3 Base is 10 BSR IntToAs Convert the number into a string BSR ConWrite Write the obtained string RTS ends END