home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / dev / tbsource.lha / TBSource / ShellTerm / ST.S < prev    next >
Text File  |  1993-12-21  |  66KB  |  3,290 lines

  1. *************************************************
  2. *                        *
  3. *           (C)opyright 1992-93        *
  4. *                        *
  5. *        by Tomi Blinnikka        *
  6. *                        *
  7. *    Don't try to understand the code    *
  8. *                        *
  9. * Version 0.01    28/05/1992            *
  10. *     -0.99v                    *
  11. *                        *
  12. * Version 1.00    04/08/1992            *
  13. *                        *
  14. * BUGS: Lots! No phonebook.            *
  15. *                        *
  16. * Version 1.01    05/08/1992            *
  17. *                        *
  18. * BUGS: Some. Dialer problems.            *
  19. *                        *
  20. * Version 1.02    06/08/1992            *
  21. *                        *
  22. * BUGS: Less. Still dialer problems.        *
  23. *                        *
  24. * Version 1.03    08/08/1992            *
  25. *                        *
  26. * BUGS:                     *
  27. *                        *
  28. * Version 1.04    11/08/1992            *
  29. *                        *
  30. * Released                    *
  31. *                        *
  32. * BUGS: Send CTRL-P didn't work            *
  33. *                        *
  34. * Version 1.05    15/08/1992            *
  35. *                        *
  36. * Version 1.06    28/08/1992            *
  37. *                        *
  38. * Added prefs file and swap BS & DEL        *
  39. * See docs for more info            *
  40. *                        *
  41. * Version 1.07    30/08/1992            *
  42. *                        *
  43. * Version 1.08    04/09/1992            *
  44. *                        *
  45. * Added cursor remap                *
  46. *                        *
  47. * Version 1.09    06/09/1992            *
  48. *                        *
  49. * Version 1.10    20/10/1992            *
  50. *                        *
  51. * Hopefully fixed bug in FindWord        *
  52. * Added: PublicPorts                *
  53. *                        *
  54. * Version 1.11    13/11/1992 <-Friday the 13th    *
  55. *                        *
  56. * Version for Mika Henttinen            *
  57. *                        *
  58. * Version 1.12    30/12/1992            *
  59. *                        *
  60. * Changed parser to Commodore's own ReadArgs    *
  61. *                        *
  62. * Version 1.13    02/01/1993            *
  63. *                        *
  64. * Added 'Execute Command'            *
  65. *                        *
  66. * Version 1.14    06/02/1993            *
  67. *                        *
  68. * Fixed bug at start clearing CLI pointer's    *
  69. * last byte                    *
  70. *                        *
  71. * Version 1.15    10/02/1993            *
  72. *                        *
  73. * Made sure that the Modify Mode in the dialer    *
  74. * is turned off when the dialer is quit        *
  75. *                        *
  76. * Version 1.16    24/03/1993            *
  77. *                        *
  78. * Fixed bug with opening device!        *
  79. *                        *
  80. * Version 1.17    25/03/1993            *
  81. *                        *
  82. * Added optional port                *
  83. *                        *
  84. * Version 1.18    22/05/1993            *
  85. *                        *
  86. * Added scripts to archive            *
  87. *                         *
  88. * Fixed bug with opening device and setting    *
  89. * parameters.                    *
  90. *                        *
  91. * Added XON/XOFF                *
  92. *                        *
  93. * Version 1.19    26/05/1993            *
  94. *                        *
  95. * Added version to prefs file            *
  96. *                        *
  97. * Version 1.20    23/06/1993            *
  98. *                        *
  99. * Fixed "Can't open device '"... string.    *
  100. *                        *
  101. * Version 1.21    02/07/1993            *
  102. *                        *
  103. * Fixed 'Load prefs' bug.            *
  104. *                        *
  105. * Version 1.22    04/07/1993            *
  106. *                        *
  107. * Made compatible with dnet.device.        *
  108. *                        *
  109. * Version 1.23    05/07/1993            *
  110. *                        *
  111. * Added CTS/RTS handshaking.            *
  112. * Made a little safer to use.            *
  113. *                        *
  114. * Version 1.24    17/07/1993            *
  115. *                        *
  116. * Made a little safer to use.            *
  117. *                        *
  118. * Version 1.25    31/07/1993            *
  119. *                        *
  120. * Fixed a bug with OpenSerial. Didn't open in    *
  121. * shared mode.                    *
  122. *                        *
  123. * Added Unregistered text.            *
  124. *                        *
  125. *************************************************
  126.  
  127.     INCLUDE    "JMPLibs.i"
  128.     INCLUDE    "exec/types.i"
  129.     INCLUDE    "exec/nodes.i"
  130.     INCLUDE    "exec/lists.i"
  131.     INCLUDE    "exec/ports.i"
  132.     INCLUDE    "exec/memory.i"
  133.     INCLUDE    "exec/devices.i"
  134.     INCLUDE    "exec/io.i"
  135.     INCLUDE    "exec/tasks.i"
  136.     INCLUDE    "libraries/dosextens.i"
  137.     INCLUDE    "libraries/dos.i"
  138.     INCLUDE    "devices/serial.i"
  139.  
  140.     INCLUDE    "XREF:2.0.xref"
  141.     INCLUDE    "XREF:exec.xref"
  142.     INCLUDE    "XREF:dos.xref"
  143.  
  144.  
  145. PROGVERSION:    macro
  146.         dc.b    "1.25 (31.07.93)"
  147.         endm
  148.  
  149. STFileVersion:    EQU    'ST01'
  150.  
  151. CTRL_B:        EQU    2
  152. CTRL_F:        EQU    6
  153. BS:        EQU    8
  154. TAB:        EQU    9
  155. LF:        EQU    10
  156. CR:        EQU    13
  157. CTRL_N:        EQU    $E
  158. CTRL_O:        EQU    $F
  159. CTRL_P:        EQU    $10
  160. DEL:        EQU    127
  161. CSI:        EQU    $9B
  162. Cursor_Up:    EQU    'A'
  163. Cursor_Down:    EQU    'B'
  164. Cursor_Left:    EQU    'D'
  165. Cursor_Right:    EQU    'C'
  166.  
  167. MENU_KEY:    EQU    CTRL_P
  168. STATS_KEY:    EQU    CTRL_O
  169.  
  170. FALSE:        EQU    0
  171. TRUE:        EQU    1
  172.  
  173. BUFLEN:        EQU    1024
  174. ENTRYLENGTH:    EQU    20
  175.  
  176.         section    ST,CODE
  177.  
  178.         push    d2-d7/a2-a6
  179.         push    d0/a0
  180.  
  181.         openlib    Dos,NoDos        ;Keep at beginning
  182.  
  183. CLIStart:    lib    Dos,Output
  184.         move.l    d0,_stdout
  185.         lib    Dos,Input
  186.         move.l    d0,_stdin
  187.         move.l    d0,d1
  188.         lib    Dos,IsInteractive
  189.         tst.l    d0
  190.         beq    NotInteractive
  191.         pull    d0/a0
  192.  
  193.         lea.l    CLTemplate1,a0
  194.         move.l    a0,d1
  195.         lea.l    CLArray1,a0
  196.         move.l    a0,d2
  197.         clr.l    d3
  198.         lib    Dos,ReadArgs
  199.         move.l    d0,RDArgs1
  200.         beq    NoRDArgs
  201.  
  202.         move.l    CLArray1,a0
  203.         lea.l    FileNameBuf1,a1
  204.         tst.b    (a0)
  205.         beq    Parse2
  206. CLCopyLoop:    move.b    (a0)+,(a1)+
  207.         tst.b    -1(a1)
  208.         bne    CLCopyLoop
  209.  
  210. Parse2:        tst.l    OptPortName
  211.         beq    Parse3            ;No port specified
  212.  
  213.         lib    Exec,CreateMsgPort
  214.         move.l    d0,OptPort
  215.         beq    NoMsgPort
  216.  
  217. ;Add port to public lists
  218.  
  219.         move.l    OptPort,a1
  220.         move.l    OptPortName,a0
  221.         move.l    a0,LN_NAME(a1)
  222.         lib    Exec,AddPort
  223.  
  224. Parse3:
  225.  
  226. MainStart:    openlib    Utility,NoUtility        ;Keep at beginning
  227.  
  228.         bsr    LoadPrefsFile
  229.  
  230.         bsr    OpenSerial
  231.  
  232.         bsr    SetSerParams
  233.         tst.l    d0
  234.         beq    MainStart1
  235.         bsr    ParamsNotSet
  236.  
  237. MainStart1:    lea.l    StartText1,a0
  238.         bsr    Printer
  239.  
  240. ;Change mode for CLI to RAW:
  241.  
  242.         move.l    _stdin,d1
  243.         move.l    #TRUE,d2
  244.         lib    Dos,SetMode
  245.  
  246. ;Flush extra text
  247.  
  248.         move.l    _stdin,d1
  249.         lib    Dos,Flush
  250.  
  251. Looper:        move.l    _stdin,d1
  252.         move.l    #5000,d2
  253.         lib    Dos,WaitForChar
  254.         tst.l    d0
  255.         beq    Looper1
  256.         move.l    _stdin,d1
  257.         lea.l    Buffer1,a0
  258.         move.l    a0,d2
  259.         move.l    #1,d3
  260.         lib    Dos,Read
  261.         cmp.b    #MENU_KEY,Buffer1
  262.         beq    Menu
  263.         move.b    CPAssign,d0
  264.         cmp.b    Buffer1,d0
  265.         beq    DoCTRL_P2
  266.         bsr    DoCLIInput
  267. Looper1:    move.l    #BUFLEN,d0
  268.         move.l    #1,d1
  269.         bsr    Read
  270.         tst.l    d0
  271.         beq    Looper
  272.  
  273.         lea.l    Buffer3,a0
  274.         clr.b    0(a0,d0.l)    ;null terminated, please!
  275.  
  276.         bsr    DoSerialInput
  277.  
  278.         move.l    _stdout,d1
  279.         lea.l    Buffer4,a1
  280.         bsr    GetLength
  281.         move.l    d0,d3
  282.         lea.l    Buffer4,a0
  283.         move.l    a0,d2
  284.         lib    Dos,Write
  285.  
  286.         bsr    DoCapture
  287.  
  288.         bra    Looper
  289.  
  290. Menu:        bsr    DoANSI
  291.         lea.l    MenuText1,a0
  292.         bsr    Printer
  293. Menu1:        move.l    _stdin,d1
  294.         lib    Dos,FGetC
  295.         cmp.l    #-1,d0
  296.         beq    ShutDown
  297.         cmp.l    #'a',d0
  298.         bcs    Menu2
  299.         cmp.l    #'z',d0
  300.         bhi    Menu2
  301.         sub.l    #32,d0
  302. Menu2:        cmp.l    #'P',d0
  303.         beq    Prefs
  304.         cmp.l    #'S',d0
  305.         beq    DoStats
  306.         cmp.l    #'C',d0
  307.         beq    ClearBoth
  308.         cmp.l    #'D',d0
  309.         beq    Dialer
  310.         cmp.l    #'B',d0
  311.         beq    DoBreak
  312.         cmp.l    #'O',d0
  313.         beq    DoCTRL_P
  314.         cmp.l    #'F',d0
  315.         beq    ResetFont
  316.         cmp.l    #'X',d0
  317.         beq    ClearScreen
  318.         cmp.l    #'R',d0
  319.         beq    DoReset
  320.         cmp.l    #'H',d0
  321.         beq    DoHangUp
  322.         cmp.l    #'L',d0
  323.         beq    DoOpenCapture
  324.         cmp.l    #'K',d0
  325.         beq    DoCloseCapture
  326.         cmp.l    #'+',d0
  327.         beq    DoUpLoad
  328.         cmp.l    #'-',d0
  329.         beq    DoDownLoad
  330.         cmp.l    #'M',d0
  331.         beq    DoExecute
  332.         cmp.l    #'?',d0
  333.         beq    DoInfo
  334.         cmp.l    #'Q',d0
  335.         beq    Quit
  336.         cmp.l    #'E',d0
  337.         beq    Exit1
  338.         bra    Menu1
  339. Exit1:        lea.l    ExitText1,a0
  340.         bsr    Printer
  341.  
  342. Exit:        bsr    DoANSI
  343.         lea.l    TerminalText1,a0
  344.         bsr    Printer
  345.         bclr.b    #0,ModifyMode            ;Clear modify bit
  346.  
  347.         tst.w    SerOpen
  348.         bne    Exit_OUT
  349.         bsr    NoSerial
  350. Exit_OUT:    bra    Looper1
  351.  
  352. ResetFont:    lea.l    ResetFText1,a0
  353.         bsr    Printer
  354.         lea.l    PlainText1,a0
  355.         bsr    Printer
  356.         bra    Menu
  357.  
  358. ClearScreen:    lea.l    ClearSText1,a0
  359.         bsr    Printer
  360.         bra    Exit
  361.  
  362. DoANSI:        tst.b    UseANSI
  363.         beq    DoANSI_OUT
  364.         lea.l    ClearSText1,a0
  365.         bsr    Printer
  366. DoANSI_OUT:    rts
  367.  
  368. DoStats:    lea.l    StatsText2,a0
  369.         bsr    Printer
  370.         bsr    DoANSI
  371.         bsr    GiveStats
  372.         bsr    GetAnyKey
  373.         bra    Menu
  374.  
  375. ClearBoth:    lea.l    ClearText1,a0
  376.         bsr    Printer
  377.         clr.l    Received
  378.         clr.l    Sent
  379.         bra    Menu
  380.  
  381. DoBreak:    bsr    SendBREAK
  382.         lea.l    BreakText2,a0
  383.         bsr    Printer
  384.  
  385.         bra    Exit
  386.  
  387. DoCTRL_P:    move.b    #CTRL_P,Buffer1
  388.         bsr    Writer
  389.         lea.l    CTRL_PText1,a0
  390.         bsr    Printer
  391.         add.l    #1,Sent
  392.         bra    Exit
  393.  
  394. DoCTRL_P2:    move.b    #CTRL_P,Buffer1
  395.         bsr    Writer
  396.         add.l    #1,Sent
  397.         bra    Looper
  398.  
  399. DoReset:    lea.l    ResetText1,a0
  400.         bsr    Printer
  401.         lea.l    ResetText2,a1
  402.         bsr    GetLength
  403.         lea.l    ResetText2,a0
  404.         bsr    Writer2
  405.         bra    Exit
  406.  
  407. DoHangUp:    lea.l    HangUpText1,a0
  408.         bsr    Printer
  409.         move.l    #3*50,d1
  410.         lib    Dos,Delay
  411.         lea.l    HangUpText2,a1
  412.         bsr    GetLength
  413.         lea.l    HangUpText2,a0
  414.         bsr    Writer2
  415.         move.l    #2*55,d1
  416.         lib    Dos,Delay
  417.         lea.l    HangUpText3,a1
  418.         bsr    GetLength
  419.         lea.l    HangUpText3,a0
  420.         bsr    Writer2
  421.         bra    Exit
  422.  
  423. DoOpenCapture:    lea.l    OpenCaptureText1,a0
  424.         bsr    Printer
  425.  
  426.         tst.l    CaptureFile
  427.         bne    DoOpenCapture_ERR2
  428.  
  429.         lea.l    FileNameBuf2,a0
  430.         move.l    #128,d3
  431.         bsr    GetString
  432.  
  433.         tst.b    FileNameBuf2
  434.         beq    DoOpenCapture_OUT
  435.  
  436.         lea.l    FileNameBuf2,a0
  437.         move.l    a0,d1
  438.         move.l    #MODE_READWRITE,d2
  439.         lib    Dos,Open
  440.         move.l    d0,CaptureFile
  441.         beq    DoOpenCapture_ERR1
  442.  
  443. DoOpenCapture_OUT: bra    Menu
  444. DoOpenCapture_ERR1: lea.l    CaptureErrorText1,a0
  445.         bsr    Printer
  446.         bra    Menu
  447. DoOpenCapture_ERR2: lea.l    CaptureErrorText2,a0
  448.         bsr    Printer
  449.         bra    Menu
  450.  
  451. DoCloseCapture:    lea.l    CloseCaptureText1,a0
  452.         bsr    Printer
  453.  
  454.         move.l    CaptureFile,d1
  455.         beq    DoCloseCapture_OUT
  456.         lib    Dos,Close
  457.         clr.l    CaptureFile
  458. DoCloseCapture_OUT: bra    Menu
  459.  
  460. DoUpLoad:    lea.l    ULText2,a0
  461.         bsr    Printer
  462.         lea.l    ULProgram,a0
  463.         tst.b    (a0)
  464.         beq    DoUpLoad9
  465.  
  466.         lea.l    FileNameBuf2,a0
  467.         move.l    #128,d3
  468.         bsr    GetString
  469.  
  470.         bsr    MakeCmdString
  471.  
  472.         tst.b    ULDir
  473.         beq    DoUpLoad1
  474.         lea.l    ULDir,a0
  475.         move.l    a0,d1
  476.         move.l    #ACCESS_READ,d2
  477.         lib    Dos,Lock
  478.         move.l    d0,ULLock
  479.         bne    DoUpLoad2
  480.  
  481. DoUpLoad1:    lea.l    NoULDirText1,a0
  482.         bsr    Printer
  483.         bra    DoUpLoad5
  484.  
  485. DoUpLoad2:    move.l    ULLock,d1
  486.         lib    Dos,CurrentDir
  487.         move.l    d0,OldLock
  488.  
  489. DoUpLoad5:    lea.l    ULText3,a0
  490.         bsr    Printer
  491.  
  492.         lea.l    FileNameBuf3,a0
  493.         move.l    a0,d1
  494.         clr.l    d2
  495.         clr.l    d3
  496.         lib    Dos,Execute
  497.  
  498. ;change back to dir where we started from
  499.  
  500.         move.l    OldLock,d1
  501.         beq    DoUpLoad7
  502.         lib    Dos,CurrentDir
  503.         clr.l    OldLock
  504.  
  505. DoUpLoad7:    move.l    ULLock,d1
  506.         beq    DoUpLoad8
  507.         lib    Dos,UnLock
  508.         clr.l    ULLock
  509. DoUpLoad8:
  510.         bra    Exit
  511. DoUpLoad9:    lea.l    NoULDLProgText1,a0
  512.         bsr    Printer
  513.         bra    Exit
  514.  
  515. DoDownLoad:    lea.l    DLText2,a0
  516.         bsr    Printer
  517.         tst.b    DLProgram
  518.         beq    DoDownLoad9
  519.  
  520. ;change to the dl dir
  521.  
  522.         tst.b    DLDir
  523.         beq    DoDownLoad1
  524.         lea.l    DLDir,a0
  525.         move.l    a0,d1
  526.         move.l    #ACCESS_READ,d2
  527.         lib    Dos,Lock
  528.         move.l    d0,DLLock
  529.         bne    DoDownLoad2
  530.  
  531. DoDownLoad1:    lea.l    NoDLDirText1,a0
  532.         bsr    Printer
  533.         bra    DoDownLoad5
  534.  
  535. DoDownLoad2:    move.l    DLLock,d1
  536.         lib    Dos,CurrentDir
  537.         move.l    d0,OldLock
  538.  
  539. DoDownLoad5:    lea.l    DLProgram,a0
  540.         move.l    a0,d1
  541.         clr.l    d2
  542.         clr.l    d3
  543.         lib    Dos,Execute
  544.  
  545. ;change back to dir where we started from
  546.  
  547.         move.l    OldLock,d1
  548.         beq    DoDownLoad7
  549.         lib    Dos,CurrentDir
  550.         clr.l    OldLock
  551.  
  552. DoDownLoad7:    move.l    DLLock,d1
  553.         beq    DoDownLoad8
  554.         lib    Dos,UnLock
  555.         clr.l    DLLock
  556. DoDownLoad8:    bra    Exit
  557.  
  558. DoDownLoad9:    lea.l    NoULDLProgText1,a0
  559.         bsr    Printer
  560.         bra    Exit
  561.  
  562. DoExecute:    lea.l    ExecuteText1,a0
  563.         bsr    Printer
  564.  
  565.         lea.l    FileNameBuf2,a0
  566.         move.l    #128,d3
  567.         bsr    GetString
  568.  
  569.         lea.l    FileNameBuf2,a0
  570.         tst.b    (a0)
  571.         beq    DoExecute_OUT
  572.         move.l    a0,d1
  573.         clr.l    d2
  574.         clr.l    d3
  575.         lib    Dos,Execute
  576.  
  577.         bsr    GetAnyKey
  578.  
  579. DoExecute_OUT:    bra    Menu
  580.  
  581. DoInfo:        lea.l    InfoText1,a0
  582.         bsr    Printer
  583.         bsr    DoANSI
  584.         lea.l    AuthorText1,a0
  585.         bsr    Printer
  586.         bsr    GetAnyKey
  587.         bra    Menu
  588.  
  589. Quit:        lea.l    QuitText1,a0
  590.         bsr    Printer
  591.         lea.l    CRLFText1,a0
  592.         bsr    Printer
  593.         bsr    GiveStats
  594.         bra    ShutDown
  595.  
  596. ;If you add another way to get out of the dialer, please remember to clear
  597. ;the ModifyMode (just in case), so the user can't accidentally erase an
  598. ;entry!
  599.  
  600. Dialer:        lea.l    DialerText1,a0
  601.         bsr    Printer
  602. Dialer0.1:    bsr    DoANSI
  603.         lea.l    DialerText2,a0
  604.         bsr    Printer
  605. Dialer0.2:    bsr    PrintEntries
  606. Dialer0.3:    bsr    PrintSelect
  607. Dialer0.4:    lea.l    DialerText3,a0
  608.         bsr    Printer
  609. Dialer1:    move.l    _stdin,d1
  610.         lib    Dos,FGetC
  611.         cmp.l    #-1,d0
  612.         beq    Menu
  613.         cmp.l    #'a',d0
  614.         bcs    Dialer2
  615.         cmp.l    #'z',d0
  616.         bhi    Dialer
  617.         sub.l    #32,d0
  618. Dialer2:    cmp.l    #'0',d0
  619.         beq    DoEntry0
  620.         cmp.l    #'1',d0
  621.         beq    DoEntry1
  622.         cmp.l    #'2',d0
  623.         beq    DoEntry2
  624.         cmp.l    #'3',d0
  625.         beq    DoEntry3
  626.         cmp.l    #'4',d0
  627.         beq    DoEntry4
  628.         cmp.l    #'5',d0
  629.         beq    DoEntry5
  630.         cmp.l    #'6',d0
  631.         beq    DoEntry6
  632.         cmp.l    #'7',d0
  633.         beq    DoEntry7
  634.         cmp.l    #'8',d0
  635.         beq    DoEntry8
  636.         cmp.l    #'9',d0
  637.         beq    DoEntry9
  638.         cmp.l    #'D',d0
  639.         beq    DialList
  640.         cmp.l    #'E',d0
  641.         beq    Exit1
  642.         cmp.l    #'M',d0
  643.         beq    MainMenu
  644.         cmp.l    #'-',d0
  645.         beq    MainMenu
  646.         cmp.l    #'S',d0
  647.         beq    SingleDial
  648.         cmp.l    #'R',d0
  649.         beq    Relist
  650.         cmp.l    #'C',d0
  651.         beq    ClearList
  652.         cmp.l    #'A',d0
  653.         beq    SelectAll
  654.         cmp.l    #'I',d0
  655.         beq    SetModifyMode
  656.         cmp.l    #'P',d0
  657.         beq    EditPrefix
  658.         cmp.l    #'H',d0
  659.         beq    DialerHelp
  660.         cmp.l    #'?',d0
  661.         beq    DialerHelp
  662.         bra    Dialer1
  663.  
  664. SetModifyMode:    bchg.b    #0,ModifyMode
  665.         beq    SetModifyMode1
  666.         lea.l    ModifyText2,a0
  667.         bsr    Printer
  668.         bra    Dialer0.4
  669. SetModifyMode1:    lea.l    ModifyText1,a0
  670.         bsr    Printer
  671.         bra    Dialer0.4
  672.  
  673. DialerHelp:    lea.l    HelpText1,a0
  674.         bsr    Printer
  675.         bsr    DoANSI
  676.         bra    Dialer0.4
  677.  
  678. ClearList:    lea.l    ClearText2,a0
  679.         bsr    Printer
  680.         bsr    DoANSI
  681.         clr.l    EntrySelected1
  682.         clr.l    EntrySelected5
  683.         clr.w    EntrySelected9
  684.         bra    DoEntry_OUT1
  685.  
  686. SelectAll:    lea.l    AllText1,a0
  687.         bsr    Printer
  688.         bsr    DoANSI
  689.         move.l    #$01010101,EntrySelected1
  690.         move.l    #$01010101,EntrySelected5
  691.         move.w    #$0101,EntrySelected9
  692.         bra    DoEntry_OUT1
  693.  
  694. DoEntry1:    lea.l    Entry1,a0
  695.         tst.w    ModifyMode
  696.         bne    EditEntry
  697.         bchg.b    #0,EntrySelected1
  698.         bra    DoEntry_OUT
  699. DoEntry2:    lea.l    Entry2,a0
  700.         tst.w    ModifyMode
  701.         bne    EditEntry
  702.         bchg.b    #0,EntrySelected2
  703.         bra    DoEntry_OUT
  704. DoEntry3:    lea.l    Entry3,a0
  705.         tst.w    ModifyMode
  706.         bne    EditEntry
  707.         bchg.b    #0,EntrySelected3
  708.         bra    DoEntry_OUT
  709. DoEntry4:    lea.l    Entry4,a0
  710.         tst.w    ModifyMode
  711.         bne    EditEntry
  712.         bchg.b    #0,EntrySelected4
  713.         bra    DoEntry_OUT
  714. DoEntry5:    lea.l    Entry5,a0
  715.         tst.w    ModifyMode
  716.         bne    EditEntry
  717.         bchg.b    #0,EntrySelected5
  718.         bra    DoEntry_OUT
  719. DoEntry6:    lea.l    Entry6,a0
  720.         tst.w    ModifyMode
  721.         bne    EditEntry
  722.         bchg.b    #0,EntrySelected6
  723.         bra    DoEntry_OUT
  724. DoEntry7:    lea.l    Entry7,a0
  725.         tst.w    ModifyMode
  726.         bne    EditEntry
  727.         bchg.b    #0,EntrySelected7
  728.         bra    DoEntry_OUT
  729. DoEntry8:    lea.l    Entry8,a0
  730.         tst.w    ModifyMode
  731.         bne    EditEntry
  732.         bchg.b    #0,EntrySelected8
  733.         bra    DoEntry_OUT
  734. DoEntry9:    lea.l    Entry9,a0
  735.         tst.w    ModifyMode
  736.         bne    EditEntry
  737.         bchg.b    #0,EntrySelected9
  738.         bra    DoEntry_OUT
  739. DoEntry0:    lea.l    Entry10,a0
  740.         tst.w    ModifyMode
  741.         bne    EditEntry
  742.         bchg.b    #0,EntrySelected0
  743. DoEntry_OUT:    lea.l    EntryTextXIV,a0
  744.         bsr    Printer
  745.         bsr    DoANSI
  746. DoEntry_OUT1:    bsr    PrintSelect
  747.         lea.l    SelectionText1,a0
  748.         bsr    Printer
  749.         bra    Dialer1
  750.  
  751. EditEntry:    push    a0
  752.         lea.l    EditEntryText1,a0
  753.         bsr    Printer
  754.         lea.l    EditEntryText2,a0
  755.         bsr    Printer
  756.         pull    a0
  757.         move.l    #ENTRYLENGTH,d3
  758.         bsr    GetString
  759.         bsr    PrintEntries
  760.         bra    DoEntry_OUT1
  761.  
  762. EditPrefix:    lea.l    EditEntryText3,a0
  763.         bsr    Printer
  764.         lea.l    EditEntryText4,a0
  765.         bsr    Printer
  766.         lea.l    DialPrefix,a0
  767.         move.l    #16,d3
  768.         bsr    GetString
  769.         bra    Dialer0.1
  770.  
  771. MainMenu:    bclr.b    #0,ModifyMode            ;Clear modify bit
  772.         lea.l    MainMenuText1,a0
  773.         bsr    Printer
  774.         bra    Menu
  775.  
  776. DialList:    lea.l    DialText1,a0
  777.         bsr    Printer
  778.         bsr    DoANSI
  779.         lea.l    DialText2,a0
  780.         bsr    Printer
  781.  
  782. DialList1:    lea.l    EntrySelected1,a2
  783.         tst.b    (a2)
  784.         beq    DialList2
  785.         lea.l    Entry1,a0
  786.         tst.b    (a0)
  787.         beq    DialList1.1
  788.         bsr    DialEntry
  789.         tst.l    d0        ;connect
  790.         bne    DialList1.01
  791. DialLCONNECT:    clr.b    (a2)
  792.         beq    Exit
  793. DialList1.01:    cmp.l    #2,d0        ;cancel
  794.         beq    Dialer0.1
  795.         cmp.l    #3,d0        ;remove
  796.         bne    DialList2
  797. DialList1.1:    clr.b    (a2)
  798. DialList2:    lea.l    EntrySelected2,a2
  799.         tst.b    (a2)
  800.         beq    DialList3
  801.         lea.l    Entry2,a0
  802.         tst.b    (a0)
  803.         beq    DialList2.1
  804.         bsr    DialEntry
  805.         tst.l    d0
  806.         beq    DialLCONNECT    ;Connect
  807.         cmp.l    #2,d0        ;cancel
  808.         beq    Dialer0.1
  809.         cmp.l    #3,d0        ;remove
  810.         bne    DialList3
  811. DialList2.1:    clr.b    (a2)
  812. DialList3:    lea.l    EntrySelected3,a2
  813.         tst.b    (a2)
  814.         beq    DialList4
  815.         lea.l    Entry3,a0
  816.         tst.b    (a0)
  817.         beq    DialList3.1
  818.         bsr    DialEntry
  819.         tst.l    d0
  820.         beq    DialLCONNECT    ;Connect
  821.         cmp.l    #2,d0        ;cancel
  822.         beq    Dialer0.1
  823.         cmp.l    #3,d0        ;remove
  824.         bne    DialList4
  825. DialList3.1:    clr.b    (a2)
  826. DialList4:    lea.l    EntrySelected4,a2
  827.         tst.b    (a2)
  828.         beq    DialList5
  829.         lea.l    Entry4,a0
  830.         tst.b    (a0)
  831.         beq    DialList4.1
  832.         bsr    DialEntry
  833.         tst.l    d0
  834.         beq    DialLCONNECT    ;Connect
  835.         cmp.l    #2,d0        ;cancel
  836.         beq    Dialer0.1
  837.         cmp.l    #3,d0        ;remove
  838.         bne    DialList5
  839. DialList4.1:    clr.b    (a2)
  840. DialList5:    lea.l    EntrySelected5,a2
  841.         tst.b    (a2)
  842.         beq    DialList6
  843.         lea.l    Entry5,a0
  844.         tst.b    (a0)
  845.         beq    DialList5.1
  846.         bsr    DialEntry
  847.         tst.l    d0
  848.         beq    DialLCONNECT    ;Connect
  849.         cmp.l    #2,d0        ;cancel
  850.         beq    Dialer0.1
  851.         cmp.l    #3,d0        ;remove
  852.         bne    DialList6
  853. DialList5.1:    clr.b    (a2)
  854. DialList6:    lea.l    EntrySelected6,a2
  855.         tst.b    (a2)
  856.         beq    DialList7
  857.         lea.l    Entry6,a0
  858.         tst.b    (a0)
  859.         beq    DialList6.1
  860.         bsr    DialEntry
  861.         tst.l    d0
  862.         beq    DialLCONNECT    ;Connect
  863.         cmp.l    #2,d0        ;cancel
  864.         beq    Dialer0.1
  865.         cmp.l    #3,d0        ;remove
  866.         bne    DialList7
  867. DialList6.1:    clr.b    (a2)
  868. DialList7:    lea.l    EntrySelected7,a2
  869.         tst.b    (a2)
  870.         beq    DialList8
  871.         lea.l    Entry7,a0
  872.         tst.b    (a0)
  873.         beq    DialList7.1
  874.         bsr    DialEntry
  875.         tst.l    d0
  876.         beq    DialLCONNECT    ;Connect
  877.         cmp.l    #2,d0        ;cancel
  878.         beq    Dialer0.1
  879.         cmp.l    #3,d0        ;remove
  880.         bne    DialList8
  881. DialList7.1:    clr.b    (a2)
  882. DialList8:    lea.l    EntrySelected8,a2
  883.         tst.b    (a2)
  884.         beq    DialList9
  885.         lea.l    Entry8,a0
  886.         tst.b    (a0)
  887.         beq    DialList8.1
  888.         bsr    DialEntry
  889.         tst.l    d0
  890.         beq    DialLCONNECT    ;Connect
  891.         cmp.l    #2,d0        ;cancel
  892.         beq    Dialer0.1
  893.         cmp.l    #3,d0        ;remove
  894.         bne    DialList9
  895. DialList8.1:    clr.b    (a2)
  896. DialList9:    lea.l    EntrySelected9,a2
  897.         tst.b    (a2)
  898.         beq    DialList10
  899.         lea.l    Entry9,a0
  900.         tst.b    (a0)
  901.         beq    DialList9.1
  902.         bsr    DialEntry
  903.         tst.l    d0
  904.         beq    DialLCONNECT    ;Connect
  905.         cmp.l    #2,d0        ;cancel
  906.         beq    Dialer0.1
  907.         cmp.l    #3,d0        ;remove
  908.         bne    DialList10
  909. DialList9.1:    clr.b    (a2)
  910. DialList10:    lea.l    EntrySelected0,a2
  911.         tst.b    (a2)
  912.         beq    DialList11
  913.         lea.l    Entry10,a0
  914.         tst.b    (a0)
  915.         beq    DialList10.1
  916.         bsr    DialEntry
  917.         tst.l    d0
  918.         beq    DialLCONNECT    ;Connect
  919.         cmp.l    #2,d0        ;cancel
  920.         beq    Dialer0.1
  921.         cmp.l    #3,d0        ;remove
  922.         bne    DialList11
  923. DialList10.1:    clr.b    (a2)
  924. DialList11:    tst.l    EntrySelected1
  925.         bne    DialList1
  926.         tst.l    EntrySelected5
  927.         bne    DialList1
  928.         tst.w    EntrySelected9
  929.         bne    DialList1
  930.         lea.l    EmptyText1,a0
  931.         bsr    Printer
  932.         bra    Dialer0.1
  933.  
  934. Relist:        lea.l    RelistText1,a0
  935.         bsr    Printer
  936.         bsr    DoANSI
  937.         bra    Dialer0.2
  938.  
  939. SingleDial:    lea.l    SingleText1,a0
  940.         bsr    Printer
  941.  
  942.         bsr    DoANSI
  943.  
  944.         lea.l    SingleText2,a0
  945.         bsr    Printer
  946.  
  947.         lea.l    DialBuffer1,a0
  948.         move.l    #ENTRYLENGTH,d3
  949.         bsr    GetString
  950.         tst.l    d0
  951.         bne    Dialer0.1
  952.  
  953.         lea.l    DialBuffer1,a1
  954.         bsr    GetLength
  955.         tst.l    d0
  956.         beq    Dialer0.1
  957.  
  958.         lea.l    DialText2,a0
  959.         bsr    Printer
  960.  
  961. SingleDial1:    lea.l    DialBuffer1,a0
  962.         bsr    DialEntry
  963.         tst.l    d0
  964.         beq    Exit
  965.         cmp.l    #1,d0
  966.         beq    SingleDial1
  967.         cmp.l    #2,d0
  968.         beq    Dialer0.1
  969.         cmp.l    #3,d0
  970.         beq    Dialer0.1
  971.         bra    Dialer0.1
  972.  
  973. Prefs:        lea.l    PrefsText1,a0
  974.         bsr    Printer
  975. Prefs1:        bsr    DoANSI
  976.         lea.l    PrefsText2,a0
  977.         bsr    Printer
  978. Prefs2:        move.l    _stdin,d1
  979.         lib    Dos,FGetC
  980.         cmp.l    #-1,d0
  981.         beq    Menu
  982.         cmp.l    #'a',d0
  983.         bcs    Prefs3
  984.         cmp.l    #'z',d0
  985.         bhi    Prefs3
  986.         sub.l    #32,d0
  987. Prefs3:        cmp.l    #'S',d0
  988.         beq    SetSpeed
  989.         cmp.l    #'T',d0
  990.         beq    Terminal
  991.         cmp.l    #'R',d0
  992.         beq    ClearSettings
  993.         cmp.l    #'L',d0
  994.         beq    DoLoad
  995.         cmp.l    #'W',d0
  996.         beq    DoSave
  997.         cmp.l    #'N',d0
  998.         beq    NameFile
  999.         cmp.l    #'E',d0
  1000.         beq    Exit1
  1001.         cmp.l    #'V',d0
  1002.         beq    DoView
  1003.         cmp.l    #'U',d0
  1004.         beq    SetULDir
  1005.         cmp.l    #'D',d0
  1006.         beq    SetDLDir
  1007.         cmp.l    #'+',d0
  1008.         beq    SetULProg
  1009.         cmp.l    #'-',d0
  1010.         beq    SetDLProg
  1011.         cmp.l    #'A',d0
  1012.         beq    AssignCTRL_P
  1013.         cmp.l    #'M',d0
  1014.         beq    MainMenu
  1015.         bra    Prefs2
  1016.  
  1017. SetULDir:    lea.l    ULText5,a0
  1018.         bsr    Printer
  1019.         lea.l    ULDir,a0
  1020.         move.l    #128,d3
  1021.         bsr    GetString
  1022.         bra    Prefs1
  1023.  
  1024. SetDLDir:    lea.l    DLText5,a0
  1025.         bsr    Printer
  1026.         lea.l    DLDir,a0
  1027.         move.l    #128,d3
  1028.         bsr    GetString
  1029.         bra    Prefs1
  1030.  
  1031. SetULProg:    lea.l    ULText1,a0
  1032.         bsr    Printer
  1033.         lea.l    ULProgram,a0
  1034.         move.l    #128,d3
  1035.         bsr    GetString
  1036.         bra    Prefs1
  1037.  
  1038. SetDLProg:    lea.l    DLText1,a0
  1039.         bsr    Printer
  1040.         lea.l    DLProgram,a0
  1041.         move.l    #128,d3
  1042.         bsr    GetString
  1043.         bra    Prefs1
  1044.  
  1045. AssignCTRL_P:    lea.l    AssignText1,a0
  1046.         bsr    Printer
  1047.  
  1048.         move.l    _stdin,d1
  1049.         lib    Dos,Flush
  1050.  
  1051.         lea.l    AssignText2,a0
  1052.         bsr    Printer
  1053.  
  1054.         move.l    _stdin,d1
  1055.         lib    Dos,FGetC
  1056.         cmp.l    #-1,d0
  1057.         beq    Prefs1
  1058.         move.b    d0,CPAssign
  1059.  
  1060.         lea.l    CRLFText1,a0
  1061.         bsr    Printer
  1062.         bra    Prefs1
  1063.  
  1064. NameFile:    lea.l    EnterNText1,a0
  1065.         bsr    Printer
  1066.  
  1067.         lea.l    EnterNText2,a0
  1068.         bsr    Printer
  1069.  
  1070.         lea.l    FileNameBuf1,a0
  1071.         move.l    #128,d3
  1072.         bsr    GetString
  1073.         tst.l    d0
  1074.         bne    Prefs1
  1075.  
  1076.         bra    Prefs1
  1077.  
  1078. DoLoad:        lea.l    LoadText1,a0
  1079.         bsr    Printer
  1080.         bsr    CloseSerial
  1081.         bsr    LoadPrefsFile
  1082.         bsr    OpenSerial
  1083.  
  1084.         bsr    SetSerParams
  1085.         tst.l    d0
  1086.         beq    DoLoad1
  1087.         bsr    ParamsNotSet
  1088. DoLoad1:    bra    Prefs1
  1089. DoSave:        lea.l    SaveText1,a0
  1090.         bsr    Printer
  1091.         bsr    SavePrefsFile
  1092.         bra    Prefs1
  1093.  
  1094. DoView:        lea.l    ViewText1,a0
  1095.         bsr    Printer
  1096.         bsr    DoANSI
  1097.         bsr    GiveSettings
  1098.         bsr    GetAnyKey
  1099.         bra    Prefs1
  1100.  
  1101. ClearSettings:    lea.l    ClearText3,a0
  1102.         bsr    Printer
  1103.         move.l    #9600,Speed
  1104.         move.b    #8,DataBits
  1105.         move.b    #1,StopBits
  1106.         clr.l    CRTranslate    ;All translating (long)
  1107.         clr.l    SwapBSDEL    ;SwapBSDEL+UseANSI+CPAssign+CursorRemap
  1108.         bsr    SetSerParams
  1109.         tst.l    d0
  1110.         beq    ClearSettings1
  1111.         bsr    ParamsNotSet
  1112. ClearSettings1:    bra    Prefs1
  1113.  
  1114. Terminal:    lea.l    STerminalText1,a0
  1115.         bsr    Printer
  1116. Terminal1:    bsr    DoANSI
  1117.         lea.l    STerminalText2,a0
  1118.         bsr    Printer
  1119. Terminal2:    move.l    _stdin,d1
  1120.         lib    Dos,FGetC
  1121.         cmp.l    #-1,d0
  1122.         beq    Prefs1
  1123.         cmp.l    #'a',d0
  1124.         bcs    Terminal3
  1125.         cmp.l    #'z',d0
  1126.         bhi    Terminal3
  1127.         sub.l    #32,d0
  1128. Terminal3:    cmp.l    #'L',d0
  1129.         beq    SetLocalEcho
  1130.         cmp.l    #'S',d0
  1131.         beq    SetSwapBSDEL
  1132.         cmp.l    #'1',d0
  1133.         beq    SetCRTrans
  1134.         cmp.l    #'2',d0
  1135.         beq    SetLFTrans
  1136.         cmp.l    #'3',d0
  1137.         beq    SetCRTransIn
  1138.         cmp.l    #'4',d0
  1139.         beq    SetLFTransIn
  1140.         cmp.l    #'A',d0
  1141.         beq    SetANSIMode
  1142.         cmp.l    #'C',d0
  1143.         beq    SetCRemapMode
  1144.         cmp.l    #'E',d0
  1145.         beq    Exit1
  1146.         cmp.l    #'M',d0
  1147.         beq    MainMenu
  1148.         cmp.l    #'-',d0
  1149.         beq    Prefs
  1150.         bra    Terminal2
  1151.  
  1152. SetCRemapMode:    bchg.b    #0,CursorRemap
  1153.         beq    SetCRemapMode1
  1154.         lea.l    CRemapText2,a0
  1155.         bsr    Printer
  1156.         bra    Terminal1
  1157. SetCRemapMode1:    lea.l    CRemapText1,a0
  1158.         bsr    Printer
  1159.         bra    Terminal1
  1160.  
  1161. SetANSIMode:    bchg.b    #0,UseANSI
  1162.         beq    SetANSIMode1
  1163.         lea.l    ANSIText2,a0
  1164.         bsr    Printer
  1165.         bra    Terminal1
  1166. SetANSIMode1:    lea.l    ANSIText1,a0
  1167.         bsr    Printer
  1168.         bra    Terminal1
  1169.  
  1170. SetSwapBSDEL:    bchg.b    #0,SwapBSDEL
  1171.         beq    SetSwapBSDEL1
  1172.         lea.l    SwapText2,a0
  1173.         bsr    Printer
  1174.         bra    Terminal1
  1175. SetSwapBSDEL1:    lea.l    SwapText1,a0
  1176.         bsr    Printer
  1177.         bra    Terminal1
  1178.  
  1179. SetCRTrans:    lea.l    CRTransText1,a0
  1180.         bsr    Printer
  1181.         lea.l    CRTransText2,a0
  1182.         bsr    Printer
  1183.         bsr    GetNSA
  1184.         cmp.l    #-1,d0
  1185.         beq    Terminal1
  1186.         move.b    d0,CRTranslate
  1187.         bra    Terminal1
  1188.  
  1189. SetLFTrans:    lea.l    LFTransText1,a0
  1190.         bsr    Printer
  1191.         lea.l    LFTransText2,a0
  1192.         bsr    Printer
  1193.         bsr    GetNSA
  1194.         cmp.l    #-1,d0
  1195.         beq    Terminal1
  1196.         move.b    d0,LFTranslate
  1197.         bra    Terminal1
  1198.  
  1199. SetCRTransIn:    lea.l    CRTransText3,a0
  1200.         bsr    Printer
  1201.         lea.l    CRTransText2,a0
  1202.         bsr    Printer
  1203.         bsr    GetNSA
  1204.         cmp.l    #-1,d0
  1205.         beq    Terminal1
  1206.         move.b    d0,CRTranslateIn
  1207.         bra    Terminal1
  1208.  
  1209. SetLFTransIn:    lea.l    LFTransText3,a0
  1210.         bsr    Printer
  1211.         lea.l    LFTransText2,a0
  1212.         bsr    Printer
  1213.         bsr    GetNSA
  1214.         cmp.l    #-1,d0
  1215.         beq    Terminal1
  1216.         move.b    d0,LFTranslateIn
  1217.         bra    Terminal1
  1218.  
  1219. SetLocalEcho:    bchg.b    #0,LocalEcho
  1220.         beq    SetLocalEcho1
  1221.         lea.l    EchoText2,a0
  1222.         bsr    Printer
  1223.         bra    Terminal1
  1224. SetLocalEcho1:    lea.l    EchoText1,a0
  1225.         bsr    Printer
  1226.         bra    Terminal1
  1227.  
  1228. SetSpeed:    lea.l    SpeedText11,a0
  1229.         bsr    Printer
  1230. SetSpeed1:    bsr    DoANSI
  1231.         lea.l    SpeedText1,a0
  1232.         bsr    Printer
  1233. SetSpeed2:    move.l    _stdin,d1
  1234.         lib    Dos,FGetC
  1235.         cmp.l    #-1,d0
  1236.         beq    Prefs1
  1237.         cmp.l    #'a',d0
  1238.         bcs    SetSpeed3
  1239.         cmp.l    #'z',d0
  1240.         bhi    SetSpeed3
  1241.         sub.l    #32,d0
  1242. SetSpeed3:    move.l    Speed,d7    ;get real speed if fail later
  1243.         cmp.l    #'0',d0
  1244.         beq    DoSpeed0
  1245.         cmp.l    #'1',d0
  1246.         beq    DoSpeed1
  1247.         cmp.l    #'2',d0
  1248.         beq    DoSpeed2
  1249.         cmp.l    #'3',d0
  1250.         beq    DoSpeed3
  1251.         cmp.l    #'4',d0
  1252.         beq    DoSpeed4
  1253.         cmp.l    #'5',d0
  1254.         beq    DoSpeed5
  1255.         cmp.l    #'6',d0
  1256.         beq    DoSpeed6
  1257.         cmp.l    #'7',d0
  1258.         beq    DoSpeed7
  1259.         cmp.l    #'8',d0
  1260.         beq    DoSpeed8
  1261.         cmp.l    #'9',d0
  1262.         beq    DoSpeed9
  1263.         cmp.l    #'D',d0
  1264.         beq    SetDataBits
  1265.         cmp.l    #'S',d0
  1266.         beq    SetStopBits
  1267.         cmp.l    #'N',d0
  1268.         beq    SetDevice
  1269.         cmp.l    #'R',d0
  1270.         beq    ReOpenDevice
  1271.         cmp.l    #'X',d0
  1272.         beq    SetXONXOFF
  1273.         cmp.l    #'C',d0
  1274.         beq    SetCTSRTS
  1275.         cmp.l    #'E',d0
  1276.         beq    Exit1
  1277.         cmp.l    #'M',d0
  1278.         beq    MainMenu
  1279.         cmp.l    #'-',d0
  1280.         beq    Prefs
  1281.         bra    SetSpeed2
  1282.  
  1283. DoSpeed1:    move.l    #110,Speed
  1284.         bra    DoSpeed_OUT
  1285. DoSpeed2:    move.l    #300,Speed
  1286.         bra    DoSpeed_OUT
  1287. DoSpeed3:    move.l    #1200,Speed
  1288.         bra    DoSpeed_OUT
  1289. DoSpeed4:    move.l    #2400,Speed
  1290.         bra    DoSpeed_OUT
  1291. DoSpeed5:    move.l    #4800,Speed
  1292.         bra    DoSpeed_OUT
  1293. DoSpeed6:    move.l    #9600,Speed
  1294.         bra    DoSpeed_OUT
  1295. DoSpeed7:    move.l    #19200,Speed
  1296.         bra    DoSpeed_OUT
  1297. DoSpeed8:    move.l    #38400,Speed
  1298.         bra    DoSpeed_OUT
  1299. DoSpeed9:    move.l    #57600,Speed
  1300.         bra    DoSpeed_OUT
  1301. DoSpeed0:    move.l    #115200,Speed
  1302. DoSpeed_OUT:    lea.l    SpeedText13,a0
  1303.         bsr    Printer
  1304.  
  1305.         bsr    SetSerParams
  1306.         tst.l    d0
  1307.         beq    DoSpeed_OUT1
  1308.  
  1309.         lea.l    SpeedText12,a0
  1310.         bsr    Printer
  1311.         move.l    d7,Speed
  1312. DoSpeed_OUT1:    bra    SetSpeed1        ;OPTI
  1313.  
  1314. SetDevice:    lea.l    NameText1,a0
  1315.         bsr    Printer
  1316.  
  1317.         lea.l    NameText2,a0
  1318.         bsr    Printer
  1319.  
  1320.         lea.l    SerDevNBuffer1,a0
  1321.         move.l    #32,d3
  1322.         bsr    GetString
  1323.         tst.l    d0
  1324.         bne    SetSpeed1
  1325.  
  1326.         lea.l    NameText3,a0
  1327.         bsr    Printer
  1328.  
  1329.         lea.l    DialBuffer1,a0
  1330.         move.l    #12,d3
  1331.         bsr    GetString
  1332.         tst.l    d0
  1333.         bne    SetSpeed1
  1334.  
  1335.         lea.l    DialBuffer1,a0
  1336.         bsr    ConvASCII
  1337.         move.l    d0,SerUnit
  1338.  
  1339.         lea.l    CRLFText1,a0
  1340.         bsr    Printer
  1341.  
  1342.         bsr    CloseSerial
  1343.         bsr    OpenSerial
  1344.  
  1345.         bsr    SetSerParams
  1346.         tst.l    d0
  1347.         beq    SetDevice1
  1348.         bsr    ParamsNotSet
  1349.  
  1350. SetDevice1:    bra    SetSpeed1
  1351.  
  1352. ReOpenDevice:    lea.l    ReOpenText1,a0
  1353.         bsr    Printer
  1354.         bsr    CloseSerial
  1355.         bsr    OpenSerial
  1356.         bsr    SetSerParams
  1357.         tst.l    d0
  1358.         beq    ReOpenDevice1
  1359.         bsr    ParamsNotSet
  1360. ReOpenDevice1:    bra    SetSpeed1
  1361.  
  1362. SetDataBits:    move.b    DataBits,d7
  1363. SetDataBits0.1:    cmp.b    #7,DataBits
  1364.         beq    SetDataBits1
  1365.         move.b    #7,DataBits
  1366.         lea.l    DBitsText1,a0
  1367.         bsr    Printer
  1368.         bra    SetDataBits2
  1369. SetDataBits1:    move.b    #8,DataBits
  1370.         lea.l    DBitsText2,a0
  1371.         bsr    Printer
  1372.         bra    SetSpeed1
  1373. SetDataBits2:    bsr    SetSerParams
  1374.         tst.l    d0
  1375.         beq    SetSpeed1
  1376.         move.b    d7,DataBits
  1377.         lea.l    DBitsText3,a0
  1378.         bsr    Printer
  1379.         bra    SetSpeed1
  1380.  
  1381. SetStopBits:    move.b    StopBits,d7
  1382. SetStopBits0.1:    cmp.b    #1,StopBits
  1383.         beq    SetStopBits1
  1384.         move.b    #1,StopBits
  1385.         lea.l    SBitsText1,a0
  1386.         bsr    Printer
  1387.         bra    SetStopBits2
  1388. SetStopBits1:    move.b    #2,StopBits
  1389.         lea.l    SBitsText2,a0
  1390.         bsr    Printer
  1391.         bra    SetSpeed1
  1392. SetStopBits2:    bsr    SetSerParams
  1393.         tst.l    d0
  1394.         beq    SetSpeed1
  1395.         move.b    d7,StopBits
  1396.         lea.l    SBitsText3,a0
  1397.         bsr    Printer
  1398.         bra    SetSpeed1
  1399.  
  1400. SetXONXOFF:    bchg.b    #0,XONXOFF
  1401.         beq    SetXONXOFF1
  1402.         lea.l    XXText2,a0
  1403.         bsr    Printer
  1404.         bsr    SetSerParams
  1405.         tst.l    d0
  1406.         bne    SetXONXOFF2
  1407.         bra    SetSpeed1
  1408. SetXONXOFF1:    lea.l    XXText1,a0
  1409.         bsr    Printer
  1410.         bsr    SetSerParams
  1411.         tst.l    d0
  1412.         beq    SetSpeed1
  1413. SetXONXOFF2:    lea.l    XXText3,a0
  1414.         bsr    Printer
  1415.         bra    SetSpeed1
  1416.  
  1417. SetCTSRTS:    bchg.b    #0,CTSRTS
  1418.         beq    SetCTSRTS1
  1419.         lea.l    CTSRTSText2,a0            ;Off
  1420.         bsr    Printer
  1421.         bra    SetCTSRTS2
  1422. SetCTSRTS1:    lea.l    CTSRTSText1,a0            ;On
  1423.         bsr    Printer
  1424. SetCTSRTS2:    bsr    CloseSerial
  1425.         bsr    OpenSerial
  1426.         bsr    SetSerParams
  1427.         tst.l    d0
  1428.         beq    SetCTSRTS3
  1429.         lea.l    CTSRTSText3,a0
  1430.         bsr    Printer
  1431. SetCTSRTS3:    bra    SetSpeed1
  1432.  
  1433.  
  1434.  
  1435. ;Dials one number. Fails for three reasons, because the user decided
  1436. ;to skip this entry, to cancel dialing or to remove this entry.
  1437. ;If a busy is found, a value of 1 will be returned.
  1438. ;
  1439. ;Inputs a0 = pointer to phonenumber (ASCII text)
  1440. ;
  1441. ;Result d0 = Success (0=Connect, 1=Skipped, 2=Cancelled, 3=Remove this entry)
  1442. ;
  1443.  
  1444. DialEntry:    push    d2-d7/a2-a6
  1445.         move.l    a0,a4
  1446.  
  1447. DialEntry1:    lea.l    DialPrefix,a1
  1448.         bsr    GetLength
  1449.         lea.l    DialPrefix,a0
  1450.         bsr    Writer2
  1451.         move.l    a4,a1
  1452.         bsr    GetLength
  1453.         move.l    a4,a0
  1454.         bsr    Writer2
  1455.         lea.l    CRLFText1,a1
  1456.         bsr    GetLength
  1457.         lea.l    CRLFText1,a0
  1458.         bsr    Writer2
  1459.         lea.l    DialingText1,a0
  1460.         bsr    Printer
  1461.         move.l    a4,a0
  1462.         bsr    Printer
  1463.         lea.l    CRLFText1,a0
  1464.         bsr    Printer
  1465.         move.l    #BUFLEN,d0        ;try to read ATDT etc.
  1466.         move.l    #1,d1
  1467.         bsr    Read
  1468.  
  1469. DialEntry2:    move.l    #10,d1
  1470.         lib    Dos,Delay
  1471.         move.l    #BUFLEN,d0
  1472.         move.l    #4,d1
  1473.         bsr    Read
  1474.         tst.l    d0
  1475.         beq    DialEntry3
  1476.         lea.l    Buffer3,a0
  1477.         clr.b    0(a0,d0.l)    ;null terminated, please!
  1478.         move.b    #'C',d0
  1479.         move.b    #'O',d1
  1480.         lea.l    Buffer3,a0
  1481.         bsr    FindWord
  1482.         bne    DialEntry_OUT1
  1483.         move.b    #'B',d0
  1484.         move.b    #'U',d1
  1485.         lea.l    Buffer3,a0
  1486.         bsr    FindWord
  1487.         bne    DialEntry4
  1488.         move.b    #'N',d1
  1489.         move.b    #'O',d1
  1490.         lea.l    Buffer3,a0
  1491.         bsr    FindWord
  1492.         bne    DialEntry_OUT2
  1493. DialEntry3:    move.l    _stdin,d1
  1494.         move.l    #10000,d2
  1495.         lib    Dos,WaitForChar
  1496.         tst.l    d0
  1497.         beq    DialEntry2
  1498.         move.l    _stdin,d1
  1499.         lea.l    Buffer2,a0
  1500.         move.l    a0,d2
  1501.         move.l    #1,d3
  1502.         lib    Dos,Read
  1503.         cmp.l    #1,d0
  1504.         bne    DialEntry2
  1505.         cmp.b    #' ',Buffer2    ;Space
  1506.         beq    DialEntry_OUT2
  1507.         cmp.b    #27,Buffer2    ;ESC
  1508.         beq    DialEntry_OUT3
  1509.         cmp.b    #8,Buffer2    ;BS
  1510.         beq    DialEntry_OUT4
  1511.         bra    DialEntry2
  1512. DialEntry4:    lea.l    BusyText1,a0
  1513.         bsr    Printer
  1514.         move.l    #50+25,d1
  1515.         lib    Dos,Delay
  1516.         pull    d2-d7/a2-a6
  1517.         move.l    #1,d0
  1518.         rts
  1519. DialEntry_OUT1:    move.l    #BUFLEN,d0        ;try to read extra stuff
  1520.         move.l    #1,d1
  1521.         bsr    Read
  1522. ;        lea.l    ConnectText1,a0
  1523. ;        bsr    Printer
  1524.         pull    d2-d7/a2-a6
  1525.         clr.l    d0
  1526.         rts
  1527. DialEntry_OUT2:    lea.l    CRLFText1,a1
  1528.         bsr    GetLength
  1529.         lea.l    CRLFText1,a0
  1530.         bsr    Writer2
  1531.         lea.l    SkippedText1,a0
  1532.         bsr    Printer
  1533.         move.l    #50+25,d1
  1534.         lib    Dos,Delay
  1535.         pull    d2-d7/a2-a6
  1536.         move.l    #1,d0
  1537.         rts
  1538. DialEntry_OUT3:    lea.l    CancelledText1,a0
  1539.         bsr    Printer
  1540.         lea.l    CRLFText1,a1
  1541.         bsr    GetLength
  1542.         lea.l    CRLFText1,a0
  1543.         bsr    Writer2
  1544.         move.l    #50+25,d1
  1545.         lib    Dos,Delay
  1546.         pull    d2-d7/a2-a6
  1547.         move.l    #2,d0
  1548.         rts
  1549. DialEntry_OUT4:    lea.l    CRLFText1,a1
  1550.         bsr    GetLength
  1551.         lea.l    CRLFText1,a0
  1552.         bsr    Writer2
  1553.         move.l    #55,d1
  1554.         lib    Dos,Delay
  1555.         lea.l    RemoveText1,a0
  1556.         bsr    Printer
  1557.         pull    d2-d7/a2-a6
  1558.         move.l    #3,d0
  1559.         rts
  1560.  
  1561. Break:        lea.l    BreakText1,a0
  1562.         bsr    Printer
  1563.         clr.l    d0
  1564.         rts
  1565.  
  1566. ClearSer:    tst.w    SerOpen
  1567.         beq    ClearSer_OUT
  1568.         move.l    IORRequest,a1
  1569.         ABORTIO
  1570.         move.l    IORRequest,a1
  1571.         lib    Exec,WaitIO
  1572. ClearSer_OUT:    rts
  1573.  
  1574. ;Buffered read from a device
  1575. ;
  1576. ;Inputs d0 = Buffer length (maximum amount to read)
  1577. ;    d1 = Minimum amout to read
  1578. ;
  1579. ;Result d0 = Amount actually read
  1580. ;
  1581.  
  1582. Read:        push    d2-d7/a2-a6
  1583.  
  1584.         tst.w    SerOpen
  1585.         beq    Read_OUT1
  1586.  
  1587.         move.l    d0,d4
  1588.         move.l    d1,d5
  1589.  
  1590.                 move.l  IOQRequest,a1                   ;get amount of bytes
  1591.         move.w    #SDCMD_QUERY,IO_COMMAND(a1)    ;in buffer
  1592. ;        or.b    #IOF_QUICK,IO_FLAGS(a1)
  1593.         lib    Exec,DoIO
  1594.  
  1595.                 move.l  IOQRequest,a1
  1596.         move.l    IO_ACTUAL(a1),d0
  1597.         beq    Read_OUT1
  1598.         cmp.l    d5,d0
  1599.         bmi    Read_OUT1
  1600.         cmp.l    d4,d0
  1601.         bls    Read1
  1602.         move.l    d4,d0            ;available > buffer size
  1603. Read1:        move.l    IORRequest,a1
  1604.         move.l    d0,IO_LENGTH(a1)
  1605.         BEGINIO
  1606.  
  1607.         move.l    IORRequest,a1
  1608.         move.l    IO_ACTUAL(a1),d0    ;even on an error we return
  1609.         add.l    d0,Received        ;correct amount in buffer
  1610.         pull    d2-d7/a2-a6
  1611.         rts
  1612.  
  1613. Read_OUT1:    clr.l    d0
  1614.         pull    d2-d7/a2-a6
  1615.         rts
  1616.  
  1617. Writer:        tst.w    SerOpen
  1618.         beq    Writer1.1
  1619.         add.l    #1,Sent
  1620.         move.l    IOWRequest,a1
  1621.         move.l    #1,IO_LENGTH(a1)        ;writes in one byte "chunks"
  1622.         move.w    #CMD_WRITE,IO_COMMAND(a1)
  1623.         lea.l    Buffer1,a0
  1624.         move.l    a0,IO_DATA(a1)
  1625.         lib    Exec,DoIO        ;May freeze, too bad
  1626. Writer1.1:    rts
  1627.  
  1628. ;Writes string to serial port
  1629. ;
  1630. ;D0 = Length
  1631. ;A0 = String
  1632.  
  1633. Writer2:    tst.w    SerOpen
  1634.         beq    Writer2.1
  1635.         add.l    d0,Sent
  1636.         move.l    IOWRequest,a1
  1637.         move.w    #CMD_WRITE,IO_COMMAND(a1)
  1638.         move.l    d0,IO_LENGTH(a1)
  1639.         move.l    a0,IO_DATA(a1)
  1640.         lib    Exec,DoIO        ;May freeze, too bad
  1641. Writer2.1:    rts
  1642.  
  1643. DoCapture:    move.l    CaptureFile,d1
  1644.         beq    DoCapture_OUT
  1645.         lea.l    Buffer4,a1
  1646.         bsr    GetLength
  1647.         move.l    d0,d3
  1648.         lea.l    Buffer4,a0
  1649.         move.l    a0,d2
  1650.         lib    Dos,Write
  1651. DoCapture_OUT:    rts
  1652.  
  1653. SetSerParams:    tst.w    SerOpen
  1654.         beq    SSerParams_OUT
  1655.  
  1656.         move.l    IOSRequest,a1
  1657.         move.w    #SDCMD_SETPARAMS,IO_COMMAND(a1)
  1658.         clr.l    IO_EXTFLAGS(a1)
  1659.         clr.l    d4
  1660.         clr.l    d5
  1661.         and.b    #~SERF_XDISABLED,IO_SERFLAGS(a1)
  1662.         tst.b    XONXOFF
  1663.         bne    SetSerParams1            ;Is this wrong?
  1664.         or.b    #SERF_XDISABLED,IO_SERFLAGS(a1)
  1665.         move.l    #$DEADBEEF,d4
  1666. SetSerParams1:    move.l    Speed,IO_BAUD(a1)
  1667.         move.b    DataBits,IO_READLEN(a1)
  1668.         move.b    DataBits,IO_WRITELEN(a1)
  1669.         move.b    StopBits,IO_STOPBITS(a1)
  1670.         lib    Exec,DoIO
  1671.         move.l    IOSRequest,a1
  1672.         clr.l    d0
  1673.         move.b    IO_ERROR(a1),d0
  1674.         cmp.l    #SerErr_DevBusy,d0
  1675.         beq    SetSerParams2
  1676.         rts
  1677. SetSerParams2:    cmp.l    #$DEADBEEF,d4        ;If we set XON/XOFF and
  1678.         beq    SSerParams_OUT        ;got error then clear it
  1679.         rts
  1680. SSerParams_OUT:    clr.l    d0
  1681.         rts
  1682.  
  1683. SendBREAK:    tst.w    SerOpen
  1684.         beq    SendBreak_OUT
  1685.         move.l    IOWRequest,a1
  1686.         move.w    #SDCMD_BREAK,IO_COMMAND(a1)
  1687.         or.b    #IOF_QUICK,IO_FLAGS(a1)
  1688.         lib    Exec,DoIO
  1689. SendBreak_OUT:    rts
  1690.  
  1691. DoCLIInput:    lea.l    Buffer1,a0
  1692.         cmp.b    #CR,Buffer1
  1693.         beq    DoCLIInput3
  1694.         cmp.b    #LF,Buffer1
  1695.         beq    DoCLIInput4
  1696.         cmp.b    #BS,Buffer1
  1697.         beq    DoCLIInput5
  1698.         cmp.b    #DEL,Buffer1
  1699.         beq    DoCLIInput6
  1700.         cmp.b    #CSI,Buffer1
  1701.         beq    DoCSI
  1702. DoCLIInput1:    bsr    Writer
  1703.         btst.b    #0,LocalEcho
  1704.         beq    DoCLIInput2
  1705.         lea.l    Buffer1,a0
  1706.         bsr    Printer
  1707. DoCLIInput2:    rts
  1708. DoCLIInput3:    tst.b    CRTranslate
  1709.         beq    DoCLIInput1
  1710.         cmp.b    #1,CRTranslate
  1711.         beq    DoCLIInput2
  1712.         cmp.b    #2,CRTranslate
  1713.         bne    DoCLIInput2
  1714.         bsr    DoCLIInput1
  1715.         move.b    #LF,Buffer1
  1716.         bra    DoCLIInput1
  1717. DoCLIInput4:    tst.b    LFTranslate
  1718.         beq    DoCLIInput1
  1719.         cmp.b    #1,LFTranslate
  1720.         beq    DoCLIInput2
  1721.         cmp.b    #2,LFTranslate
  1722.         bne    DoCLIInput2
  1723.         move.b    #CR,Buffer1
  1724.         bsr    DoCLIInput1
  1725.         move.b    #LF,Buffer1
  1726.         bra    DoCLIInput1
  1727. DoCLIInput5:    tst.b    SwapBSDEL
  1728.         beq    DoCLIInput1
  1729.         move.b    #DEL,Buffer1
  1730.         bra    DoCLIInput1
  1731. DoCLIInput6:    tst.b    SwapBSDEL
  1732.         beq    DoCLIInput1
  1733.         move.b    #BS,Buffer1
  1734.         bra    DoCLIInput1
  1735.  
  1736. DoCSI:        tst.b    CursorRemap
  1737.         beq    DoCSI_OUT
  1738.         move.l    _stdin,d1
  1739.         lea.l    Buffer1,a0
  1740.         move.l    a0,d2
  1741.         move.l    #1,d3
  1742.         lib    Dos,Read
  1743.         cmp.b    #Cursor_Up,Buffer1
  1744.         beq    DoCSI1
  1745.         cmp.b    #Cursor_Down,Buffer1
  1746.         beq    DoCSI2
  1747.         cmp.b    #Cursor_Left,Buffer1
  1748.         beq    DoCSI3
  1749.         cmp.b    #Cursor_Right,Buffer1
  1750.         beq    DoCSI4
  1751.         bra    DoCLIInput1
  1752. DoCSI1:        move.b    #CTRL_P,Buffer1
  1753.         bra    DoCLIInput1
  1754. DoCSI2:        move.b    #CTRL_N,Buffer1
  1755.         bra    DoCLIInput1
  1756. DoCSI3:        move.b    #CTRL_B,Buffer1
  1757.         bra    DoCLIInput1
  1758. DoCSI4:        move.b    #CTRL_F,Buffer1
  1759. DoCSI_OUT:    bra    DoCLIInput1
  1760.  
  1761. DoSerialInput:    push    d0-d7/a2-a6
  1762.         lea.l    Buffer3,a0
  1763.         lea.l    Buffer4,a1
  1764. DoSerialInput1:    tst.b    (a0)
  1765.         beq    DoSerialInput3.1
  1766.         cmp.b    #CR,(a0)
  1767.         beq    DoSerialInput4
  1768.         cmp.b    #LF,(a0)
  1769.         beq    DoSerialInput6
  1770. DoSerialInput2:    move.b    (a0)+,(a1)+
  1771.         bra    DoSerialInput1
  1772. DoSerialInput3:    pull    d0-d7/a2-a6
  1773.         rts
  1774. DoSerialInput3.1: clr.b    (a1)
  1775.         pull    d0-d7/a2-a6
  1776.         rts
  1777. DoSerialInput4:    tst.b    CRTranslateIn
  1778.         beq    DoSerialInput2
  1779.         cmp.b    #1,CRTranslateIn
  1780.         bne    DoSerialInput5
  1781.         add.l    #1,a0
  1782.         bra    DoSerialInput1
  1783. DoSerialInput5:    cmp.b    #2,CRTranslateIn
  1784.         bne    DoSerialInput2
  1785.         move.b    #CR,(a1)+
  1786.         move.b    #LF,(a1)+
  1787.         add.l    #1,a0
  1788.         bra    DoSerialInput1
  1789. DoSerialInput6:    tst.b    LFTranslateIn
  1790.         beq    DoSerialInput2
  1791.         cmp.b    #1,LFTranslateIn
  1792.         bne    DoSerialInput7
  1793.         add.l    #1,a0
  1794.         bra    DoSerialInput1
  1795. DoSerialInput7:    cmp.b    #2,LFTranslateIn
  1796.         bne    DoSerialInput2
  1797.         move.b    #CR,(a1)+
  1798.         move.b    #LF,(a1)+
  1799.         add.l    #1,a0
  1800.         bra    DoSerialInput1
  1801.  
  1802. ;gets anykey from user
  1803. ;
  1804. ;Results d0 = -1 for error, otherwise d0 = key pressed
  1805.  
  1806. GetAnyKey:    lea.l    AnyKeyText1,a0
  1807.         bsr    Printer
  1808.         move.l    _stdin,d1
  1809.         lib    Dos,Flush
  1810.         move.l    _stdin,d1
  1811.         lib    Dos,FGetC
  1812.         lea.l    CRLFText1,a0
  1813.         bsr    Printer
  1814.         rts
  1815.  
  1816. ;Gets a string from the user, null terminated
  1817. ;
  1818. ;Inputs    a0 = pointer to buffer
  1819. ;    d3 = length of buffer
  1820. ;
  1821. ;Result    d0 = -1 if failed
  1822. ;
  1823.  
  1824. GetString:    push    a0
  1825.         push    a0
  1826.         move.l    _stdin,d1
  1827.         move.l    #FALSE,d2
  1828.         lib    Dos,SetMode
  1829.  
  1830.         move.l    _stdin,d1
  1831.         lib    Dos,Flush
  1832.  
  1833.         move.l    _stdin,d1
  1834.         pull    d2
  1835.         lib    Dos,FGets
  1836.         tst.l    d0
  1837.         beq    GetString_OUT2
  1838.  
  1839.         pull    a0
  1840.         bsr    GetLLength
  1841.         clr.b    -1(a0,d1.l)    ;remove LF
  1842.  
  1843.         move.l    _stdin,d1
  1844.         move.l    #TRUE,d2
  1845.         lib    Dos,SetMode
  1846.  
  1847.         move.l    _stdin,d1
  1848.         lib    Dos,Flush
  1849.  
  1850.         clr.l    d0
  1851.         rts
  1852.  
  1853. GetString_OUT2:    move.l    #-1,d0
  1854.         rts
  1855.  
  1856. ;Gets input from user
  1857. ;
  1858. ;Results d0 = 0 for N, 1 for S, 2 for A, -1 for error
  1859.  
  1860. GetNSA:        move.l    _stdin,d1
  1861.         lib    Dos,FGetC
  1862.         cmp.l    #-1,d0
  1863.         beq    GetNSA_ERR1
  1864.         cmp.l    #'a',d0
  1865.         bcs    GetNSA0.1
  1866.         cmp.l    #'z',d0
  1867.         bhi    GetNSA0.1
  1868.         sub.l    #32,d0
  1869. GetNSA0.1:    cmp.l    #'N',d0
  1870.         beq    GetNSA1
  1871.         cmp.l    #'S',d0
  1872.         beq    GetNSA2
  1873.         cmp.l    #'A',d0
  1874.         beq    GetNSA3
  1875.         cmp.l    #CR,d0
  1876.         beq    GetNSA_ERR1
  1877.         cmp.l    #LF,d0
  1878.         beq    GetNSA_ERR1
  1879.         bra    GetNSA
  1880. GetNSA1:    lea.l    NoneText1,a0
  1881.         bsr    Printer
  1882.         move.l    #0,d0
  1883.         rts
  1884. GetNSA2:    lea.l    StripText1,a0
  1885.         bsr    Printer
  1886.         move.l    #1,d0
  1887.         rts
  1888. GetNSA3:    lea.l    AddText1,a0
  1889.         bsr    Printer
  1890.         move.l    #2,d0
  1891.         rts
  1892. GetNSA_ERR1:    move.l    #-1,d0
  1893.         rts
  1894.  
  1895. ;Give NSA
  1896. ;
  1897. ;Inputs d0 = NSA qualifier(?)
  1898. ;
  1899.  
  1900. GiveNSA:    tst.b    d0
  1901.         beq    GiveNSA1
  1902.         cmp.b    #1,d0
  1903.         beq    GiveNSA2
  1904.         cmp.b    #2,d0
  1905.         beq    GiveNSA3
  1906.         lea.l    NAText1,a0
  1907.         bsr    Printer
  1908.         rts
  1909. GiveNSA1:    lea.l    NText1,a0
  1910.         bsr    Printer
  1911.         rts
  1912. GiveNSA2:    lea.l    SText1,a0
  1913.         bsr    Printer
  1914.         rts
  1915. GiveNSA3:    lea.l    AText1,a0
  1916.         bsr    Printer
  1917.         rts
  1918.  
  1919. Nope:        lea.l    SpaceText1,a0
  1920.         bsr    Printer
  1921.         rts
  1922. Yep:        lea.l    StarText1,a0
  1923.         bsr    Printer
  1924.         rts
  1925.  
  1926. GiveSettings:    clr.l    SpeedText90
  1927.         clr.l    SpeedText90+4
  1928.         clr.l    SpeedText90+8
  1929.         lea.l    fstrl3,a0        ;HEX->ASCII
  1930.         lea.l    Speed,a1        ;Number2Print
  1931.         lea.l    PutChProc,a2
  1932.         lea.l    SpeedText90,a3        ;Destination
  1933.         lib    Exec,RawDoFmt
  1934.  
  1935.         lea.l    CurrentText1,a0
  1936.         bsr    Printer
  1937.  
  1938.         tst.l    Speed
  1939.         beq    GiveSettings0.1
  1940.         lea.l    SpeedText90,a0
  1941.         bsr    Printer
  1942.         bra    GiveSettings0.2
  1943.  
  1944. GiveSettings0.1: lea.l    DefText1,a0
  1945.         bsr    Printer
  1946.  
  1947. GiveSettings0.2: lea.l    CurrentText2,a0
  1948.         bsr    Printer
  1949.  
  1950.         tst.w    LocalEcho
  1951.         bne    GiveSettings1
  1952.         bsr    Nope
  1953.         bra    GiveSettings2
  1954. GiveSettings1:    bsr    Yep
  1955.  
  1956. GiveSettings2:    lea.l    CurrentText7,a0
  1957.         bsr    Printer
  1958.  
  1959.         lea.l    CurrentText3,a0
  1960.         bsr    Printer
  1961.  
  1962.         move.b    CRTranslate,d0
  1963.         bsr    GiveNSA
  1964.  
  1965.         lea.l    CurrentText4,a0
  1966.         bsr    Printer
  1967.  
  1968.         move.b    LFTranslate,d0
  1969.         bsr    GiveNSA
  1970.  
  1971.         lea.l    CurrentText7,a0
  1972.         bsr    Printer
  1973.  
  1974.         lea.l    CurrentText5,a0
  1975.         bsr    Printer
  1976.  
  1977.         move.b    CRTranslateIn,d0
  1978.         bsr    GiveNSA
  1979.  
  1980.         lea.l    CurrentText6,a0
  1981.         bsr    Printer
  1982.  
  1983.         move.b    LFTranslateIn,d0
  1984.         bsr    GiveNSA
  1985.  
  1986.         lea.l    CurrentText7,a0
  1987.         bsr    Printer
  1988.  
  1989.         lea.l    CurrentText8,a0
  1990.         bsr    Printer
  1991.  
  1992.         cmp.b    #7,DataBits
  1993.         bne    GiveSettings3
  1994.         lea.l    SevenText1,a0
  1995.         bsr    Printer
  1996.         bra    GiveSettings4
  1997. GiveSettings3:    cmp.b    #8,DataBits
  1998.         bne    GiveSettings3.1
  1999.         lea.l    EightText1,a0
  2000.         bsr    Printer
  2001.         bra    GiveSettings4
  2002. GiveSettings3.1: lea.l    DefText1,a0
  2003.         bsr    Printer
  2004.  
  2005. GiveSettings4:    lea.l    CurrentText9,a0
  2006.         bsr    Printer
  2007.  
  2008.         cmp.b    #1,StopBits
  2009.         bne    GiveSettings5
  2010.         lea.l    OneText1,a0
  2011.         bsr    Printer
  2012.         bra    GiveSettings6
  2013. GiveSettings5:    cmp.b    #2,StopBits
  2014.         bne    GiveSettings5.1
  2015.         lea.l    TwoText1,a0
  2016.         bsr    Printer
  2017.         bra    GiveSettings6
  2018. GiveSettings5.1: lea.l    DefText1,a0
  2019.         bsr    Printer
  2020.  
  2021. GiveSettings6:    lea.l    CurrentText7,a0
  2022.         bsr    Printer
  2023.  
  2024.         lea.l    CurrentText9.01,a0
  2025.         bsr    Printer
  2026.  
  2027.         tst.b    XONXOFF
  2028.         bne    GiveSettings6.1
  2029.         bsr    Nope
  2030.         bra    GiveSettings6.2
  2031. GiveSettings6.1: bsr    Yep
  2032.  
  2033. GiveSettings6.2: lea.l    CurrentText9.02,a0
  2034.         bsr    Printer
  2035.  
  2036.         tst.b    CTSRTS
  2037.         bne    GiveSettings6.3
  2038.         bsr    Nope
  2039.         bra    GiveSettings6.4
  2040. GiveSettings6.3: bsr    Yep
  2041.  
  2042. GiveSettings6.4: lea.l    CurrentText7,a0
  2043.         bsr    Printer
  2044.  
  2045.         lea.l    CurrentText9.1,a0
  2046.         bsr    Printer
  2047.  
  2048.         tst.b    SwapBSDEL
  2049.         bne    GiveSettings7
  2050.         bsr    Nope
  2051.         bra    GiveSettings8
  2052. GiveSettings7:    bsr    Yep
  2053.  
  2054. GiveSettings8:    lea.l    CurrentText9.11,a0
  2055.         bsr    Printer
  2056.  
  2057.         tst.b    UseANSI
  2058.         bne    GiveSettings9
  2059.         bsr    Nope
  2060.         bra    GiveSettings10
  2061. GiveSettings9:    bsr    Yep
  2062.  
  2063. GiveSettings10:    lea.l    CurrentText7,a0
  2064.         bsr    Printer
  2065.  
  2066.         lea.l    CurrentText9.12,a0
  2067.         bsr    Printer
  2068.  
  2069.         tst.b    CursorRemap
  2070.         bne    GiveSettings11
  2071.         bsr    Nope
  2072.         bra    GiveSettings12
  2073. GiveSettings11:    bsr    Yep
  2074.  
  2075. GiveSettings12:    lea.l    CurrentText7,a0
  2076.         bsr    Printer
  2077.  
  2078.         lea.l    CurrentText9.2,a0
  2079.         bsr    Printer
  2080.  
  2081.         clr.w    CPAssignText
  2082.         clr.l    CTRLPASCII
  2083.         move.b    CPAssign,CPAssignText+1
  2084.         lea.l    fstrl4,a0        ;HEX->ASCII
  2085.         lea.l    CPAssignText,a1        ;Number2Print
  2086.         lea.l    PutChProc,a2
  2087.         lea.l    CTRLPASCII,a3        ;Destination
  2088.         lib    Exec,RawDoFmt
  2089.  
  2090.         lea.l    CTRLPASCII,a0
  2091.         bsr    Printer
  2092.  
  2093.         lea.l    CRLFText1,a0
  2094.         bsr    Printer
  2095.  
  2096.         lea.l    CurrentText9.3,a0
  2097.         bsr    Printer
  2098.  
  2099.         lea.l    ULProgram,a0
  2100.         bsr    Printer
  2101.  
  2102.         lea.l    CurrentText9.4,a0
  2103.         bsr    Printer
  2104.  
  2105.         lea.l    DLProgram,a0
  2106.         bsr    Printer
  2107.  
  2108.         lea.l    CurrentText9.5,a0
  2109.         bsr    Printer
  2110.  
  2111.         lea.l    ULDir,a0
  2112.         bsr    Printer
  2113.  
  2114.         lea.l    CurrentText9.6,a0
  2115.         bsr    Printer
  2116.  
  2117.         lea.l    DLDir,a0
  2118.         bsr    Printer
  2119.  
  2120.         lea.l    CRLFText1,a0
  2121.         bsr    Printer
  2122.  
  2123.         lea.l    CurrentText10,a0
  2124.         bsr    Printer
  2125.  
  2126.         lea.l    SerDevNBuffer1,a0
  2127.         bsr    Printer
  2128.  
  2129.         lea.l    CurrentText11,a0
  2130.         bsr    Printer
  2131.  
  2132.         lea.l    fstrl3,a0        ;HEX->ASCII
  2133.         lea.l    SerUnit,a1        ;Number2Print
  2134.         lea.l    PutChProc,a2
  2135.         lea.l    CurrentText12,a3    ;Destination
  2136.         lib    Exec,RawDoFmt
  2137.  
  2138.         lea.l    CurrentText12,a0
  2139.         bsr    Printer
  2140.  
  2141.         lea.l    CurrentText13,a0
  2142.         bsr    Printer
  2143.  
  2144.         lea.l    FileNameBuf1,a0
  2145.         bsr    Printer
  2146.  
  2147.         lea.l    CRLFText1,a0
  2148.         bsr    Printer
  2149.  
  2150.         rts
  2151.  
  2152. GiveStats:    lea.l    fstrl1,a0        ;HEX->ASCII
  2153.         lea.l    Received,a1        ;Number2Print
  2154.         lea.l    PutChProc,a2
  2155.         lea.l    ReceivedText1,a3    ;Destination
  2156.         lib    Exec,RawDoFmt
  2157.  
  2158.         lea.l    fstrl2,a0        ;HEX->ASCII
  2159.         lea.l    Sent,a1            ;Number2Print
  2160.         lea.l    PutChProc,a2
  2161.         lea.l    SentText1,a3        ;Destination
  2162.         lib    Exec,RawDoFmt
  2163.  
  2164.         lea.l    StatsText1,a0
  2165.         bsr    Printer
  2166.         lea.l    ReceivedText1,a0
  2167.         bsr    Printer
  2168.         lea.l    SentText1,a0
  2169.         bsr    Printer
  2170.         lea.l    CRLFText1,a0
  2171.         bsr    Printer
  2172.         rts
  2173.  
  2174. PrintEntries:    tst.b    DialPrefix
  2175.         beq    PrintEntries1
  2176.         lea.l    PrefixText1,a0
  2177.         bsr    Printer
  2178.         lea.l    DialPrefix,a0
  2179.         bsr    Printer
  2180.         lea.l    CRLFText1,a0
  2181.         bsr    Printer
  2182. PrintEntries1:    tst.b    Entry1
  2183.         beq    PrintEntries2
  2184.         lea.l    EntryText1,a0
  2185.         bsr    Printer
  2186.         lea.l    Entry1,a0
  2187.         bsr    Printer
  2188.         lea.l    CRLFText1,a0
  2189.         bsr    Printer
  2190. PrintEntries2:    tst.b    Entry2
  2191.         beq    PrintEntries3
  2192.         lea.l    EntryText2,a0
  2193.         bsr    Printer
  2194.         lea.l    Entry2,a0
  2195.         bsr    Printer
  2196.         lea.l    CRLFText1,a0
  2197.         bsr    Printer
  2198. PrintEntries3:    tst.b    Entry3
  2199.         beq    PrintEntries4
  2200.         lea.l    EntryText3,a0
  2201.         bsr    Printer
  2202.         lea.l    Entry3,a0
  2203.         bsr    Printer
  2204.         lea.l    CRLFText1,a0
  2205.         bsr    Printer
  2206. PrintEntries4:    tst.b    Entry4
  2207.         beq    PrintEntries5
  2208.         lea.l    EntryText4,a0
  2209.         bsr    Printer
  2210.         lea.l    Entry4,a0
  2211.         bsr    Printer
  2212.         lea.l    CRLFText1,a0
  2213.         bsr    Printer
  2214. PrintEntries5:    tst.b    Entry5
  2215.         beq    PrintEntries6
  2216.         lea.l    EntryText5,a0
  2217.         bsr    Printer
  2218.         lea.l    Entry5,a0
  2219.         bsr    Printer
  2220.         lea.l    CRLFText1,a0
  2221.         bsr    Printer
  2222. PrintEntries6:    tst.b    Entry6
  2223.         beq    PrintEntries7
  2224.         lea.l    EntryText6,a0
  2225.         bsr    Printer
  2226.         lea.l    Entry6,a0
  2227.         bsr    Printer
  2228.         lea.l    CRLFText1,a0
  2229.         bsr    Printer
  2230. PrintEntries7:    tst.b    Entry7
  2231.         beq    PrintEntries8
  2232.         lea.l    EntryText7,a0
  2233.         bsr    Printer
  2234.         lea.l    Entry7,a0
  2235.         bsr    Printer
  2236.         lea.l    CRLFText1,a0
  2237.         bsr    Printer
  2238. PrintEntries8:    tst.b    Entry8
  2239.         beq    PrintEntries9
  2240.         lea.l    EntryText8,a0
  2241.         bsr    Printer
  2242.         lea.l    Entry8,a0
  2243.         bsr    Printer
  2244.         lea.l    CRLFText1,a0
  2245.         bsr    Printer
  2246. PrintEntries9:    tst.b    Entry9
  2247.         beq    PrintEntries10
  2248.         lea.l    EntryText9,a0
  2249.         bsr    Printer
  2250.         lea.l    Entry9,a0
  2251.         bsr    Printer
  2252.         lea.l    CRLFText1,a0
  2253.         bsr    Printer
  2254. PrintEntries10:    tst.b    Entry10
  2255.         beq    PrintEntries11
  2256.         lea.l    EntryText10,a0
  2257.         bsr    Printer
  2258.         lea.l    Entry10,a0
  2259.         bsr    Printer
  2260.         lea.l    CRLFText1,a0
  2261.         bsr    Printer
  2262. PrintEntries11:    rts
  2263.  
  2264. PrintSelect:    lea.l    SelectedText1,a0
  2265.         bsr    Printer
  2266.         lea.l    SelectText1,a0
  2267.         bsr    Printer
  2268.         tst.b    EntrySelected1
  2269.         beq    PrintSelect1
  2270.         lea.l    SelectText11,a0
  2271.         bsr    Printer
  2272.         bra    PrintSelect2
  2273. PrintSelect1:    lea.l    SelectText12,a0
  2274.         bsr    Printer
  2275. PrintSelect2:    lea.l    SelectText2,a0
  2276.         bsr    Printer
  2277.         tst.b    EntrySelected2
  2278.         beq    PrintSelect3
  2279.         lea.l    SelectText11,a0
  2280.         bsr    Printer
  2281.         bra    PrintSelect4
  2282. PrintSelect3:    lea.l    SelectText12,a0
  2283.         bsr    Printer
  2284. PrintSelect4:    lea.l    SelectText3,a0
  2285.         bsr    Printer
  2286.         tst.b    EntrySelected3
  2287.         beq    PrintSelect5
  2288.         lea.l    SelectText11,a0
  2289.         bsr    Printer
  2290.         bra    PrintSelect6
  2291. PrintSelect5:    lea.l    SelectText12,a0
  2292.         bsr    Printer
  2293. PrintSelect6:    lea.l    SelectText4,a0
  2294.         bsr    Printer
  2295.         tst.b    EntrySelected4
  2296.         beq    PrintSelect7
  2297.         lea.l    SelectText11,a0
  2298.         bsr    Printer
  2299.         bra    PrintSelect8
  2300. PrintSelect7:    lea.l    SelectText12,a0
  2301.         bsr    Printer
  2302. PrintSelect8:    lea.l    SelectText5,a0
  2303.         bsr    Printer
  2304.         tst.b    EntrySelected5
  2305.         beq    PrintSelect9
  2306.         lea.l    SelectText11,a0
  2307.         bsr    Printer
  2308.         bra    PrintSelect10
  2309. PrintSelect9:    lea.l    SelectText12,a0
  2310.         bsr    Printer
  2311. PrintSelect10:    lea.l    SelectText6,a0
  2312.         bsr    Printer
  2313.         tst.b    EntrySelected6
  2314.         beq    PrintSelect11
  2315.         lea.l    SelectText11,a0
  2316.         bsr    Printer
  2317.         bra    PrintSelect12
  2318. PrintSelect11:    lea.l    SelectText12,a0
  2319.         bsr    Printer
  2320. PrintSelect12:    lea.l    SelectText7,a0
  2321.         bsr    Printer
  2322.         tst.b    EntrySelected7
  2323.         beq    PrintSelect13
  2324.         lea.l    SelectText11,a0
  2325.         bsr    Printer
  2326.         bra    PrintSelect14
  2327. PrintSelect13:    lea.l    SelectText12,a0
  2328.         bsr    Printer
  2329. PrintSelect14:    lea.l    SelectText8,a0
  2330.         bsr    Printer
  2331.         tst.b    EntrySelected8
  2332.         beq    PrintSelect15
  2333.         lea.l    SelectText11,a0
  2334.         bsr    Printer
  2335.         bra    PrintSelect16
  2336. PrintSelect15:    lea.l    SelectText12,a0
  2337.         bsr    Printer
  2338. PrintSelect16:    lea.l    SelectText9,a0
  2339.         bsr    Printer
  2340.         tst.b    EntrySelected9
  2341.         beq    PrintSelect17
  2342.         lea.l    SelectText11,a0
  2343.         bsr    Printer
  2344.         bra    PrintSelect18
  2345. PrintSelect17:    lea.l    SelectText12,a0
  2346.         bsr    Printer
  2347. PrintSelect18:    lea.l    SelectText0,a0
  2348.         bsr    Printer
  2349.         tst.b    EntrySelected0
  2350.         beq    PrintSelect19
  2351.         lea.l    SelectText13,a0
  2352.         bsr    Printer
  2353.         bra    PrintSelect20
  2354. PrintSelect19:    lea.l    SelectText14,a0
  2355.         bsr    Printer
  2356. PrintSelect20:    lea.l    CRLFText1,a0
  2357.         bsr    Printer
  2358.         rts
  2359.  
  2360. LoadPrefsFile:    move.l    CLArray1,d1
  2361.         move.l    #MODE_OLDFILE,d2
  2362.         lib    Dos,Open
  2363.         move.l    d0,PrefsFile
  2364.         bne    LoadPrefsFile1
  2365.  
  2366.         lea.l    FileErrorText1,a0
  2367.         bsr    Printer
  2368.         move.l    CLArray1,a0
  2369. ;        lea.l    FileNameBuf1,a0
  2370.         bsr    Printer
  2371.         lea.l    CRLFText1,a0
  2372.         bsr    Printer
  2373.         bra    LoadPF_ERR1
  2374.  
  2375. LoadPrefsFile1:    move.l    PrefsFile,d1
  2376.         lea.l    PrefsStart,a0
  2377.         move.l    a0,d2
  2378.         move.l    #4,d3
  2379.         lib    Dos,Read
  2380.         cmp.l    #4,d0
  2381.         beq    LoadPrefsFile2
  2382.  
  2383.         lea.l    FileErrorText2,a0
  2384.         bsr    Printer
  2385.         bra    LoadPF_ERR1
  2386.  
  2387. LoadPrefsFile2: cmp.l    #STFileVersion,PrefsStart
  2388.         beq    LoadPrefsFile3
  2389.  
  2390.         lea.l    FileErrorText3,a0
  2391.         bsr    Printer
  2392.         bra    LoadPF_ERR1
  2393.  
  2394. LoadPrefsFile3:    move.l    PrefsFile,d1
  2395.         lea.l    SerDevNBuffer1,a0
  2396.         move.l    a0,d2
  2397.         move.l    #PrefsSize-4,d3
  2398.         lib    Dos,Read
  2399.         cmp.l    #PrefsSize-4,d0
  2400.         beq    LoadPrefsFile4
  2401.  
  2402.         lea.l    FileErrorText2,a0
  2403.         bsr    Printer
  2404.         bra    LoadPF_ERR2
  2405.  
  2406. LoadPrefsFile4:
  2407. LoadPF_OUT:    bsr    KillPFile
  2408.         move.l    #-1,d0
  2409.         rts
  2410. LoadPF_ERR1:    bsr    KillPFile
  2411.         clr.l    d0
  2412.         rts
  2413. LoadPF_ERR2:    bsr    KillPFile
  2414.         clr.l    d0
  2415.         rts
  2416.  
  2417. SavePrefsFile:    lea.l    FileNameBuf1,a0
  2418.         move.l    a0,d1
  2419.         move.l    #MODE_NEWFILE,d2
  2420.         lib    Dos,Open
  2421.         move.l    d0,PrefsFile
  2422.         bne    SavePrefsFile1
  2423.  
  2424.         lea.l    FileErrorText1,a0
  2425.         bsr    Printer
  2426.         lea.l    FileNameBuf1,a0
  2427.         bsr    Printer
  2428.         lea.l    CRLFText1,a0
  2429.         bsr    Printer
  2430.         bra    SavePF_ERR1
  2431.  
  2432. SavePrefsFile1:    move.l    #STFileVersion,PrefsStart
  2433.  
  2434.         move.l    PrefsFile,d1
  2435.         lea.l    PrefsStart,a0
  2436.         move.l    a0,d2
  2437.         move.l    #PrefsSize,d3
  2438.         lib    Dos,Write
  2439.         cmp.l    #PrefsSize,d0
  2440.         beq    SavePF_OUT
  2441.  
  2442.         lea.l    FileErrorText4,a0
  2443.         bsr    Printer
  2444.         bra    SavePF_ERR2
  2445.  
  2446. SavePF_OUT:    bsr    KillPFile
  2447.         move.l    #-1,d0
  2448.         rts
  2449. SavePF_ERR1:    clr.l    d0
  2450.         rts
  2451. SavePF_ERR2:    bsr    KillPFile
  2452.         clr.l    d0
  2453.         rts
  2454.  
  2455. ;Create MsgPorts & IOReqs for serial.device (or for other device)
  2456.  
  2457. CreateReqs:    tst.w    SerOpen
  2458.         bne    CreateReqs_OUT        ;If open!!
  2459.         lib    Exec,CreateMsgPort
  2460.         move.l    d0,SRRPort
  2461.         beq    NoMsgPort2
  2462.  
  2463. ;Add port to public lists
  2464.  
  2465.         move.l    SRRPort,a1
  2466.         lea.l    RPortText1,a0
  2467.         move.l    a0,LN_NAME(a1)
  2468.         lib    Exec,AddPort
  2469.  
  2470. ;Create write reply port for serial.device (or modem0.device etc.)
  2471.  
  2472.         lib    Exec,CreateMsgPort
  2473.         move.l    d0,SWRPort
  2474.         beq    NoMsgPort2
  2475.  
  2476. ;Add port to public lists
  2477.  
  2478.         move.l    SWRPort,a1
  2479.         lea.l    WPortText1,a0
  2480.         move.l    a0,LN_NAME(a1)
  2481.         lib    Exec,AddPort
  2482.  
  2483. ;Create SetSerParams reply port for serial.device (or modem0.device etc.)
  2484.  
  2485.         lib    Exec,CreateMsgPort
  2486.         move.l    d0,SSRPort
  2487.         beq    NoMsgPort2
  2488.  
  2489. ;Create requester for QUERY
  2490.  
  2491.                 lib     Exec,CreateMsgPort
  2492.                 move.l  d0,SQRPort
  2493.                 beq     NoMsgPort2
  2494.  
  2495. ;Create the requests themselves
  2496.  
  2497.         move.l    #IOEXTSER_SIZE,d0    ;Read IOReq
  2498.         move.l    SRRPort,a0
  2499.         clr.b    LN_TYPE(a0)        ;Make sure CheckIO doesn't hang
  2500.         lib    Exec,CreateIORequest
  2501.         move.l    d0,IORRequest
  2502.         beq    NoIOReq
  2503.  
  2504.         move.l    #IOEXTSER_SIZE,d0    ;Write IOReq
  2505.         move.l    SWRPort,a0
  2506.         clr.b    LN_TYPE(a0)        ;Make sure CheckIO doesn't hang
  2507.         lib    Exec,CreateIORequest
  2508.         move.l    d0,IOWRequest
  2509.         beq    NoIOReq
  2510.  
  2511.         move.l    #IOEXTSER_SIZE,d0    ;SetParams IOReq
  2512.         move.l    SSRPort,a0
  2513.         clr.b    LN_TYPE(a0)        ;Make sure CheckIO doesn't hang
  2514.         lib    Exec,CreateIORequest
  2515.         move.l    d0,IOSRequest
  2516.         beq    NoIOReq
  2517.  
  2518.                 move.l  #IOEXTSER_SIZE,d0       ;QUERY IOReq
  2519.                 move.l  SQRPort,a0
  2520.         clr.b    LN_TYPE(a0)        ;Make sure CheckIO doesn't hang
  2521.                 lib     Exec,CreateIORequest
  2522.                 move.l  d0,IOQRequest
  2523.                 beq     NoIOReq
  2524.  
  2525.         move.l    #1,d0            ;No error
  2526.         rts
  2527. CreateReqs_OUT:    clr.l    d0            ;Error
  2528.         rts
  2529.  
  2530. DeleteReqs:    move.l    IORRequest,a0
  2531.         lib    Exec,DeleteIORequest        ;Delete RReq
  2532.         clr.l    IORRequest
  2533.  
  2534.         move.l    IOWRequest,a0
  2535.                 lib     Exec,DeleteIORequest            ;Delete WRReq
  2536.         clr.l    IOWRequest
  2537.  
  2538.         move.l    IOSRequest,a0
  2539.                 lib     Exec,DeleteIORequest            ;Delete SRReq
  2540.         clr.l    IOSRequest
  2541.  
  2542.                 move.l  IOQRequest,a0
  2543.                 lib     Exec,DeleteIORequest            ;Delete QRReq
  2544.                 clr.l   IOQRequest
  2545.  
  2546.         move.l    SRRPort,a1            ;Remove possible
  2547.         cmp.l    #$00,a1                ;ports from lists
  2548.         beq    DeleteReqs2            ;and then delete
  2549.         lib    Exec,RemPort            ;the ports
  2550.  
  2551.         move.l    SRRPort,a0
  2552.         lib    Exec,DeleteMsgPort
  2553.         clr.l    SRRPort
  2554.  
  2555. DeleteReqs2:    move.l    SWRPort,a1
  2556.         cmp.l    #$00,a1
  2557.         beq    DeleteReqs3
  2558.         lib    Exec,RemPort
  2559.  
  2560.         move.l    SWRPort,a0
  2561.         lib    Exec,DeleteMsgPort
  2562.         clr.l    SWRPort
  2563.  
  2564.         move.l    SSRPort,a0
  2565.         lib    Exec,DeleteMsgPort
  2566.         clr.l    SSRPort
  2567.  
  2568.                 move.l  SQRPort,a0
  2569.                 lib     Exec,DeleteMsgPort
  2570.                 clr.l   SQRPort
  2571.  
  2572. DeleteReqs3:    rts
  2573.  
  2574. KillPFile:    move.l    PrefsFile,d1
  2575.         beq    KillPFile1
  2576.         lib    Dos,Close
  2577.         clr.l    PrefsFile
  2578. KillPFile1:    rts
  2579.  
  2580. ShutDown:    bsr    CloseSerial
  2581.  
  2582. ShutDown9000:
  2583.  
  2584. ShutDown8900:    bsr    DeleteReqs
  2585.  
  2586. ShutDown8800:
  2587.         move.l    _stdin,d1
  2588.         beq    ShutDown8700
  2589.         move.l    #FALSE,d2
  2590.         lib    Dos,SetMode
  2591.  
  2592. ShutDown8700:    move.l    OptPort,a1
  2593.         cmp.l    #$00,a1
  2594.         beq    ShutDown8600
  2595.         lib    Exec,RemPort
  2596.  
  2597. ShutDown8600:    move.l    OptPort,a0
  2598.         lib    Exec,DeleteMsgPort
  2599.  
  2600. ShutDown8000:    bsr    KillPFile
  2601.  
  2602.         move.l    CaptureFile,d1
  2603.         beq    ShutDown7000
  2604.         lib    Dos,Close
  2605. ShutDown7000:    move.l    RDArgs1,d1
  2606.         beq    ShutDown6900
  2607.         lib    Dos,FreeArgs
  2608. ShutDown6900:
  2609.  
  2610. ShutDown1000:    closlib    Dos
  2611.         pull    d2-d7/a2-a6
  2612.         clr.l    d0
  2613.         rts
  2614.  
  2615. ;open serial.device
  2616.  
  2617. OpenSerial:    bsr    DeleteReqs
  2618.         bsr    CreateReqs
  2619.         tst.w    SerOpen
  2620.         bne    OpenSerial_OUT
  2621.         lea.l    SerDevNBuffer1,a0
  2622.         move.l    SerUnit,d0
  2623.         move.l    IORRequest,a1
  2624.         or.b    #SERF_SHARED,IO_SERFLAGS(a1)    ;used to be move
  2625.         or.b    #SERF_7WIRE,IO_SERFLAGS(a1)
  2626.         tst.b    CTSRTS
  2627.         beq    OpenSerial2
  2628.         or.b    #SERF_7WIRE,IO_SERFLAGS(a1)
  2629. OpenSerial2:    clr.l    d1                ;no flags
  2630.         lib    Exec,OpenDevice
  2631.         tst.l    d0
  2632.         bne    NoSerial
  2633.         move.w    #$1,SerOpen        ;just to tell if open
  2634.  
  2635. ;Copy info from one req to the other
  2636.  
  2637.         move.l    IORRequest,a0
  2638.  
  2639.         move.l    IOWRequest,a1            ;for Write request
  2640.         move.l    IO_DEVICE(a0),IO_DEVICE(a1)
  2641.         move.l    IO_UNIT(a0),IO_UNIT(a1)
  2642.  
  2643.         add.l    #48,a0            ;get start of ioser
  2644.         add.l    #48,a1
  2645.         move.l    #34,d0
  2646.         lib    Exec,CopyMem
  2647.  
  2648.         move.l    IORRequest,a0
  2649.         move.l    IOSRequest,a1            ;for SetParams request
  2650.         move.l    IO_DEVICE(a0),IO_DEVICE(a1)
  2651.         move.l    IO_UNIT(a0),IO_UNIT(a1)
  2652.  
  2653.         add.l    #48,a0            ;get start of ioser
  2654.         add.l    #48,a1
  2655.         move.l    #34,d0
  2656.         lib    Exec,CopyMem
  2657.  
  2658.                 move.l  IORRequest,a0
  2659.                 move.l  IOQRequest,a1                   ;for QUERY request
  2660.                 move.l  IO_DEVICE(a0),IO_DEVICE(a1)
  2661.                 move.l  IO_UNIT(a0),IO_UNIT(a1)
  2662.  
  2663. ;        add.l   #48,a0                  ;get start of ioser
  2664. ;        add.l   #48,a1
  2665. ;        move.l  #34,d0
  2666. ;        lib     Exec,CopyMem
  2667.  
  2668.                 move.l  IORRequest,a1
  2669.         move.w    #CMD_READ,IO_COMMAND(a1)
  2670.         or.b    #IOF_QUICK,IO_FLAGS(a1)
  2671.         lea.l    Buffer3,a0
  2672.         move.l    a0,IO_DATA(a1)
  2673.         move.l    #1,IO_LENGTH(a1)
  2674.  
  2675.         move.l    #BUFLEN,d0    ;just so the request is used
  2676.         move.l    #0,d1        ;TRY: #1
  2677.         bsr    Read
  2678.  
  2679.         clr.l    d0
  2680.         rts
  2681. OpenSerial_OUT:    move.l    #-1,d0
  2682.         rts
  2683.  
  2684. CloseSerial:    tst.w    SerOpen
  2685.         beq    CloseSerial1
  2686.         bsr    ClearSer
  2687.         move.l    IORRequest,a1
  2688.         lib    Exec,CloseDevice
  2689.  
  2690.         bsr    DeleteReqs
  2691.  
  2692.         clr.w    SerOpen
  2693. CloseSerial1:    rts
  2694.  
  2695. ;Get length of text in given address
  2696. ;
  2697. ;Input a1 = Address of null terminated text string
  2698. ;
  2699. ;Result d0 = Length
  2700.  
  2701. GetLength:    clr.l    d0
  2702.         cmp.l    #$00,a1        ;fixes enforcer hit
  2703.         beq    GetLength_OUT
  2704. GetLength2:    add.l    #1,d0
  2705.         tst.b    (a1)+
  2706.         bne    GetLength2
  2707.         sub.l    #1,d0        ;don't include NULL
  2708. GetLength_OUT:    rts
  2709.  
  2710.  
  2711. ;Get line length of text in given address, including LF
  2712. ;
  2713. ;Input a0 = Address of LF terminated text string
  2714. ;
  2715. ;Result d1 = Length
  2716.  
  2717. GetLLength:    push    a0
  2718.         clr.l    d1
  2719.         cmp.l    #$00,a0        ;fixes enforcer hit
  2720.         beq    GetLLength_OUT
  2721. GetLLength2:    add.l    #1,d1
  2722.         cmp.b    #10,(a0)+
  2723.         bne    GetLLength2
  2724. GetLLength_OUT:    pull    a0
  2725.         rts
  2726.  
  2727. ;Finds a string in another string
  2728. ;
  2729. ;Inputs    a0 = Pointer to string1 (from what to find)
  2730. ;    d0 = Lower byte ('C' out of 'CO') (what to search for)
  2731. ;    d1 = Higher byte ('O' out of 'CO')
  2732. ;
  2733. ;Result    d0 = 0 if not found
  2734. ;
  2735. ;BUGS
  2736.  
  2737. FindWord:    tst.b    (a0)
  2738.         beq    FindWord1
  2739.         cmp.b    (a0),d0
  2740.         beq    FindWord2
  2741.         add.l    #1,a0
  2742.         bra    FindWord
  2743. FindWord1:    clr.l    d0        ;keep right before rts
  2744.         rts
  2745. FindWord2:    add.l    #1,a0
  2746.         tst.b    (a0)
  2747.         beq    FindWord1
  2748.         cmp.b    (a0),d1
  2749.         bne    FindWord2
  2750.         move.l    #-1,d0        ;keep right before rts
  2751.         rts
  2752.  
  2753. ;Input a0 = Address of text string
  2754. ;
  2755. ;Result d0 = Length
  2756.  
  2757. ConvASCII:    clr.l    d0
  2758.         clr.l    d1
  2759.         cmp.b    #' ',(a0)
  2760.         bne    ConvASCII2
  2761.         add.l    #1,a0
  2762. ConvASCII2:    move.b    (a0),d1
  2763.         cmp.b    #'0',d1
  2764.         bcs    ConvASCII_OUT
  2765.         cmp.b    #'9',d1
  2766.         bhi    ConvASCII_OUT
  2767.         sub.b    #'0',d1
  2768.         push    d1/a0
  2769.         move.l    #10,d1
  2770.         lib    Utility,UMult32
  2771.         pull    d1/a0
  2772.         add.l    d1,d0
  2773.         add.l    #1,a0
  2774.         bra    ConvASCII2
  2775. ConvASCII_OUT:    rts
  2776.  
  2777. MakeCmdString:    lea.l    FileNameBuf3,a0
  2778.         lea.l    ULProgram,a4
  2779.         move.l    a4,a5
  2780.         add.l    #128,a5
  2781.         bsr    MCS1
  2782.  
  2783.         move.b    #' ',(a0)+
  2784.  
  2785.         lea.l    FileNameBuf2,a4
  2786.         move.l    a4,a5
  2787.         add.l    #128,a5
  2788.         bsr    MCS1
  2789.  
  2790. ;        lea.l    FileNameBuf3,a0        ;DEBUG
  2791. ;        bsr    Printer            ;DEBUG
  2792.         rts
  2793.  
  2794. MCS1:        move.b    (a4)+,(a0)+
  2795.         tst.b    (a4)
  2796.         beq    MCS2
  2797.         cmp.l    a4,a5
  2798.         bne    MCS1
  2799. MCS2:        rts
  2800.  
  2801. ;Error etc. messages
  2802.  
  2803. NoRDArgs:    lib    Dos,IoErr
  2804.         move.l    d0,d1
  2805.         clr.l    d2
  2806.         lib    Dos,PrintFault
  2807.         bra    ShutDown
  2808.  
  2809. NoUtility:    lea.l    NoUtiText1,a0
  2810.         bsr    Printer
  2811.         bra    ShutDown
  2812.  
  2813. NoDos:        add.l    #8,sp
  2814.         pull    d2-d7/a2-a6
  2815.         move.l    #RETURN_FAIL,d0
  2816.         rts
  2817.  
  2818. NotInteractive:    add.l    #8,sp
  2819.         lea.l    NotIntText1,a0
  2820.         bsr    Printer
  2821.         bra    ShutDown
  2822.  
  2823. NoMsgPort:    lea.l    NoMsgPortText1,a0
  2824.         bsr    Printer
  2825.         bra    ShutDown
  2826.  
  2827. NoMsgPort2:    lea.l    NoMsgPortText1,a0
  2828.         bsr    Printer
  2829.         clr.l    d0
  2830.         rts
  2831.  
  2832. NoIOReq:    lea.l    NoIOReqText1,a0        ;WARNING: DIFFERENT!
  2833.         bsr    Printer
  2834.         clr.l    d0
  2835.         rts
  2836.  
  2837. NoSerial:    lea.l    NoSerialText1,a0
  2838.         bsr    Printer
  2839.         lea.l    SerDevNBuffer1,a0
  2840.         bsr    Printer
  2841.         lea.l    NoSerialText2,a0
  2842.         bsr    Printer
  2843.         move.l    IORRequest,a1
  2844.         move.b    IO_ERROR(a1),d0
  2845.         move.b    d0,ErrorNum+1
  2846.         bsr    PrintErrorNum
  2847.         lea.l    CRLFText1,a0
  2848.         bsr    Printer
  2849.         move.l    #-1,d0
  2850.         rts
  2851.  
  2852. ParamsNotSet:    lea.l    SerSetText1,a0
  2853.         bsr    Printer
  2854.         rts
  2855.  
  2856. Printer:    printa    a0,_stdout
  2857.         rts
  2858.  
  2859. PrintErrorNum:    clr.l    ErrorNumText2
  2860.         clr.w    ErrorNumText2+4
  2861.         lea.l    fstrl5,a0        ;HEX->ASCII
  2862.         lea.l    ErrorNum,a1        ;Number2Print
  2863.         lea.l    PutChProc,a2
  2864.         lea.l    ErrorNumText2,a3        ;Destination
  2865.         lib    Exec,RawDoFmt
  2866.  
  2867.         lea.l    ErrorNumText,a0
  2868.         bsr    Printer
  2869.         lea.l    ErrorNumText2,a0
  2870.         bsr    Printer
  2871.         rts
  2872.  
  2873. PutChProc:    tst.b    d0
  2874.         beq    PutChProc_OUT
  2875.         move.b    d0,(a3)+
  2876. PutChProc_OUT:    rts
  2877.  
  2878. ;Structures
  2879.  
  2880. ;lib stuff
  2881.  
  2882.         libnames
  2883.  
  2884. ;Other stuff, part I
  2885.  
  2886. SRRPort:    dc.l    0
  2887. IORRequest:    dc.l    0
  2888. SWRPort:    dc.l    0
  2889. IOWRequest:    dc.l    0
  2890. SSRPort:    dc.l    0
  2891. IOSRequest:    dc.l    0
  2892. SQRPort:    dc.l    0
  2893. IOQRequest:    dc.l    0
  2894. OptPort:    dc.l    0
  2895. _stdout:    dc.l    0
  2896. _stdin:        dc.l    0
  2897. Sent:        dc.l    0            ;Count sent chars
  2898. Received:    dc.l    0            ;Count reveived chars
  2899. PrefsFile:    dc.l    0
  2900. RDArgs1:    dc.l    0
  2901. CLArray1:    dc.l    FileNameBuf1        ;Pointer to filename
  2902. OptPortName:    dc.l    0            ;Pointer to optional portname
  2903.  
  2904. ;Other stuff part II
  2905.  
  2906. OldLock:    dc.l    0        ;dir we started from
  2907. ULLock:        dc.l    0        ;uload dir
  2908. DLLock:        dc.l    0        ;dload dir
  2909. CaptureFile:    dc.l    0        ;Capture everything here..
  2910.  
  2911. EntrySelected1:    dc.b    0
  2912. EntrySelected2:    dc.b    0
  2913. EntrySelected3:    dc.b    0
  2914. EntrySelected4:    dc.b    0
  2915. EntrySelected5:    dc.b    0
  2916. EntrySelected6:    dc.b    0
  2917. EntrySelected7:    dc.b    0
  2918. EntrySelected8:    dc.b    0
  2919. EntrySelected9:    dc.b    0
  2920. EntrySelected0:    dc.b    0
  2921. ModifyMode:    dc.w    0    ;0=No, 1=Yes
  2922. CPAssignText:    dc.w    0
  2923.  
  2924. ;Serial device stuff
  2925.  
  2926. SerOpen:    dc.w    0
  2927. ErrorNum:    dc.w    0
  2928.  
  2929. ;Strings, error
  2930.  
  2931. BreakText1:    dc.b    "***Break",13,10,0
  2932. NotIntText1:    dc.b    "ERROR: Please don't redirect input!",13,10,0
  2933. NoUtiText1:    dc.b    "ERROR: Couldn't open utility.library!",13,10,0
  2934. NoMsgPortText1:    dc.b    "ERROR: Couldn't get message port!",13,10,0
  2935. NoIOReqText1:    dc.b    "ERROR: Couldn't get SerialIOReq!",13,10,0
  2936. NoSerialText1:    dc.b    "ERROR: Device '",0
  2937. NoSerialText2:    dc.b    "' not open!",13,10,0
  2938. FileErrorText1:    dc.b    13,10,"ERROR: Couldn't open file: ",0
  2939. FileErrorText2:    dc.b    "ERROR: Couldn't read file!",13,10,0
  2940. FileErrorText3:    dc.b    "ERROR: Incorrect filetype!",13,10,0
  2941. FileErrorText4:    dc.b    "ERROR: Couldn't write to file!",13,10,0
  2942. NoULDLProgText1: dc.b    13,10,"ERROR: No transfer program specified!",13,10,0
  2943. NoULDirText1:    dc.b    13,10,"ERROR: Couldn't access upload directory!",13,10,0
  2944. NoDLDirText1:    dc.b    13,10,"ERROR: Couldn't access download directory!",13,10,0
  2945. CaptureErrorText1:    dc.b    13,10,"ERROR: Couldn't open capture!",13,10,0
  2946. CaptureErrorText2:    dc.b    13,10,"ERROR: Capture already open!",13,10,0
  2947. ErrorNumText:    dc.b    "Error number: ",0
  2948. fstrl5:        dc.b    "%d"
  2949.         ds.w    0
  2950. ErrorNumText2:    dc.b    0,0,0,0,0,0
  2951.  
  2952. ;Strings
  2953.  
  2954. StartText1:    dc.b    "Welcome to ShellTerm. Use CTRL-P to get menu.",13,10,0
  2955.         ds.l    0
  2956. RPortText1:    dc.b    "ShellTerm_RPort",0
  2957. WPortText1:    dc.b    "ShellTerm_WPort",0
  2958.  
  2959. ;Main menu
  2960.  
  2961. MenuText1:    dc.b    13,10,"ShellTerm menu. Please choose item:",13,10
  2962.         dc.b    13,10,"(S) Statistics      (C) Clear statistics"
  2963.         dc.b    13,10,"(B) Send BREAK      (O) Send CTRL-P"
  2964.         dc.b    13,10,"(F) Reset font      (X) Clear screen"
  2965.         dc.b    13,10,"(R) Reset modem     (H) Hangup line"
  2966.         dc.b    13,10,"(+) Upload          (-) Download"
  2967.         dc.b    13,10,"(D) Dialer          (P) Preferences"
  2968.         dc.b    13,10,"(L) Open capture    (K) Close capture"
  2969.         dc.b    13,10,"(M) Execute command (?) Information",13,10
  2970.         dc.b    13,10,"(Q) Quit ShellTerm  (E) Exit menus",13,10
  2971.         dc.b    13,10,"Selection: ",0
  2972. ExecuteText1:    dc.b    "Execute",13,10
  2973.         dc.b    "Command to execute: ",0
  2974. InfoText1:    dc.b    "Information",13,10,0
  2975. BreakText2:    dc.b    "Break sent",13,10,0
  2976. CTRL_PText1:    dc.b    "CTRL-P sent",13,10,0
  2977. ExitText1:    dc.b    "Exit",13,10,0
  2978. TerminalText1:    dc.b    13,10,"Terminal mode active:",13,10,0
  2979. ResetFText1:    dc.b    "Reset font",13,10,0
  2980. QuitText1:    dc.b    "Quit",13,10,0
  2981. StatsText1:    dc.b    "Statistics:",13,10,0
  2982. StatsText2:    dc.b    "Statistics",13,10,13,10,0
  2983. DialerText1:    dc.b    "Dialer",13,10,0
  2984. PrefsText1:    dc.b    "Preferences",13,10,0
  2985. ULText1:    dc.b    "Upload program (SZ)",13,10
  2986.         dc.b    "Program name: ",0
  2987. ULText2:    dc.b    "Upload file",13,10
  2988.         dc.b    "File to upload: ",0
  2989. ULText3:    dc.b    "Uploading file, please wait...",13,10,0
  2990. ULText5:    dc.b    "Upload dir",13,10
  2991.         dc.b    "Directory: ",0
  2992. DLText1:    dc.b    "Download program (RZ)",13,10
  2993.         dc.b    "Program name: ",0
  2994. DLText2:    dc.b    "Downloading file, please wait...",13,10,0
  2995. DLText5:    dc.b    "Download dir",13,10
  2996.         dc.b    "Directory: ",0
  2997. OpenCaptureText1: dc.b    "Open capture",13,10
  2998.         dc.b    "Name of file: ",0
  2999. CloseCaptureText1: dc.b    "Close capture",13,10,0
  3000.  
  3001. ReceivedText1:    dc.b    "                            ",00,00,0    ;max of 4294967295
  3002. ;            "   4294967295 bytes received",CR,LF
  3003. SentText1:    dc.b    "                        ",00,00,0    ;max of 4294967295
  3004. ;            "   4294967295 bytes sent",CR,LF
  3005. fstrl1:        dc.b    "   %10.ld bytes received",13,10,0
  3006. fstrl2:        dc.b    "   %10.ld bytes sent",0
  3007. ClearText1:    dc.b    "Cleared",13,10,0
  3008. ClearText3:    dc.b    "Reset",13,10,0
  3009. CRLFText1:    dc.b    CR,LF,0
  3010. ResetText1:    dc.b    "Reset",13,10,0
  3011. ResetText2:    dc.b    "ATZ",13,10,0
  3012. HangUpText1:    dc.b    "Hangup",13,10,0
  3013. HangUpText2:    dc.b    "+++",0
  3014. HangUpText3:    dc.b    "ATH0",13,10,0
  3015. PlainText1:    dc.b    $9b,$30,$6d,$1b,$63
  3016. ClearSText1:    dc.b    $1B,$5B,$30,$3B,$30,$48,$1B,$5B,$4A,0
  3017.  
  3018. ;Preferences
  3019.  
  3020. PrefsText2:    dc.b    13,10,"ShellTerm preferences:",13,10
  3021.         dc.b    13,10,"(S)erial settings  (T)erminal settings"
  3022.         dc.b    13,10,"(R)eset settings   (V)iew settings"
  3023.         dc.b    13,10,"(L)oad prefs       (W)rite prefs"
  3024.         dc.b    13,10,"(N)ame prefsfile   (A)ssign CTRL-P"
  3025.         dc.b    13,10,"(+) Upload program (-) Download program"
  3026.         dc.b    13,10,"(U)pload dir       (D)ownload dir",13,10
  3027.         dc.b    13,10,"(M)ain menu        (E)xit menus",13,10
  3028.         dc.b    13,10,"Selection: ",0
  3029. ViewText1:    dc.b    "View settings",13,10,0
  3030. SpeedText11:    dc.b    "Serial settings",13,10,0
  3031. SpeedText13:    dc.b    "Speed",13,10,0
  3032. STerminalText1:    dc.b    "Terminal settings",13,10,0
  3033. LoadText1:    dc.b    "Load prefs",13,10,0
  3034. SaveText1:    dc.b    "Write prefs",13,10,0
  3035. AssignText1:    dc.b    "Assign CTRL-P",13,10,0
  3036. AssignText2:    dc.b    13,10,"Press key to assign CTRL-P to: ",0
  3037. EnterNText1:    dc.b    "Enter name",13,10,0
  3038. EnterNText2:    dc.b    13,10,"File name: ",0
  3039. DBitsText1:    dc.b    "Using 7 databits",13,10,0
  3040. DBitsText2:    dc.b    "Using 8 databits",13,10,0
  3041. DBitsText3:    dc.b    13,10,"ERROR: Couldn't set databits!",13,10,0
  3042. SBitsText1:    dc.b    "Using 1 stopbit",13,10,0
  3043. SBitsText2:    dc.b    "Using 2 stopbits",13,10,0
  3044. SBitsText3:    dc.b    13,10,"ERROR: Couldn't set stopbits!",13,10,0
  3045. XXText1:    dc.b    "XON/XOFF is on",13,10,0
  3046. XXText2:    dc.b    "XON/XOFF is off",13,10,0
  3047. XXText3:    dc.b    13,10,"ERROR: Couldn't set XON/XOFF!",13,10,0
  3048. CTSRTSText1:    dc.b    "CTS/RTS handshaking is on",13,10,0
  3049. CTSRTSText2:    dc.b    "CTS/RTS handshaking is off",13,10,0
  3050. CTSRTSText3:    dc.b    13,10,"ERROR: Couldn't set CTS/RTS!",13,10,0
  3051. CRTransText2:    dc.b    13,10,"(N)one, (S)trip, (A)dd LF: ",0
  3052. LFTransText2:    dc.b    13,10,"(N)one, (S)trip, (A)dd CR: ",0
  3053. AnyKeyText1:    dc.b    13,10,"Please press any key: ",0
  3054. NoneText1:    dc.b    "None",13,10,0
  3055. StripText1:    dc.b    "Strip",13,10,0
  3056. AddText1:    dc.b    "Add",13,10,0
  3057.  
  3058. STerminalText2:    dc.b    13,10,"Terminal settings:",13,10
  3059.         dc.b    13,10,"OUT: (1) CR translate   (2) LF translate"
  3060.         dc.b    13,10,"IN:  (3) CR translate   (4) LF translate"
  3061.         dc.b    13,10,"     (L)ocal echo       (S)wap DEL & BS"
  3062.         dc.b    13,10,"     (A)nsi codes       (C)ursor remap",13,10
  3063.         dc.b    13,10,"(M)ain menu   (-) Previous menu   (E)xit menus",13,10
  3064.         dc.b    13,10,"Selection: ",0
  3065. CRTransText1:    dc.b    "CR translate (OUT)",13,10,0
  3066. LFTransText1:    dc.b    "LF translate (OUT)",13,10,0
  3067. CRTransText3:    dc.b    "CR translate (IN)",13,10,0
  3068. LFTransText3:    dc.b    "LF translate (IN)",13,10,0
  3069. EchoText1:    dc.b    "Local echo enabled",13,10,0
  3070. EchoText2:    dc.b    "Local echo disabled",13,10,0
  3071. SwapText1:    dc.b    "BS & DEL swapping enabled",13,10,0
  3072. SwapText2:    dc.b    "BS & DEL swapping disabled",13,10,0
  3073. ANSIText1:    dc.b    "ANSI mode on",13,10,0
  3074. ANSIText2:    dc.b    "ANSI mode off",13,10,0
  3075. CRemapText1:    dc.b    "Cursor remap on",13,10,0
  3076. CRemapText2:    dc.b    "Cursor remap off",13,10,0
  3077.  
  3078. CurrentText1:    dc.b    13,10,"Current settings: Speed (",0
  3079. CurrentText2:    dc.b    "), Local echo (",0
  3080. CurrentText3:    dc.b    "                  CR xlate out (",0
  3081. CurrentText4:    dc.b    "), LF xlate out (",0
  3082. CurrentText5:    dc.b    "                  CR xlate in (",0
  3083. CurrentText6:    dc.b    "), LR xlate in (",0
  3084. CurrentText7:    dc.b    ")",13,10,0
  3085. CurrentText8:    dc.b    "                  Databits (",0
  3086. CurrentText9:    dc.b    "), Stopbits (",0
  3087. CurrentText9.01: dc.b    "                  XON/XOFF (",0
  3088. CurrentText9.02: dc.b    "), CTS/RTS (",0
  3089. CurrentText9.1:    dc.b    "                  Swap BS & DEL (",0
  3090. CurrentText9.11: dc.b    "), ANSI mode (",0
  3091. CurrentText9.12: dc.b    "                  Remap cursor keys (",0
  3092. CurrentText9.2:    dc.b    13,10,"CTRL-P assigned to ASCII: ",0
  3093. CurrentText9.3:    dc.b    13,10,"Upload program  : ",0
  3094. CurrentText9.4:    dc.b    13,10,"Download program: ",0
  3095. CurrentText9.5:    dc.b    13,10,"Upload dir      : ",0
  3096. CurrentText9.6:    dc.b    13,10,"Download dir    : ",0
  3097. CurrentText10:    dc.b    13,10,"Device name: ",0
  3098. CurrentText11:    dc.b    13,10,"Unit number: ",0
  3099. CurrentText12:    dcb.b    14,0
  3100. CurrentText13:    dc.b    13,10,"Prefs file : ",0
  3101. NAText1:    dc.b    "N/A",0
  3102. DefText1:    dc.b    "Default",0
  3103. StarText1:    dc.b    "*",0
  3104. SpaceText1:    dc.b    " ",0
  3105. NText1:        dc.b    "N",0
  3106. SText1:        dc.b    "S",0
  3107. AText1:        dc.b    "A",0
  3108. OneText1:    dc.b    "1",0
  3109. TwoText1:    dc.b    "2",0
  3110. SevenText1:    dc.b    "7",0
  3111. EightText1:    dc.b    "8",0
  3112. fstrl4:        dc.b    "%d",0
  3113.  
  3114. ;Speed prefs
  3115.  
  3116. SpeedText1:    dc.b    13,10,"Serial settings:",13,10
  3117.         dc.b    13,10,"(1) 110 bps     (2) 300 bps"
  3118.         dc.b    13,10,"(3) 1200 bps    (4) 2400 bps"
  3119.         dc.b    13,10,"(5) 4800 bps    (6) 9600 bps"
  3120.         dc.b    13,10,"(7) 19 200 bps  (8) 38 400 bps"
  3121.         dc.b    13,10,"(9) 57 600 bps  (0) 115 200 bps"
  3122.         dc.b    13,10,"(N)ame & Unit   (R)e-open"
  3123.         dc.b    13,10,"(D)atabits      (S)topbits"
  3124.         dc.b    13,10,"(X)ON/XOFF      (C)TS/RTS",13,10
  3125.         dc.b    13,10,"(M)ain menu   (-) Previous menu   (E)xit menus",13,10
  3126.         dc.b    13,10,"Selection: ",0
  3127. SpeedText12:    dc.b    13,10,"ERROR: Couldn't set that speed. Please reselect!",13,10,0
  3128. SerSetText1:    dc.b    13,10,"ERROR: Couldn't set serial parameters!",13,10,0
  3129. fstrl3:        dc.b    "%ld",0
  3130.         ds.w    0
  3131. CTRLPASCII:    dc.b    0,0,0,0,0,0,0,0
  3132. SpeedText90:    dc.b    0,0,0,0,0,0,0,0,0,0,0,0
  3133. NameText1:    dc.b    "Set device unit & name",13,10,0
  3134. NameText2:    dc.b    13,10,"Device name: ",0
  3135. NameText3:    dc.b    13,10,"Unit number: ",0
  3136. ReOpenText1:    dc.b    "Re-open device",13,10,0
  3137.  
  3138. ;Dialer stuff
  3139.  
  3140. DialerText2:    dc.b    13,10,"Auto-dialer (phonebook)",13,10
  3141.         dc.b    13,10,"Entries:",13,10,13,10,0
  3142. PrefixText1:    dc.b    "Prefix: ",0
  3143. EntryText1:    dc.b    "1) ",0
  3144. EntryText2:    dc.b    "2) ",0
  3145. EntryText3:    dc.b    "3) ",0
  3146. EntryText4:    dc.b    "4) ",0
  3147. EntryText5:    dc.b    "5) ",0
  3148. EntryText6:    dc.b    "6) ",0
  3149. EntryText7:    dc.b    "7) ",0
  3150. EntryText8:    dc.b    "8) ",0
  3151. EntryText9:    dc.b    "9) ",0
  3152. EntryText10:    dc.b    "0) ",0
  3153. DialerText3:    dc.b    13,10,"(0-9) Un/select entry  (R)elist numbers"
  3154.         dc.b    13,10,"  (S)ingle dial        (D)ial list"
  3155.         dc.b    13,10,"  (C)lear list         (A)ll"
  3156.         dc.b    13,10,"Ed(I)t mode            (P)refix",13,10
  3157.         dc.b    13,10,"  (M)ain menu          (E)xit menus",13,10
  3158. SelectionText1:    dc.b    13,10,"Selection: ",0
  3159. DialText1:    dc.b    "Dial list",13,10,0
  3160. MainMenuText1:    dc.b    "Main menu",13,10,0
  3161. SingleText1:    dc.b    "Dial number",13,10,0
  3162. SingleText2:    dc.b    "Number to dial: ",0
  3163. RelistText1:    dc.b    "Relist",13,10,13,10,0
  3164. EntryTextXIV:    dc.b    "Entry",13,10,0
  3165. ClearText2:    dc.b    "Clear",13,10,0
  3166. AllText1:    dc.b    "All",13,10,0
  3167. HelpText1:    dc.b    "Help",13,10,0
  3168. ModifyText1:    dc.b    "Edit mode on",13,10,0
  3169. ModifyText2:    dc.b    "Edit mode off",13,10,0
  3170. EditEntryText1:    dc.b    "Edit entry",13,10,0
  3171. EditEntryText2:    dc.b    13,10,"Enter number: ",0
  3172. EditEntryText3:    dc.b    "Edit prefix",13,10,0
  3173. EditEntryText4:    dc.b    13,10,"Enter prefix: ",0
  3174. DialingText1:    dc.b    13,10,"Dialing: ",0
  3175. DialText2:    dc.b    13,10,"[Space] to skip, [Backspace] to remove this entry, [Escape] to quit",13,10,0
  3176. ConnectText1:    dc.b    "Connection established",13,10,0
  3177. BusyText1:    dc.b    "Busy",13,10,0
  3178. SkippedText1:    dc.b    "Skipping entry",13,10,0
  3179. CancelledText1:    dc.b    "Quitting",13,10,0
  3180. RemoveText1:    dc.b    "Removing this entry",13,10,0
  3181. EmptyText1:    dc.b    13,10,"List is empty",13,10,0
  3182. SelectedText1:    dc.b    13,10,"Entries selected:",13,10,0
  3183. SelectText1:    dc.b    "1 (",0
  3184. SelectText2:    dc.b    "2 (",0
  3185. SelectText3:    dc.b    "3 (",0
  3186. SelectText4:    dc.b    "4 (",0
  3187. SelectText5:    dc.b    "5 (",0
  3188. SelectText6:    dc.b    "6 (",0
  3189. SelectText7:    dc.b    "7 (",0
  3190. SelectText8:    dc.b    "8 (",0
  3191. SelectText9:    dc.b    "9 (",0
  3192. SelectText0:    dc.b    "0 (",0
  3193. SelectText11:    dc.b    "*) ",0
  3194. SelectText12:    dc.b    " ) ",0
  3195. SelectText13:    dc.b    "*)",0
  3196. SelectText14:    dc.b    " )",0
  3197.  
  3198. ;Strings, names
  3199.  
  3200. CLTemplate1:    dc.b    "FROM,PORT/K",0
  3201. STVersion:    dc.b    "$VER: ShellTerm "
  3202.         PROGVERSION
  3203.         dc.b    " (C)opyright Tomi Blinnikka 1993",0
  3204. AuthorText1:    dc.b    13,10,"Name          : ShellTerm",13,10
  3205.         dc.b    "Version       : "
  3206.         PROGVERSION
  3207.         dc.b    13,10
  3208.         dc.b    "Author        : Tomi Blinnikka",13,10
  3209.         dc.b    "NOTICE        : UNREGISTERED VERSION",13,10
  3210. ;        dc.b    "Registered to : ",13,10
  3211.         dc.b    13,10,"(C)opyright Tomi Blinnikka 1993",13,10,0
  3212.         ds.l    0
  3213.  
  3214. ;Buffers
  3215.  
  3216. Buffer1:    dcb.b    2,0        ;For writes to serial (read from CLI)
  3217. Buffer2:    dcb.b    2,0        ;For reads
  3218. Buffer3:    dcb.b    BUFLEN,0    ;For reads from serial
  3219. Buffer4:    dcb.b    BUFLEN*2,0    ;For writes to CLI
  3220.  
  3221. DialBuffer1:    dcb.b    ENTRYLENGTH,0    ;for single dial/serial unit number :)
  3222.  
  3223. FileNameBuf1:    dc.b    "S:ShellTerm.PREFS"
  3224.         dcb.b    128-17,0
  3225. FileNameBuf2:    dcb.b    128,0        ;File to UL/capture filename
  3226. FileNameBuf3:    dcb.b    2*128,0        ;CMD string with arguments
  3227.  
  3228. PREFS_START:
  3229.  
  3230. PrefsStart:    dc.l    STFileVersion
  3231. SerDevNBuffer1:    dc.b    "serial.device"
  3232.         dcb.b    32-13,0        ;device name
  3233. SerUnit:    dc.l    0
  3234. Speed:        dc.l    9600
  3235. LocalEcho:    dc.w    0        ;(0=no echo, 1=echo)
  3236. CRTranslate:    dc.b    0        ;0=none, 1=strip, 2=add LF
  3237. LFTranslate:    dc.b    0        ;0=none, 1=strip, 2=add CR
  3238. CRTranslateIn:    dc.b    0        ;0=none, 1=strip, 2=add LF
  3239. LFTranslateIn:    dc.b    0        ;0=none, 1=strip, 2=add CR
  3240. DataBits:    dc.b    8
  3241. StopBits:    dc.b    1
  3242. XONXOFF:    dc.b    0        ;0=No, 1=Yes
  3243. CTSRTS:        dc.b    0        ;0=No, 1=Yes
  3244. Future1:    dc.l    0
  3245. Future2:    dc.l    0
  3246. Future3:    dc.l    0
  3247. Future4:    dc.l    0
  3248. SwapBSDEL:    dc.b    0        ;1=Yes
  3249. UseANSI:    dc.b    0        ;1=Yes
  3250. CPAssign:    dc.b    0        ;key to assign CTRL-P to
  3251. CursorRemap:    dc.b    0        ;remap cursor keys
  3252.  
  3253. ULProgram:    dcb.b    128,0        ;SZ
  3254. DLProgram:    dcb.b    128,0        ;RZ
  3255. ULDir:        dcb.b    128,0        ;SZ
  3256. DLDir:        dcb.b    128,0        ;RZ
  3257. DialPrefix:    dc.b    "ATDT"        ;dial prefix
  3258.         dcb.b    16-4,0
  3259. Entry1:        dcb.b    ENTRYLENGTH,0    ;Entry 1
  3260. Entry2:        dcb.b    ENTRYLENGTH,0    ;Entry 2
  3261. Entry3:        dcb.b    ENTRYLENGTH,0    ;Entry 3
  3262. Entry4:        dcb.b    ENTRYLENGTH,0    ;Entry 4
  3263. Entry5:        dcb.b    ENTRYLENGTH,0    ;Entry 5
  3264. Entry6:        dcb.b    ENTRYLENGTH,0    ;Entry 6
  3265. Entry7:        dcb.b    ENTRYLENGTH,0    ;Entry 7
  3266. Entry8:        dcb.b    ENTRYLENGTH,0    ;Entry 8
  3267. Entry9:        dcb.b    ENTRYLENGTH,0    ;Entry 9
  3268. Entry10:    dcb.b    ENTRYLENGTH,0    ;Entry 10
  3269.  
  3270. PREFS_END:    dc.l    0,0
  3271.  
  3272. PrefsSize:    EQU    (PREFS_END-PREFS_START)
  3273.         end
  3274.  
  3275.  
  3276.  
  3277. ClearSer:    move.l    IORRequest,a1
  3278.         lib    Exec,CheckIO
  3279.         tst.l    d0
  3280.         beq    ClearSer1
  3281.         move.l    IORRequest,a1
  3282.         lib    Exec,WaitIO
  3283.         rts
  3284.  
  3285. ClearSer1:    move.l    IORRequest,a1
  3286.         ABORTIO
  3287.         move.l    IORRequest,a1
  3288.         lib    Exec,WaitIO
  3289.         rts
  3290.