home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / os968ka / k6ocm2.asm < prev    next >
Assembly Source File  |  2020-01-01  |  17KB  |  350 lines

  1.           nam       Kermit68K
  2.           ttl       SET command subroutines module
  3.  
  4. *         Kermit68K: source file K68CM2
  5. *
  6. * Author: Roberto Bagnara (Bagnara@Iboinfn.Bitnet),
  7. * Bologna University, Physics Department, July 1987.
  8. *
  9. * All rights reserved to Bologna University, Italy.
  10. *
  11. * Permission is granted to any individual or institution
  12. * to use, copy, or redistribute this software so long as
  13. * it  is not  sold for  profit, provided  this copyright
  14. * notice is retained.
  15. *
  16. * Modification History:
  17. *
  18. * Version  Date    Who              Comments
  19. *
  20. * 1.0.00   870701  Roberto Bagnara  First official release
  21.  
  22.           use       DefsFile
  23.  
  24. Edition   equ       0
  25.           psect     K68Commands2,0,0,Edition,0,0
  26.  
  27. DoSET:    LEA       SETTable(PC),A1    Pointer to SET parameters table
  28.           ST        D1
  29.           BSR       ParsKyW            Look for a valid SET parameter
  30.           TST.B     D0                 Ok ?
  31.           BLT.S     DoSET1             No, return
  32.           LEA       DoSetTab(PC),A1    Pointer to SET jump table
  33.           BRA       IndxJump           Join common jump routine
  34. DoSET1    RTS
  35.  
  36. DoSSEND:  LEA       SSRTable(PC),A1    Point to SET SEND/RECEIVE params table
  37.           ST        D1
  38.           BSR       ParsKyW            Look for a valid SET SEND/RECEIVE param
  39.           TST.B     D0                 Ok ?
  40.           BLT.S     DoSSEND1           No, return
  41.           LEA       DoSetSTb(PC),A1    Pointer to SET SEND jump table
  42.           BRA       IndxJump           Join common jump routine
  43. DoSSEND1  RTS
  44.  
  45. DoSRECV:  LEA       SSRTable(PC),A1    Point to SET SEND/RECEIVE params table
  46.           ST        D1
  47.           BSR       ParsKyW            Look for a valid SET SEND/RECEIVE param
  48.           TST.B     D0                 Ok ?
  49.           BLT.S     DoSRECV1           No, return
  50.           LEA       DoSetRTb(PC),A1    Pointer to SET RECEIVE jump table
  51.           BRA       IndxJump           Join common jump routine
  52. DoSRECV1  RTS
  53.  
  54. DoSFILE:  LEA       SFILTabl(PC),A1    Point to SET FILE parameters table
  55.           ST        D1
  56.           BSR       ParsKyW            Look for a valid SET FILE parameter
  57.           TST.B     D0                 Ok ?
  58.           BLT.S     DoSFILE1           No, return
  59.           LEA       DoSFlTab(PC),A1    Pointer to SET FILE jump table
  60.           BRA       IndxJump           Join common jump routine
  61. DoSFILE1  RTS
  62.  
  63. DoSRTRY:  LEA       SRETTabl(PC),A1    Point to SET RETRY parameters table
  64.           ST        D1
  65.           BSR       ParsKyW            Look for a valid SET RETRY parameter
  66.           TST.B     D0                 Ok ?
  67.           BLT.S     DoSRTRY1           No, return
  68.           LEA       DoSRtTab(PC),A1    Pointer to SET RETRY jump table
  69.           BRA       IndxJump           Join common jump routine
  70. DoSRTRY1  RTS
  71.  
  72. DoStPRM:  LEA       DataBuf(A6),A1     Pointer to temporary buffer
  73.           MOVEA.L   A1,A0              Pass it to ParsTxt
  74.           BSR       ParsTxt            Get a text string from the command line
  75.           TST.B     D0                 Ok ?
  76.           BLT.S     DoStPRM1           No, return
  77.           LEA       Prompt(A6),A0      Pointer to the prompt string
  78.           MOVEQ     #PromptML,D0       Max prompt length
  79.           BSR       CopyStr            Copy
  80. DoStPRM1  RTS
  81.  
  82. DoSetESC: MOVEQ     #Escape,D7         Relative address escape character
  83.           BRA.S     SetCtCh            Join common parameter setter
  84.  
  85. DoStRMrk: MOVEQ     #IStPckCh,D7       Relative address receive pack marker
  86.           BRA.S     SetCtCh            Join common parameter setter
  87.  
  88. DoStSMrk: MOVEQ     #OStPckCh,D7       Relative address send packet marker
  89.           BRA.S     SetCtCh            Join common parameter setter
  90.  
  91. DoStRPdC: MOVEQ     #IPadChar,D7       Relative address receive pad character
  92.           BRA.S     SetCtCh            Join common parameter setter
  93.  
  94. DoStSPdC: MOVEQ     #OPadChar,D7       Relative address send pad character
  95.           BRA.S     SetCtCh            Join common parameter setter
  96.  
  97. DoStREOL: MOVEQ     #IEOL,D7           Relative address receive EOL character
  98.           BRA.S     SetCtCh            Join common parameter setter
  99.  
  100. DoStSEOL: MOVEQ     #OEOL,D7           Relative address send EOL character
  101. *          BRA.S     SetCtCh            Join common parameter setter
  102.  
  103. ********************************* SetCtCh ****************************
  104. *                                                                     *
  105. *  Look for a control character ASCII code specification, then set    *
  106. *  the addressed variable.                                            *
  107. *                                                                     *
  108. *         Entry conditions : D7.L Relative (to A6) address of the     *
  109. *                                 variable to set                     *
  110. *                                                                     *
  111. *         Exit  conditions : none                                     *
  112. *                                                                     *
  113. ***********************************************************************
  114. SetCtCh   MOVEQ     #Asc_Nul,D1        Valid range lower bound
  115.           MOVEQ     #Asc_Del,D2        Valid range upper bound
  116.           BSR       ParsNm             Try to get a number
  117.           TST.B     D1                 Invalid number ?
  118.           BLT.S     SetCtCh2           Yes, return
  119.           CMPI.B    #Asc_US,D0         No, check for ASCII control range
  120.           BLS.S     SetCtCh1           Ok, set the parameter
  121.           CMPI.L    #Asc_Del,D0        Delete ?
  122.           BEQ.S     SetCtCh1           Yes, set the parameter
  123.           LEA       SetCtStr(PC),A1    No, not in control range
  124.           LEA       DataBuf(A6),A0     Point to the guilty number
  125.           BSR       ParsErr            Give appropriate error message
  126.           BRA.S     SetCtCh2
  127. SetCtCh1  MOVE.B    D0,(A6,D7.L)       Finally set the parameter
  128. SetCtCh2  RTS
  129.  
  130. DoStRPdN: MOVEQ     #IPadNumb,D7       Relative address receive pad number
  131.           MOVEQ     #0,D1              Valid range lower bound
  132.           MOVEQ     #100,D2            Valid range upper bound
  133.           BRA.S     SetNPar            Join common parameter setter
  134.  
  135. DoStSPdN: MOVEQ     #OPadNumb,D7       Relative address send pad number
  136.           MOVEQ     #0,D1              Valid range lower bound
  137.           MOVEQ     #100,D2            Valid range upper bound
  138.           BRA.S     SetNPar            Join common parameter setter
  139.  
  140. DoStRTIM: ST        TimInFlg(A6)       Set flag to allow overriding Send-Init
  141.           MOVEQ     #ITimInt,D7        Relative address receive timeout
  142.           MOVEQ     #1,D1              Valid range lower bound
  143.           MOVEQ     #50,D2             Valid range upper bound
  144.           BRA.S     SetNPar            Join common parameter setter
  145.  
  146. DoStSTIM: MOVEQ     #OTimInt,D7        Relative address send timeout interval
  147.           MOVEQ     #1,D1              Valid range lower bound
  148.           MOVEQ     #50,D2             Valid range upper bound
  149.           BRA.S     SetNPar            Join common parameter setter
  150.  
  151. DoStRMPS: MOVEQ     #IMPckSiz,D7       Relative address receive max packet size
  152.           MOVEQ     #10,D1             Valid range lower bound
  153.           MOVEQ     #94,D2             Valid range upper bound
  154.           BRA.S     SetNPar            Join common parameter setter
  155.  
  156. DoStSMPS: ST        SndPSFlg(A6)       Set flag to allow overriding Send-Init
  157.           MOVEQ     #OMPckSiz,D7       Relative address send max packet size
  158.           MOVEQ     #10,D1             Valid range lower bound
  159.           MOVEQ     #94,D2             Valid range upper bound
  160.           BRA.S     SetNPar            Join common parameter setter
  161.  
  162. DoStDLAY: MOVEQ     #Delay,D7          Relative address delay time before send
  163.           MOVEQ     #0,D1              Valid range lower bound
  164.           MOVEQ     #100,D2            Valid range upper bound
  165.           BRA.S     SetNPar            Join common parameter setter
  166.  
  167. DoSetRtI: MOVEQ     #RtryInit,D7       Relative address initial retry limit
  168.           MOVEQ     #0,D1              Valid range lower bound
  169.           MOVEQ     #100,D2            Valid range upper bound
  170.           BRA.S     SetNPar            Join common parameter setter
  171.  
  172. DoSetRtP: MOVEQ     #RtryPack,D7       Relative address normal retry limit
  173.           MOVEQ     #0,D1              Valid range lower bound
  174.           MOVEQ     #100,D2            Valid range upper bound
  175. *          BRA.S     SetNPar           Join common parameter setter
  176.  
  177. ********************************* SetNPar  ***************************
  178. *                                                                     *
  179. *  Look for a number specification, then set the addressed variable.  *
  180. *                                                                     *
  181. *         Entry conditions : D7.L Relative (to A6) address of the     *
  182. *                                 variable to set                     *
  183. *                            D1.L range specification, lower bound    *
  184. *                            D2.L range specification, upper bound    *
  185. *                                                                     *
  186. *         Exit  conditions : none                                     *
  187. *                                                                     *
  188. ***********************************************************************
  189. SetNPar   BSR       ParsNm             Try to get a number
  190.           TST.B     D1                 Invalid number ?
  191.           BLT.S     SetNPar1           Yes, return
  192.           MOVE.B    D0,(A6,D7.L)       No, set the parameter
  193. SetNPar1  RTS
  194.  
  195. DoStPAR:  LEA       ParTable(PC),A1    Pointer to parity keywords table
  196.           ST        D1
  197.           BSR       ParsKyW            Look for a valid parity specification
  198.           TST.B     D0                 Ok ?
  199.           BLT.S     DoStPAR1           No, return
  200.           MOVE.B    D0,Parity(A6)      Yes, set parity to the requested value
  201. DoStPAR1  RTS
  202.  
  203. DoStBCT:  LEA       BlCkTabl(PC),A1    Pointer to block check type table
  204.           ST        D1                 A keyword is mandatory
  205.           BSR       ParsKyW            Look for valid block check specification
  206.           TST.B     D0                 Ok ?
  207.           BLT.S     DoStBCT1           No, return
  208.           MOVE.B    D0,BlChkRq(A6)     Yes, set block check to requested value
  209. DoStBCT1  RTS
  210.  
  211. DoStIFD:  LEA       IFlDTabl(PC),A1    Points to incomplete file disp table
  212.           ST        D1
  213.           BSR       ParsKyW            Look for valid disposition specification
  214.           TST.B     D0                 Ok ?
  215.           BLT.S     DoStIFD1           No, return
  216.           SNE       Keep(A6)           Yes, set the keep flag accordingly
  217. DoStIFD1  RTS
  218.  
  219. DoStFNm:  LEA       FNamTabl(PC),A1    Points to incomplete file disp table
  220.           ST        D1
  221.           BSR       ParsKyW            Look for valid disposition specification
  222.           TST.B     D0                 Ok ?
  223.           BLT.S     DoStFNm1           No, return
  224.           SNE       FNameCnv(A6)       Yes, set conversion flag accordingly
  225. DoStFNm1  RTS
  226.  
  227. DoStFDs:  LEA       OnOfTabl(PC),A1    Points to on/off keywords table
  228.           ST        D1
  229.           BSR       ParsKyW            Look for valid on/off specification
  230.           TST.B     D0                 Ok ?
  231.           BLT.S     DoStFDs1           No, return
  232.           SEQ       Quiet(A6)          Yes, set the quiet flag accordingly
  233. DoStFDs1  RTS
  234.  
  235. DoStFTp:  LEA       FTypTabl(PC),A1    Points to file type keywords table
  236.           ST        D1
  237.           BSR       ParsKyW            Look for a valid file type specification
  238.           TST.B     D0                 Ok ?
  239.           BLT.S     DoStFTp1           No, return
  240.           SNE       Binary(A6)         Yes, set the binary flag accordingly
  241. DoStFTp1  RTS
  242.  
  243. DoStFWn:  LEA       OnOfTabl(PC),A1    Points to on/off keywords table
  244.           ST        D1
  245.           BSR       ParsKyW            Look for valid on/off specification
  246.           TST.B     D0                 Ok ?
  247.           BLT.S     DoStFWn1           No, return
  248.           SNE       Warning(A6)        Yes, set the warning flag accordingly
  249. DoStFWn1  RTS
  250.  
  251. DoStDUP:  LEA       DuplTabl(PC),A1    Points to duplex keywords table
  252.           ST        D1
  253.           BSR       ParsKyW            Look for valid duplex specification
  254.           TST.B     D0                 Ok ?
  255.           BLT.S     DoStDUP1           No, return
  256.           SNE       Duplex(A6)         Yes, set the duplex flag accordingly
  257. DoStDUP1  RTS
  258.  
  259. DoStFLW:  LEA       FlowTabl(PC),A1    Points to flow control keywords table
  260.           ST        D1
  261.           BSR       ParsKyW            Look for valid flow specification
  262.           TST.B     D0                 Ok ?
  263.           BLT.S     DoStFLW1           No, return
  264.           MOVE.B    D0,Flow(A6)        Yes, set the flow control variable
  265. DoStFLW1  RTS
  266.  
  267. DoStHND:  LEA       HandTabl(PC),A1    Points to handshake chars keywords table
  268.           ST        D1
  269.           BSR       ParsKyW            Look for valid handshake specification
  270.           TST.B     D0                 Ok ?
  271.           BLT.S     DoStHND1           No, return
  272.           SNE       TurnFlag(A6)       Yes, set the handshake flag accordingly
  273.           MOVE.B    D0,TurnChar(A6)    Line turnaround character
  274. DoStHND1  RTS
  275.  
  276. DoStLIN:  LEA       DataBuf(A6),A1     Pointer to temporary buffer
  277.           MOVEA.L   A1,A0              Pass it to ParsTxt
  278.           BSR       ParsTxt            Get a text string from the command line
  279.           TST.B     D0                 Ok ?
  280.           BLT.S     DoStLIN1           No, return
  281.           MOVEQ     #HostLine,D1       Yes, close the old line
  282.           BSR       FilClose
  283.           MOVEQ     #RdWrOp,D0         Try to open the new line
  284.           MOVEQ     #HostLine,D1       This is the channel number
  285.           MOVEA.L   A1,A0              Point to the new line name
  286.           BSR       FilOpen            Open, if possible
  287.           TST.B     D0                 Ok ?
  288.           BEQ.S     DoStLIN2           No, give error message, reopen old line
  289.           LEA       LineName(A6),A0    Yes, point to the line name string
  290.           MOVEQ     #LinNamML,D0       Max line name length
  291.           BSR       CopyStr            Copy
  292.           LEA       ConLinNm(PC),A1    Point to the console line name
  293.           BSR       CompStr            Compare the two line names
  294.           TST.B     D0                 Are equal ?
  295.           SEQ       Local(A6)          If not we are local, remote otherwise
  296.           BEQ.S     DoStLIN1           If local, leave speed unchanged
  297.           MOVE.L    #-1,Speed(A6)      If remote, say speed unknown
  298. DoStLIN1  RTS
  299. DoStLIN2  LEA       OpLnEStr(PC),A1    Point to the error message string
  300.           BSR       ParsErr            Say that we can't open the new line
  301.           LEA       LineName(A6),A0    Point to the line name string
  302.           MOVEQ     #RdWrOp,D0         Reopen the old line
  303.           MOVEQ     #HostLine,D1       This is the channel number
  304.           BSR       FilOpen            Open now
  305.           RTS
  306.  
  307. DoStSPE:  MOVEQ     #50,D1             Valid range lower bound
  308.           MOVE.L    #19200,D2          Valid range upper bound
  309.           BSR       ParsNm             Try to get a valid number specification
  310.           TST.B     D1                 Valid number on input ?
  311.           BLT.S     DoStSPE1           No, return
  312.           BSR.S     ChkBaud            Check if requested speed is supported
  313.           TST.B     D1                 Ok ?
  314.           BEQ.S     DoStSPE1           No, return
  315.           MOVE.L    D0,Speed(A6)       Yes, set the baud rate variable
  316.           MOVE.L    D0,D2              Pass baud rate to ChanCtrl
  317.           MOVEQ     #HostLine,D1       Pass channel number to ChanCtrl
  318.           MOVEQ     #SetBaud,D0        Pass request code to ChanCtrl
  319.           BSR       ChanCtrl           Physically set the host line baud rate
  320. DoStSPE1  RTS
  321.  
  322. ChkBaud:  LEA       SpeedTbl(PC),A0    Pointer to baud rates table
  323. ChkBaud1  TST.L     (A0)               End of table ?
  324.           BLT.S     ChkBaud2           Yes, unsupported baud rate
  325.           CMP.L     (A0)+,D0           No, compare, baud rate found ?
  326.           BNE.S     ChkBaud1           No, loop until found or end of table
  327.           ST        D1                 Yes, set completion code accordingly
  328.           RTS
  329. ChkBaud2  LEA       DataBuf(A6),A0     Point to the guilty number
  330.           LEA       UnsBRStr(PC),A1    Point to the error message
  331.           BSR       ParsErr            Give error message
  332.           SF        D1                 Return a negative completion code
  333.           RTS
  334.  
  335. SpeedTbl  DC.L         50
  336.           DC.L        110
  337.           DC.L        150
  338.           DC.L        300
  339.           DC.L        600
  340.           DC.L       1200
  341.           DC.L       2400
  342.           DC.L       4800
  343.           DC.L       9600
  344.           DC.L      19200
  345.           DC.L      38400
  346.           DC.L      -1
  347.  
  348.           ends
  349.           END
  350.