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

  1.           nam       Kermit68K
  2.           ttl       Main program module
  3.  
  4. *         Kermit68K: source file K68MAI
  5.  
  6. ********************************************************************************
  7. ********************************************************************************
  8. *  ****  *        *       ***   *****   *  *        ***      **      **  ****  *
  9. *  ***  **  *******  ***   **    ***    *  ****  *****  ******  ****  *  ***  **
  10. *  **  ***  *******  ****  **  *  *  *  *  ****  ****  *******  ****  *  **  ***
  11. *  *  ****  *******  ***   **  **   **  *  ****  ****  *******  ****  *  *  ****
  12. *    *****      ***       ***  *** ***  *  ****  ****       ***      **    *****
  13. *  *  ****  *******  **  ****  *******  *  ****  ****  ****  *  ****  *  *  ****
  14. *  **  ***  *******  ***  ***  *******  *  ****  ****  ****  *  ****  *  **  ***
  15. *  ***  **  *******  ****  **  *******  *  ****  ****  ****  *  ****  *  ***  **
  16. *  ****  *        *  *****  *  *******  *  ****  *****      ***      **  ****  *
  17. ********************************************************************************
  18. ********************************************************************************
  19. *                                                                              *
  20. *         Kermit implementation for the MC68000 microprocessors family         *
  21. *                                                                              *
  22. *                                                                              *
  23. *   Author:        Roberto Bagnara, Physics Department, Bologna University     *
  24. *                                                                              *
  25. *   Started:       02 May       1986 by rb                                     *
  26. *   Last modified: 01 July      1987 by rb                                     *
  27. *                                                                              *
  28. *   Modified by:   Steve Williams, University of Texas at Austin               *
  29. *                                                                              *
  30. *   Status :       INCOMPLETE                                                  *
  31. *                                                                              *
  32. *                                                                              *
  33. *   Modification History:                                                      *
  34. *                                                                              *
  35. *   Version  Date    Who              Comments                                 *
  36. *                                                                              *
  37. *   1.0.00   870701  Roberto Bagnara  First official release                   *
  38. *                                                                              *
  39. ********************************************************************************
  40.  
  41.           use       DefsFile
  42.  
  43. TypeLang  equ       (Prgrm<<8)+Objct    Executable 68000 native code
  44. AttrRev   equ       (ReEnt<<8)+0        Re-entrant code, revision 0
  45. Edition   equ       0                   Edition number
  46. Stack     equ       8192                Stack space needed
  47.  
  48.           psect     Kermit,TypeLang,AttrRev,Edition,Stack,Kerm68K
  49.  
  50.  
  51. ********************************* Kerm68K *****************************ok
  52. *                                                                     *
  53. *  Kermit68K main program.                                            *
  54. *                                                                     *
  55. *         Entry conditions : none                                     *
  56. *                                                                     *
  57. *         Exit  conditions : none                                     *
  58. *                                                                     *
  59. ***********************************************************************
  60. Kerm68K:  LEA       VarArea(A6),A6     Correct the $8000 bias of OS-9
  61.           BSR       InitAll            Initialize all Kermit68K variables
  62.           BSR       SysInit            Initialize any system dependent thing
  63.           BSR       CmdLnP             Parse the command line, if possible
  64.           LEA       InitFile(PC),A0    Point to the init file name
  65.           MOVEQ     #ReadOp,D0         We want to read it
  66.           MOVEQ     #TakeFil0,D1       This is the channel number
  67.           BSR       FilOpen            Try to open the init file
  68.           TST.B     D0                 Success ?
  69.           BEQ.S     Kerm68K1           No, no message, parse user commands
  70.           CLR.B     TakLevel(A6)       Yes, we are interpreting the take file 0
  71. Kerm68K1  BSR       Parser             Parse interactive commands until done
  72.           ST        D0                 Finally return a positive cc ...
  73.           BRA       SysExod            ... and the control to system
  74.  
  75. ******************************** InitAll ******************************ok
  76. *                                                                     *
  77. *  Startup initialization routine.                                    *
  78. *                                                                     *
  79. *         Entry conditions : none                                     *
  80. *                                                                     *
  81. *         Exit  conditions : D0.L destroyed                           *
  82. *                                                                     *
  83. ***********************************************************************
  84. InitAll   MOVE.B    #MyEOL,IEOL(A6)        Set EOL for incoming packets
  85.           MOVE.B    #DefEOL,OEOL(A6)       Set EOL for outgoing packets
  86.           MOVE.B    #DefCtlQt,ICtlQuot(A6) Set incoming packets control quote
  87.           MOVE.B    #MyCtlQot,OCtlQuot(A6) Set outgoing packets control quote
  88.           MOVE.B    #MyPad,IPadNumb(A6)    Set how much padding to ask for
  89.           MOVE.B    #DefPadNm,OPadNumb(A6) Set how much padding to send
  90.           MOVE.B    #MyPadChr,IPadChar(A6) Set padding character to ask for
  91.           MOVE.B    #DefPadCr,OPadChar(A6) Set padding character to send
  92.           MOVEQ     #Asc_SOH,D0            Default packet start character
  93.           MOVE.B    D0,IStPckCh(A6)        Set incoming packet start char
  94.           MOVE.B    D0,OStPckCh(A6)        Set outgoing packet start char
  95.           MOVE.B    #DefTmOut,ITimInt(A6)  Set when I should time out
  96.           MOVE.B    #MyTimOut,OTimInt(A6)  Set when I want to be timed out
  97.           MOVE.B    #MyMxPSiz,IMPckSiz(A6) Set max packet size I want receive
  98.           MOVE.B    #DefMxPSz,OMPckSiz(A6) Set max packet size I can send
  99.           MOVE.B    #MyRptQot,ReptQuot(A6) Set the default repeat prefix
  100.           MOVE.B    #My8BQuot,Bit8Quot(A6) Set the default 8th bit prefix
  101.           MOVE.B    #1,BlChkRq(A6)         Set the default block check type
  102.           MOVE.B    #DefDuplx,Duplex(A6)   Set default duplex
  103.           MOVE.B    #DefFlow,Flow(A6)      Set default flow control
  104.           MOVE.B    #DefPrity,Parity(A6)   Set default parity
  105.           MOVE.B    #DefEscap,Escape(A6)   Set default escape character
  106.           MOVE.B    #DefDelay,Delay(A6)    Set default delay before sending
  107.           MOVE.B    #DefRetIn,RtryInit(A6) Set default retry init limit
  108.           MOVE.B    #DefRetPk,RtryPack(A6) Set default retry normal limit
  109.  
  110.           LEA       MacroTbl(A6),A0
  111.           MOVE.L    A0,MTNxtChF(A6)
  112.  
  113.           CLR.B     LinLngth(A6)       For the dumb terminal Screen routine
  114.  
  115.           SF        ReptFlag(A6)       No repeat processing by default
  116.           SF        TimInFlg(A6)       No timeout overriding
  117.           SF        SndPSFlg(A6)       No packet size overriding
  118.           SF        Binary(A6)         File type is text
  119.           SF        Quiet(A6)          File display is on
  120.           SF        FNameCnv(A6)       File names conversion is off
  121.           SF        Warning(A6)        File warning is off
  122.           SF        Keep(A6)           Don't keep incomplete files
  123.  
  124.           SF        IntMacro(A6)
  125.  
  126.           CLR.L     ChrsSent(A6)       Clear the statistic variables
  127.           CLR.L     TChsSent(A6)
  128.           CLR.L     ChrsRecd(A6)
  129.           CLR.L     TChsRecd(A6)
  130.           CLR.L     DChsSent(A6)
  131.           CLR.L     TDChSent(A6)
  132.           CLR.L     DChsRecd(A6)
  133.           CLR.L     TDChRecd(A6)
  134.           CLR.L     PcksSent(A6)
  135.           CLR.L     TPckSent(A6)
  136.           CLR.L     PcksRecd(A6)
  137.           CLR.L     TPckRecd(A6)
  138.           CLR.L     NAKsSent(A6)
  139.           CLR.L     TNAKSent(A6)
  140.           CLR.L     NAKsRecd(A6)
  141.           CLR.L     TNAKRecd(A6)
  142.  
  143.           MOVE.B    #DefLocal,Local(A6) Setup the initial mode
  144.           MOVE.L    #DefSpeed,Speed(A6) Setup the default line speed
  145.  
  146.           LEA       DefLinNm(PC),A1    Setup the default line, if any
  147.           LEA       LineName(A6),A0    This is the line name string
  148.           MOVEQ     #LinNamML,D0       Maximum line name length
  149.           BSR       CopyStr            Copy now
  150.           TST.B     (A0)               The default line name was null ?
  151.           BEQ.S     InitAll2           Yes, we hope that somebody does this job
  152.  
  153.           MOVEQ     #RdWrOp,D0         No, try to open it
  154.           MOVEQ     #HostLine,D1       This is the channel number
  155.           BSR       FilOpen            Open, if possible
  156.           TST.B     D0                 Ok ?
  157.           BNE.S     InitAll1           Yes
  158.           CLR.B     (A0)               No, nullify the line name
  159.           BEQ.S     InitAll2           Proceed initialization, no error messages
  160.  
  161. InitAll1  LEA       ConLinNm(PC),A1    Yes, point to the console line name
  162.           BSR       CompStr            Compare the two line names
  163.           TST.B     D0                 Are equal ?
  164.           SEQ       Local(A6)          If not we are local, remote otherwise
  165.           BEQ.S     InitAll2           If local, leave speed unchanged
  166.           MOVE.L    #-1,Speed(A6)      If remote, say speed unknown
  167.  
  168. InitAll2  MOVE.B    #-1,TakLevel(A6)   No files to take yet
  169.           SF        TermOut(A6)        No terminal output, by now
  170.           SF        Done(A6)           Set to false the parser exit flag
  171.           CLR.B     Argumnt1(A6)       Nullify the first command argument
  172.           CLR.B     Argumnt2(A6)       Nullify the second command argument
  173.           CLR.B     FilName(A6)        Nullify current file name
  174.           CLR.B     LinLngth(A6)       *** To be removed -rb- ***
  175.  
  176.           LEA       DefPrmpt(PC),A1    Set up the default prompt
  177.           LEA       Prompt(A6),A0      This is the prompt string
  178.           MOVEQ     #PromptML,D0       Maximum prompt length
  179.           BSR       CopyStr            Copy now
  180.           RTS
  181.  
  182.           ends
  183.  
  184.           END       Kerm68K
  185.