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

  1.           nam       Kermit68K
  2.           ttl       REMOTE and SHOW commands subroutines module
  3.  
  4. *         Kermit68K: source file K68CM3
  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     K68Commands3,0,0,Edition,0,0
  26.  
  27. *** Code for REMOTE commands execution ***
  28.  
  29. Rm1FlOp   MOVE.B    D0,D7              Save command
  30.           LEA       DataBuf(A6),A1     Pointer to temporary buffer
  31.           MOVEA.L   A1,A0              Pass it to ParsTxt
  32.           BSR       ParsTxt            Get a text string from the command line
  33.           TST.B     D0                 Remote file specified ?
  34.           BLT.S     Rm1FlOp1           No, give error message
  35.           MOVEA.L   A1,A2              Yes
  36.           MOVE.B    D7,D0              Restore command
  37.           SUBA.L    A3,A3              Terminate the SetGCmd arguments list
  38.           BSR       SetGCmd            Setup data buffer and involved variables
  39.           MOVEQ     #SndSrvIS,D7
  40.           BSR       KPSwtch            Enter the protocol automaton switcher
  41.           RTS
  42. Rm1FlOp1  LEA       Rm1FOStr(PC),A0
  43.           BSR       ConWrite
  44.           RTS
  45.  
  46. Rm2FlOp   MOVE.B    D0,D7              Save command
  47.           LEA       DataBuf(A6),A1     Pointer to temporary buffer
  48.           MOVEA.L   A1,A0              Pass it to ParsTxt
  49.           BSR       ParsWrd            Get a text string from the command line
  50.           TST.B     D0                 Remote file 1 specified ?
  51.           BLT.S     Rm2FlOp1           No, give error message
  52.           MOVEA.L   A1,A2              Yes
  53.           LEA       1(A0),A1
  54.           MOVEA.L   A1,A0              Pass it to ParsTxt
  55.           BSR       ParsTxt            Get a text string from the command line
  56.           TST.B     D0                 Remote file 2 specified ?
  57.           BLT.S     Rm2FlOp1           No, give error message
  58.           MOVEA.L   A1,A3              Yes
  59.           MOVE.B    D7,D0              Restore command
  60.           SUBA.L    A4,A4              Terminate the SetGCmd arguments list
  61.           BSR       SetGCmd            Setup data buffer and involved variables
  62.           MOVEQ     #SndSrvIS,D7
  63.           BSR       KPSwtch            Enter the protocol automaton switcher
  64.           RTS
  65. Rm2FlOp1  LEA       Rm2FOStr(PC),A0
  66.           BSR       ConWrite
  67.           RTS
  68.  
  69. *** REMOTE command ***
  70.  
  71. DoREMOT:  BSR       ChkLocl            Check mode
  72.           LEA       REMTable(PC),A1    Pointer to REMOTE commands table
  73.           ST        D1                 Keyword specification is mandatory
  74.           BSR       ParsKyW            Look for a valid REMOTE command
  75.           TST.B     D0                 Ok ?
  76.           BLT.S     DoREMOT1           No, return
  77.           LEA       DoRemTab(PC),A1    Pointer to REMOTE jump table
  78.           BRA       IndxJump           Join common jump routine
  79. DoREMOT1  RTS
  80.  
  81. *** REMOTE COPY command ***
  82.  
  83. DoRemCOP: MOVEQ     #'K',D0            Copy command
  84.           BSR       Rm2FlOp            Call the remote file operation routine
  85.           RTS
  86.  
  87. *** REMOTE CWD command ***
  88.  
  89. DoRmCWD:  SUBA.L    A2,A2              No SetGCmd arguments by default
  90.           LEA       DataBuf(A6),A1     Pointer to temporary buffer
  91.           MOVEA.L   A1,A0              Pass it to ParsTxt
  92.           BSR       ParsTxt            Get a text string from the command line
  93.           TST.B     D0                 Remote directory specified ?
  94.           BLT.S     DoRmCWD1           No, no arguments
  95.           MOVEA.L   A1,A2              Yes
  96.           SUBA.L    A3,A3              Nullify next argument pointer
  97. DoRmCWD1  MOVEQ     #'C',D0            Change working directory command
  98.           BSR       SetGCmd
  99.           MOVEQ     #SndGCmdS,D7
  100.           BSR       KPSwtch            Enter the protocol automaton switcher
  101.           RTS
  102.  
  103. *** REMOTE DELETE command ***
  104.  
  105. DoRemDEL: MOVEQ     #'E',D0            Delete command
  106.           BSR       Rm1FlOp            Call the remote file operation routine
  107.           RTS
  108.  
  109. *** REMOTE DIRECTORY command ***
  110.  
  111. DoRmDIR:  SUBA.L    A2,A2              No SetGCmd arguments by default
  112.           LEA       DataBuf(A6),A1     Pointer to temporary buffer
  113.           MOVEA.L   A1,A0              Pass it to ParsTxt
  114.           BSR       ParsTxt            Get a text string from the command line
  115.           TST.B     D0                 Remote file or directory specified ?
  116.           BLT.S     DoRmDIR1           No, no arguments
  117.           MOVEA.L   A1,A2              Yes
  118.           SUBA.L    A3,A3              Nullify next argument pointer
  119. DoRmDIR1  MOVEQ     #'D',D0            Remote directory command
  120.           BSR       SetGCmd            Setup data buffer and involved variables
  121.           MOVEQ     #SndSrvIS,D7
  122.           BSR       KPSwtch            Enter the protocol automaton switcher
  123.           RTS
  124.  
  125. *** REMOTE HELP command ***
  126.  
  127. DoRmHELP: SUBA.L    A2,A2              No arguments for SetGCmd
  128.           MOVEQ     #'H',D0            Remote help command
  129.           BSR       SetGCmd            Setup data buffer and involved variables
  130.           MOVEQ     #SndSrvIS,D7
  131.           BSR       KPSwtch            Enter the protocol automaton switcher
  132.           RTS
  133.  
  134. *** REMOTE HOST command ***
  135.  
  136. DoRemHOS: LEA       DataBuf(A6),A1
  137.           MOVEA.L   A1,A0
  138.           BSR       ParsTxt
  139.           LEA       CmdBuf(A6),A0
  140.           MOVEQ     #CmdBufLn,D0
  141.           BSR       CopyStr
  142.           BSR       TrnsInit
  143.           MOVE.B    #'C',ServrCmd(A6)
  144.           MOVEQ     #SndSrvIS,D7
  145.           BSR       KPSwtch            Enter the protocol automaton switcher
  146.           RTS
  147.  
  148. *** REMOTE KERMIT command ***
  149.  
  150. DoRemKER: RTS
  151.  
  152. *** REMOTE PRINT command ***
  153.  
  154. DoRemPRI: MOVEQ     #'S',D0
  155.           BSR       Rm1FlOp            Call the remote file operation routine
  156.           RTS
  157.  
  158. *** REMOTE RENAME command ***
  159.  
  160. DoRemREN: MOVEQ     #'R',D0            Rename command
  161.           BSR       Rm2FlOp            Call the remote file operation routine
  162.           RTS
  163.  
  164. *** REMOTE SET command ***
  165.  
  166. DoRemSET: RTS
  167.  
  168. *** REMOTE SPACE command ***
  169.  
  170. DoRmSPA:  SUBA.L    A2,A2              No SetGCmd arguments by default
  171.           LEA       DataBuf(A6),A1     Pointer to temporary buffer
  172.           MOVEA.L   A1,A0              Pass it to ParsTxt
  173.           BSR       ParsTxt            Get a text string from the command line
  174.           TST.B     D0                 Remote directory specified ?
  175.           BLT.S     DoRmSPA1           No, no arguments
  176.           MOVEA.L   A1,A2              Yes
  177.           SUBA.L    A3,A3              Nullify next argument pointer
  178. DoRmSPA1  MOVEQ     #'U',D0            Remote space query command
  179.           BSR       SetGCmd            Setup for generic commands
  180.           MOVEQ     #SndGCmdS,D7
  181.           BSR       KPSwtch            Enter the protocol automaton switcher
  182.           RTS
  183.  
  184. *** REMOTE SUBMIT command ***
  185.  
  186. DoRemSUB: MOVEQ     #'P',D0            Submit command
  187.           BSR       Rm1FlOp            Call the remote file operation routine
  188.           RTS
  189.  
  190. *** REMOTE TYPE command ***
  191.  
  192. DoRemTYP: MOVEQ     #'T',D0            Type command
  193.           BSR       Rm1FlOp            Call the remote file operation routine
  194.           RTS
  195.  
  196. *** REMOTE WHO command ***
  197.  
  198. DoRmWHO:  SUBA.L    A2,A2              No SetGCmd arguments by default
  199.           LEA       DataBuf(A6),A1     Pointer to temporary buffer
  200.           MOVEA.L   A1,A0              Pass it to ParsTxt
  201.           BSR       ParsTxt            Get a text string from the command line
  202.           TST.B     D0                 Remote user name specified ?
  203.           BLT.S     DoRmWHO1           No, no arguments
  204.           MOVEA.L   A1,A2              Yes
  205.           SUBA.L    A3,A3              Nullify next argument pointer
  206. DoRmWHO1  MOVEQ     #'W',D0            Remote who command
  207.           BSR       SetGCmd            Setup data buffer and involved variables
  208.           MOVEQ     #SndSrvIS,D7
  209.           BSR       KPSwtch            Enter the protocol automaton switcher
  210.           RTS
  211.  
  212. *** SHOW command ***
  213.  
  214. DoSHOW:   LEA       SHOWTabl(PC),A1    Pointer to SHOW parameters table
  215.           ST        D1
  216.           BSR       ParsKyW            Look for a valid SHOW option
  217.           TST.B     D0                 Ok ?
  218.           BLT.S     DoSHOW1            No, return
  219.           LEA       DoShoTab(PC),A1    Pointer to SHOW jump table
  220.           BRA       IndxJump           Join common jump routine
  221. DoSHOW1   RTS
  222.  
  223. *** SHOW VERSION command ***
  224.  
  225. DoShoVer: LEA       VersStr(PC),A0     Show the current Kermit68K version
  226.           BSR       ConWrite
  227.           LEA       ShVerStr(PC),A0    And then the warning
  228.           BSR       ConWrite
  229.           RTS
  230.  
  231. *** SHOW PARAMETERS command ***
  232.  
  233. DoShoP:   LEA       ShPStr1(PC),A0     Line name
  234.           BSR       ConWrite
  235.           LEA       LineName(A6),A0
  236.           BSR       ConWrite
  237.  
  238.           LEA       ShPStr2(PC),A0     Line speed
  239.           BSR       ConWrite
  240.           MOVE.L    Speed(A6),D0       Load it
  241.           BLT.S     DoShoP0            Negative, unknown speed
  242.           BSR       TypeUNum           Write the baud rate
  243.           BRA.S     DoShoP01
  244. DoShoP0   LEA       ShPStr3(PC),A0     Say unknown speed
  245.           BSR       ConWrite
  246.  
  247. DoShoP01  LEA       ShPStr4(PC),A0     Mode
  248.           BSR       ConWrite
  249.           TST.B     Local(A6)
  250.           BEQ.S     DoShoP1
  251.           LEA       ShPStr5(PC),A0
  252.           BRA.S     DoShoP2
  253. DoShoP1   LEA       ShPStr6(PC),A0
  254. DoShoP2   BSR       ConWrite
  255.  
  256.           LEA       ShPStr7(PC),A0     Parity selected
  257.           BSR       ConWrite
  258.           MOVE.B    Parity(A6),D0
  259.           CMPI.B    #'E',D0
  260.           BEQ.S     DoShoP3
  261.           CMPI.B    #'O',D0
  262.           BEQ.S     DoShoP4
  263.           CMPI.B    #'M',D0
  264.           BEQ.S     DoShoP5
  265.           CMPI.B    #'S',D0
  266.           BEQ.S     DoShoP6
  267.           LEA       ShPStr12(PC),A0    none
  268.           BRA.S     DoShoP7
  269. DoShoP3   LEA       ShPStr8(PC),A0     even
  270.           BRA.S     DoShoP7
  271. DoShoP4   LEA       ShPStr9(PC),A0     odd
  272.           BRA.S     DoShoP7
  273. DoShoP5   LEA       ShPStr10(PC),A0    mark
  274.           BRA.S     DoShoP7
  275. DoShoP6   LEA       ShPStr11(PC),A0    space
  276. DoShoP7   BSR       ConWrite
  277.  
  278.           LEA       ShPStr13(PC),A0    Duplex
  279.           BSR       ConWrite
  280.           TST.B     Duplex(A6)
  281.           BEQ.S     DoShoP8
  282.           LEA       ShPStr14(PC),A0
  283.           BRA.S     DoShoP9
  284. DoShoP8   LEA       ShPStr15(PC),A0
  285. DoShoP9   BSR       ConWrite
  286.  
  287.           LEA       ShPStr16(PC),A0    Flow control
  288.           BSR       ConWrite
  289.           MOVE.B    Flow(A6),D0
  290.           BEQ.S     DoShoP11
  291.           CMPI.B    #1,D0 Flow(A6)
  292.           BNE.S     DoShoP10
  293.           LEA       ShPStr17(PC),A0
  294.           BRA.S     DoShoP12
  295. DoShoP10  MOVEQ     #0,D2
  296.           BSR       DoShoP42
  297.           BRA.S     DoShoP13
  298. DoShoP11  LEA       ShPStr12(PC),A0
  299. DoShoP12  BSR       ConWrite
  300.  
  301. DoShoP13  LEA       ShPStr18(PC),A0    Handshake
  302.           BSR       ConWrite
  303.           TST.B     TurnFlag(A6)
  304.           BNE.S     DoShoP14
  305.           LEA       ShPStr12(PC),A0
  306.           BSR       ConWrite
  307.           BRA.S     DoShoP15
  308. DoShoP14  MOVE.B    TurnChar(A6),D0
  309.           MOVEQ     #0,D2
  310.           BSR       DoShoP42
  311.  
  312. DoShoP15  LEA       ShPStr19(PC),A0
  313.           BSR       ConWrite
  314.  
  315.           MOVE.B    TimInFlg(A6),D0
  316.           OR.B      SndPSFlg(A6),D0
  317.           BEQ.S     DoShoP16
  318.           LEA       ShPStr20(PC),A0
  319.           BSR       ConWrite
  320.  
  321. DoShoP16  LEA       ShPStr21(PC),A0
  322.           BSR       ConWrite
  323.           MOVE.B    OTimInt(A6),D0     Send timeout interval
  324.           BSR       DoShoP40
  325.           MOVE.B    ITimInt(A6),D0     Receive timeout interval
  326.           BSR       DoShoP41
  327.           TST.B     TimInFlg(A6)
  328.           BEQ.S     DoShoP17
  329.           MOVEQ     #'*',D0
  330.           BSR       ConOut
  331.  
  332. DoShoP17  LEA       ShPStr22(PC),A0
  333.           BSR       ConWrite
  334.           MOVE.B    OPadNumb(A6),D0    Send padding
  335.           BSR       DoShoP40
  336.           MOVE.B    IPadNumb(A6),D0    Receive padding
  337.           BSR       DoShoP41
  338.  
  339.           LEA       ShPStr23(PC),A0
  340.           BSR       ConWrite
  341.           MOVE.B    OPadChar(A6),D0    Send padding character
  342.           BSR       DoShoP40
  343.           MOVE.B    IPadChar(A6),D0    Receive padding character
  344.           BSR       DoShoP41
  345.  
  346.           LEA       ShPStr24(PC),A0
  347.           BSR       ConWrite
  348.           MOVE.B    OStPckCh(A6),D0    Send packet start character
  349.           BSR       DoShoP40
  350.           MOVE.B    IStPckCh(A6),D0    Receive packet start character
  351.           BSR       DoShoP41
  352.  
  353.           LEA       ShPStr25(PC),A0
  354.           BSR       ConWrite
  355.           MOVE.B    OEOL(A6),D0        Send End-Of-Line character
  356.           BSR       DoShoP40
  357.           MOVE.B    IEOL(A6),D0        Receive End-Of-Line character
  358.           BSR       DoShoP41
  359.  
  360.           LEA       ShPStr26(PC),A0
  361.           BSR       ConWrite
  362.           MOVE.B    OMPckSiz(A6),D0    Send max packet size
  363.           BSR       DoShoP40
  364.  
  365.           TST.B     SndPSFlg(A6)
  366.           BEQ.S     DoShoP18
  367.           MOVEQ     #'*',D0
  368.           BRA.S     DoShoP19
  369. DoShoP18  MOVEQ     #' ',D0
  370. DoShoP19  BSR       ConOut
  371.           MOVE.B    IMPckSiz(A6),D0    Receive max packet size
  372.           MOVEQ     #8,D2
  373.           BSR       DoShoP42
  374.  
  375.           LEA       ShPStr27(PC),A0
  376.           BSR       ConWrite
  377.           MOVE.B    BlChkRq(A6),D0     Block check type
  378.           MOVEQ     #0,D2
  379.           BSR       DoShoP42
  380.  
  381.           LEA       ShPStr28(PC),A0
  382.           BSR       ConWrite
  383.           MOVE.B    Delay(A6),D0       Delay
  384.           MOVEQ     #0,D2
  385.           BSR       DoShoP42
  386.  
  387.           LEA       ShPStr29(PC),A0
  388.           BSR       ConWrite
  389.           MOVE.B    RtryInit(A6),D0    Retry limit for initial connection
  390.           MOVEQ     #0,D2
  391.           BSR       DoShoP42
  392.  
  393.           LEA       ShPStr30(PC),A0
  394.           BSR       ConWrite
  395.           MOVE.B    RtryPack(A6),D0    Retry limit for normal packets
  396.           MOVEQ     #0,D2
  397.           BSR       DoShoP42
  398.  
  399.           TST.B     Bit8Flag(A6)
  400.           BEQ.S     DoShoP20
  401.           LEA       ShPStr31(PC),A0
  402.           BSR       ConWrite
  403.           MOVE.B    Bit8Quot(A6),D0    8-th bit prefix
  404.           BSR       ConOut
  405.  
  406. DoShoP20  TST.B     ReptFlag(A6)
  407.           BEQ.S     DoShoP21
  408.           LEA       ShPStr32(PC),A0
  409.           BSR       ConWrite
  410.           MOVE.B    ReptQuot(A6),D0    Repeat prefix
  411.           BSR       ConOut
  412.  
  413. DoShoP21  LEA       ShPStr33(PC),A0
  414.           BSR       ConWrite
  415.           TST.B     FNameCnv(A6)       File name
  416.           BEQ.S     DoShoP22
  417.           LEA       ShPStr34(PC),A0
  418.           BRA.S     DoShoP23
  419. DoShoP22  LEA       ShPStr35(PC),A0
  420. DoShoP23  BSR       ConWrite
  421.  
  422.           LEA       ShPStr36(PC),A0
  423.           BSR       ConWrite
  424.           TST.B     Binary(A6)         File type
  425.           BEQ.S     DoShoP24
  426.           LEA       ShPStr37(PC),A0
  427.           BRA.S     DoShoP25
  428. DoShoP24  LEA       ShPStr38(PC),A0
  429. DoShoP25  BSR       ConWrite
  430.  
  431.           LEA       ShPStr39(PC),A0
  432.           BSR       ConWrite
  433.           TST.B     Warning(A6)        File warning
  434.           BEQ.S     DoShoP26
  435.           LEA       ShPStr40(PC),A0
  436.           BRA.S     DoShoP27
  437. DoShoP26  LEA       ShPStr41(PC),A0
  438. DoShoP27  BSR       ConWrite
  439.  
  440.           LEA       ShPStr42(PC),A0
  441.           BSR       ConWrite
  442.           TST.B     Quiet(A6)          File display
  443.           BNE.S     DoShoP28
  444.           LEA       ShPStr40(PC),A0
  445.           BRA.S     DoShoP29
  446. DoShoP28  LEA       ShPStr41(PC),A0
  447. DoShoP29  BSR       ConWrite
  448.  
  449.           LEA       ShPStr43(PC),A0
  450.           BSR       ConWrite
  451.           TST.B     Keep(A6)           Incomplete file disposition
  452.           BEQ.S     DoShoP30
  453.           LEA       ShPStr44(PC),A0
  454.           BRA.S     DoShoP31
  455. DoShoP30  LEA       ShPStr45(PC),A0
  456. DoShoP31  BSR       ConWrite
  457.  
  458.           BSR       NewLine
  459.           RTS
  460.  
  461. DoShoP40  MOVEQ     #11,D2             Use a 11 characters field
  462.           BRA.S     DoShoP42           Join common part
  463. DoShoP41  MOVEQ     #9,D2              Use a 9 characters field
  464. DoShoP42  LEA       DataBuf+34(A6),A0  Point to the end of a temporary buffer
  465.           EXT.W     D0                 Extend to word
  466.           EXT.L     D0                 Extend to long word
  467.           ST        D1                 Unsigned conversion wanted
  468.           MOVEQ     #10,D3             Base is 10
  469.           BSR       IntToAs            Convert the number into a string
  470.           BSR       ConWrite           Write the obtained string
  471.           RTS
  472.  
  473.           ends
  474.           END
  475.