nam Kermit68K ttl SET command subroutines module * Kermit68K: source file K68CM2 * * 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 K68Commands2,0,0,Edition,0,0 DoSET: LEA SETTable(PC),A1 Pointer to SET parameters table ST D1 BSR ParsKyW Look for a valid SET parameter TST.B D0 Ok ? BLT.S DoSET1 No, return LEA DoSetTab(PC),A1 Pointer to SET jump table BRA IndxJump Join common jump routine DoSET1 RTS DoSSEND: LEA SSRTable(PC),A1 Point to SET SEND/RECEIVE params table ST D1 BSR ParsKyW Look for a valid SET SEND/RECEIVE param TST.B D0 Ok ? BLT.S DoSSEND1 No, return LEA DoSetSTb(PC),A1 Pointer to SET SEND jump table BRA IndxJump Join common jump routine DoSSEND1 RTS DoSRECV: LEA SSRTable(PC),A1 Point to SET SEND/RECEIVE params table ST D1 BSR ParsKyW Look for a valid SET SEND/RECEIVE param TST.B D0 Ok ? BLT.S DoSRECV1 No, return LEA DoSetRTb(PC),A1 Pointer to SET RECEIVE jump table BRA IndxJump Join common jump routine DoSRECV1 RTS DoSFILE: LEA SFILTabl(PC),A1 Point to SET FILE parameters table ST D1 BSR ParsKyW Look for a valid SET FILE parameter TST.B D0 Ok ? BLT.S DoSFILE1 No, return LEA DoSFlTab(PC),A1 Pointer to SET FILE jump table BRA IndxJump Join common jump routine DoSFILE1 RTS DoSRTRY: LEA SRETTabl(PC),A1 Point to SET RETRY parameters table ST D1 BSR ParsKyW Look for a valid SET RETRY parameter TST.B D0 Ok ? BLT.S DoSRTRY1 No, return LEA DoSRtTab(PC),A1 Pointer to SET RETRY jump table BRA IndxJump Join common jump routine DoSRTRY1 RTS DoStPRM: 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 DoStPRM1 No, return LEA Prompt(A6),A0 Pointer to the prompt string MOVEQ #PromptML,D0 Max prompt length BSR CopyStr Copy DoStPRM1 RTS DoSetESC: MOVEQ #Escape,D7 Relative address escape character BRA.S SetCtCh Join common parameter setter DoStRMrk: MOVEQ #IStPckCh,D7 Relative address receive pack marker BRA.S SetCtCh Join common parameter setter DoStSMrk: MOVEQ #OStPckCh,D7 Relative address send packet marker BRA.S SetCtCh Join common parameter setter DoStRPdC: MOVEQ #IPadChar,D7 Relative address receive pad character BRA.S SetCtCh Join common parameter setter DoStSPdC: MOVEQ #OPadChar,D7 Relative address send pad character BRA.S SetCtCh Join common parameter setter DoStREOL: MOVEQ #IEOL,D7 Relative address receive EOL character BRA.S SetCtCh Join common parameter setter DoStSEOL: MOVEQ #OEOL,D7 Relative address send EOL character * BRA.S SetCtCh Join common parameter setter ********************************* SetCtCh **************************** * * * Look for a control character ASCII code specification, then set * * the addressed variable. * * * * Entry conditions : D7.L Relative (to A6) address of the * * variable to set * * * * Exit conditions : none * * * *********************************************************************** SetCtCh MOVEQ #Asc_Nul,D1 Valid range lower bound MOVEQ #Asc_Del,D2 Valid range upper bound BSR ParsNm Try to get a number TST.B D1 Invalid number ? BLT.S SetCtCh2 Yes, return CMPI.B #Asc_US,D0 No, check for ASCII control range BLS.S SetCtCh1 Ok, set the parameter CMPI.L #Asc_Del,D0 Delete ? BEQ.S SetCtCh1 Yes, set the parameter LEA SetCtStr(PC),A1 No, not in control range LEA DataBuf(A6),A0 Point to the guilty number BSR ParsErr Give appropriate error message BRA.S SetCtCh2 SetCtCh1 MOVE.B D0,(A6,D7.L) Finally set the parameter SetCtCh2 RTS DoStRPdN: MOVEQ #IPadNumb,D7 Relative address receive pad number MOVEQ #0,D1 Valid range lower bound MOVEQ #100,D2 Valid range upper bound BRA.S SetNPar Join common parameter setter DoStSPdN: MOVEQ #OPadNumb,D7 Relative address send pad number MOVEQ #0,D1 Valid range lower bound MOVEQ #100,D2 Valid range upper bound BRA.S SetNPar Join common parameter setter DoStRTIM: ST TimInFlg(A6) Set flag to allow overriding Send-Init MOVEQ #ITimInt,D7 Relative address receive timeout MOVEQ #1,D1 Valid range lower bound MOVEQ #50,D2 Valid range upper bound BRA.S SetNPar Join common parameter setter DoStSTIM: MOVEQ #OTimInt,D7 Relative address send timeout interval MOVEQ #1,D1 Valid range lower bound MOVEQ #50,D2 Valid range upper bound BRA.S SetNPar Join common parameter setter DoStRMPS: MOVEQ #IMPckSiz,D7 Relative address receive max packet size MOVEQ #10,D1 Valid range lower bound MOVEQ #94,D2 Valid range upper bound BRA.S SetNPar Join common parameter setter DoStSMPS: ST SndPSFlg(A6) Set flag to allow overriding Send-Init MOVEQ #OMPckSiz,D7 Relative address send max packet size MOVEQ #10,D1 Valid range lower bound MOVEQ #94,D2 Valid range upper bound BRA.S SetNPar Join common parameter setter DoStDLAY: MOVEQ #Delay,D7 Relative address delay time before send MOVEQ #0,D1 Valid range lower bound MOVEQ #100,D2 Valid range upper bound BRA.S SetNPar Join common parameter setter DoSetRtI: MOVEQ #RtryInit,D7 Relative address initial retry limit MOVEQ #0,D1 Valid range lower bound MOVEQ #100,D2 Valid range upper bound BRA.S SetNPar Join common parameter setter DoSetRtP: MOVEQ #RtryPack,D7 Relative address normal retry limit MOVEQ #0,D1 Valid range lower bound MOVEQ #100,D2 Valid range upper bound * BRA.S SetNPar Join common parameter setter ********************************* SetNPar *************************** * * * Look for a number specification, then set the addressed variable. * * * * Entry conditions : D7.L Relative (to A6) address of the * * variable to set * * D1.L range specification, lower bound * * D2.L range specification, upper bound * * * * Exit conditions : none * * * *********************************************************************** SetNPar BSR ParsNm Try to get a number TST.B D1 Invalid number ? BLT.S SetNPar1 Yes, return MOVE.B D0,(A6,D7.L) No, set the parameter SetNPar1 RTS DoStPAR: LEA ParTable(PC),A1 Pointer to parity keywords table ST D1 BSR ParsKyW Look for a valid parity specification TST.B D0 Ok ? BLT.S DoStPAR1 No, return MOVE.B D0,Parity(A6) Yes, set parity to the requested value DoStPAR1 RTS DoStBCT: LEA BlCkTabl(PC),A1 Pointer to block check type table ST D1 A keyword is mandatory BSR ParsKyW Look for valid block check specification TST.B D0 Ok ? BLT.S DoStBCT1 No, return MOVE.B D0,BlChkRq(A6) Yes, set block check to requested value DoStBCT1 RTS DoStIFD: LEA IFlDTabl(PC),A1 Points to incomplete file disp table ST D1 BSR ParsKyW Look for valid disposition specification TST.B D0 Ok ? BLT.S DoStIFD1 No, return SNE Keep(A6) Yes, set the keep flag accordingly DoStIFD1 RTS DoStFNm: LEA FNamTabl(PC),A1 Points to incomplete file disp table ST D1 BSR ParsKyW Look for valid disposition specification TST.B D0 Ok ? BLT.S DoStFNm1 No, return SNE FNameCnv(A6) Yes, set conversion flag accordingly DoStFNm1 RTS DoStFDs: LEA OnOfTabl(PC),A1 Points to on/off keywords table ST D1 BSR ParsKyW Look for valid on/off specification TST.B D0 Ok ? BLT.S DoStFDs1 No, return SEQ Quiet(A6) Yes, set the quiet flag accordingly DoStFDs1 RTS DoStFTp: LEA FTypTabl(PC),A1 Points to file type keywords table ST D1 BSR ParsKyW Look for a valid file type specification TST.B D0 Ok ? BLT.S DoStFTp1 No, return SNE Binary(A6) Yes, set the binary flag accordingly DoStFTp1 RTS DoStFWn: LEA OnOfTabl(PC),A1 Points to on/off keywords table ST D1 BSR ParsKyW Look for valid on/off specification TST.B D0 Ok ? BLT.S DoStFWn1 No, return SNE Warning(A6) Yes, set the warning flag accordingly DoStFWn1 RTS DoStDUP: LEA DuplTabl(PC),A1 Points to duplex keywords table ST D1 BSR ParsKyW Look for valid duplex specification TST.B D0 Ok ? BLT.S DoStDUP1 No, return SNE Duplex(A6) Yes, set the duplex flag accordingly DoStDUP1 RTS DoStFLW: LEA FlowTabl(PC),A1 Points to flow control keywords table ST D1 BSR ParsKyW Look for valid flow specification TST.B D0 Ok ? BLT.S DoStFLW1 No, return MOVE.B D0,Flow(A6) Yes, set the flow control variable DoStFLW1 RTS DoStHND: LEA HandTabl(PC),A1 Points to handshake chars keywords table ST D1 BSR ParsKyW Look for valid handshake specification TST.B D0 Ok ? BLT.S DoStHND1 No, return SNE TurnFlag(A6) Yes, set the handshake flag accordingly MOVE.B D0,TurnChar(A6) Line turnaround character DoStHND1 RTS DoStLIN: 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 DoStLIN1 No, return MOVEQ #HostLine,D1 Yes, close the old line BSR FilClose MOVEQ #RdWrOp,D0 Try to open the new line MOVEQ #HostLine,D1 This is the channel number MOVEA.L A1,A0 Point to the new line name BSR FilOpen Open, if possible TST.B D0 Ok ? BEQ.S DoStLIN2 No, give error message, reopen old line LEA LineName(A6),A0 Yes, point to the line name string MOVEQ #LinNamML,D0 Max line name length BSR CopyStr Copy LEA ConLinNm(PC),A1 Point to the console line name BSR CompStr Compare the two line names TST.B D0 Are equal ? SEQ Local(A6) If not we are local, remote otherwise BEQ.S DoStLIN1 If local, leave speed unchanged MOVE.L #-1,Speed(A6) If remote, say speed unknown DoStLIN1 RTS DoStLIN2 LEA OpLnEStr(PC),A1 Point to the error message string BSR ParsErr Say that we can't open the new line LEA LineName(A6),A0 Point to the line name string MOVEQ #RdWrOp,D0 Reopen the old line MOVEQ #HostLine,D1 This is the channel number BSR FilOpen Open now RTS DoStSPE: MOVEQ #50,D1 Valid range lower bound MOVE.L #19200,D2 Valid range upper bound BSR ParsNm Try to get a valid number specification TST.B D1 Valid number on input ? BLT.S DoStSPE1 No, return BSR.S ChkBaud Check if requested speed is supported TST.B D1 Ok ? BEQ.S DoStSPE1 No, return MOVE.L D0,Speed(A6) Yes, set the baud rate variable MOVE.L D0,D2 Pass baud rate to ChanCtrl MOVEQ #HostLine,D1 Pass channel number to ChanCtrl MOVEQ #SetBaud,D0 Pass request code to ChanCtrl BSR ChanCtrl Physically set the host line baud rate DoStSPE1 RTS ChkBaud: LEA SpeedTbl(PC),A0 Pointer to baud rates table ChkBaud1 TST.L (A0) End of table ? BLT.S ChkBaud2 Yes, unsupported baud rate CMP.L (A0)+,D0 No, compare, baud rate found ? BNE.S ChkBaud1 No, loop until found or end of table ST D1 Yes, set completion code accordingly RTS ChkBaud2 LEA DataBuf(A6),A0 Point to the guilty number LEA UnsBRStr(PC),A1 Point to the error message BSR ParsErr Give error message SF D1 Return a negative completion code RTS SpeedTbl DC.L 50 DC.L 110 DC.L 150 DC.L 300 DC.L 600 DC.L 1200 DC.L 2400 DC.L 4800 DC.L 9600 DC.L 19200 DC.L 38400 DC.L -1 ends END