home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / HILFEN / MODEM / COMAND28 / HOST.SRC < prev    next >
Text File  |  1993-12-01  |  17KB  |  679 lines

  1. ;    trace on        ; Debugging
  2. ;
  3. ; ----- COM-AND Scripted host mode ----------------------------------
  4. ;
  5. ;    Goals:
  6. ;    o    Must autodetect caller's baud rate
  7. ;    o    Must work correctly for modems reporting true CD and otherwise.
  8. ;    o    Must log all activity
  9. ;
  10. ;    Functions:
  11. ;    o    Passworded log-on
  12. ;    o    DIR of current directory
  13. ;    o    CHDIR command
  14. ;    o    UP and DOWNLOADS
  15. ;    o    Graphical path display (using P/D TREED program)
  16. ;    o    Passworded DOS access (dangerous!)
  17. ;    o    Passworded drop-to-DOS using a doorway function
  18. ;
  19. ;    Commenced: 10/29/87 R.McG
  20. ;    Updated:    2/--/89 R.McG
  21. ;           10/--/89 R.McG  ZMODEM added
  22. ;    Ver 1.1:   11/--/90 R.McG  HOSETUP added
  23. ;            6/--/91 R.McG  DROPDOS added
  24. ;    --------------------------------------------------------------
  25. ;    Data for this script are established through the HOSETUP script.
  26. ;    The drop-to-DOS requires a doorway function (such as DOORWAY,
  27. ;    by Marshsall Dudley), and the script HOSTART.  The only other
  28. ;    file requisite to this HOST script is the TREED p/d utility.
  29. ;    --------------------------------------------------------------
  30. ;
  31. ;    Initialize
  32. ;
  33.     LEGEND "Scripted HOST mode (1.1).  Press ESC to exit."
  34. ;
  35. ;    Set default values (in case HOSTDAT does not exist)
  36. ;
  37.     S20 = "_PARM"(11:14)*","*"_PARM"(0:3) ; Port(4),speed(4)
  38.     S21 = "ATE0Q0V1X1S0=2 S7=30 S9=10^M"  ; Standard MINIT for HOST
  39.     S22 = "****"                    ; Set default logon password
  40.     S23 = "xxxx"                    ; Set default DOS password
  41.     S24 = ""                        ; Drop to DOS command
  42. ;
  43. ;    Initialize COM related values (This is done here to allow HOSTDAT
  44. ;    ... edits to override these settings)
  45. ;
  46.     SET PARITY NONE         ; fixed no parity
  47.     SET DATA 8            ; fixed 8 data bits
  48.     SET STOP 1            ; fixed 1 stop bit
  49.     SET MASK ON            ; accept 7 or 8 bits
  50.     SET CR_IN CR_LF         ; Display received c/rs as a cr/lf
  51.     SET ASCII UP_LF LF        ; Send LFs
  52.     SET SOFTFLOW ON         ; Allow XON/XOFF
  53. ;
  54. ;    Replace above values from HOSTDAT, if that script exists
  55. ;
  56.     IF ISSC "HOSTDAT" FCALL "HOSTDAT"
  57. ;
  58. ;    Initialize variables that must be constant
  59. ;
  60.     S0 = S22            ; Set to our subdirectory
  61.     S3 = S23            ; Set subdir for files
  62.     SUBDIR S29            ; Read current subdir
  63.     DLDIR S28            ; Read current download subdir
  64. ;
  65. ;    Set initial values that do not change port setting
  66. ;
  67.     LOG MARK ON            ; Timestamp logging
  68.     CLOG "* Host script loaded"
  69.     ON ESCAPE GOSUB End        ; Exit routine
  70.     SET INAFTER OFF         ; Turn off init after hangup
  71.     SET ALARM OFF            ; Turn off alarm
  72.     SET ATIME 1            ; Set alarm time to 1 second
  73. ;
  74. ;    If this is a restart, pickup at the main prompt
  75. ;
  76.     SET PORT S20(0:3)        ; Starting port
  77.     IF FCALLED and ISFILE "HOSTTEMP.BAT"
  78.        SET RECHO ON         ; Restart - need to reenable
  79.        LOG OPEN "HOSTLOG"           ; .. reenable
  80.        CLOG "* Return from drop-to-DOS"
  81.        GOTO Main_Prompt
  82.        ENDIF
  83. ;
  84. ;    Initialize values that change port setting, and start a new call
  85. ;
  86.     SET BAUD S20(5:8)        ; Starting speed
  87.     TRANSMIT "_MESCAPE"             ; Initialize modem (modem escape)
  88.     GOTO Restart            ; Branch around subroutines
  89. ;
  90. ; -----------------------------------------------------------------------
  91. ;    Subroutine: End of HOST
  92. ; -----------------------------------------------------------------------
  93. ;
  94. End:
  95.     HANGUP                ; Hangup the phone
  96.     CLOG "* HOST script terminated" ; Log completion
  97.     SET DLDIR S28            ; Reset dldir
  98.     CHDIR S29            ; Reset to default directory
  99.     RESET                ; Reset default values
  100.     CLEAR                ; Clear screen
  101.     MESS "HOST terminated... type Alt-X to exit COM-AND^M^J^M^J"
  102.     TRAN "_MINIT"                   ; Initialize modem from defaults
  103.     DELETE "\HOSTTEMP.TXT"          ; Cleanup
  104.     EXIT                ; Exit
  105. ;
  106. ;    Subroutine: Read from the caller into S9
  107. ;    .. This handles 'disconnect' and timeouts.
  108. ;
  109. Read_Comm:
  110.     RGET S9 80 180        ; wait for a connection
  111.     IF NOT CONNECTED    ; If modem reports CD dropped
  112.        GOTO Disconnect    ; Goto disconnect
  113.        ENDIF
  114.  
  115.     IF NOT SUCCESS        ; If timeout on the RGET
  116.        GOTO Timeout     ; .. issue message and disconnect
  117.     ENDIF
  118.  
  119.     FIND S9 "NO CARRIER"    ; Test for message from modem
  120.     IF FOUND        ; If modem didn't report 'CD' true
  121.        GOTO Disconnect    ; Goto disconnect
  122.        ENDIF
  123.  
  124.     SET FLAG(0) OFF     ; Report to caller
  125.     RETURN            ; Return with text in S9
  126. ;
  127. ;    Timeout on the call
  128. ;
  129. Timeout:
  130.     TRAN "^M^J... autodisconnect due to timeout"
  131.     MESSAGE "^M^J... autodisconnect due to timeout"
  132.     GOTO RComm_Exit     ; Exit cycle in the usual manner
  133. ;
  134. ;    Disconnect was reported.
  135. ;
  136. Disconnect:
  137.     MESSAGE  "^M^JCaller disconnected"
  138. ;
  139. ;    Read_Comm error exit
  140. ;
  141. RComm_Exit:
  142.     SET FLAG(0) ON        ; Report to caller
  143.     RETURN            ; Return to the caller
  144. ;
  145. ;    Usages:
  146. ;      S0 -> main password
  147. ;      S1 -> ID
  148. ;      S2 -> Default drive/subdir
  149. ;      S3 -> DOS password
  150. ;      S8 -> File name buffer
  151. ;      S9 -> General read buffer
  152. ;
  153. ;    Begin the sequence...
  154. ;
  155. Restart:
  156.     CHDIR S29        ; Reset to default drive
  157.     SET RECHO OFF        ; Turn off echo for us
  158.     SET RDISP OFF        ; Disable display of rcvd chars
  159.     CLEAR            ; Clear screen
  160.     LOCATE 0,0        ; Set to home
  161. ;
  162. ;    Go into auto answer (echo off, answer on 3rd)
  163. ;    Also: Return result codes, word form, with CONNECT 1200
  164. ;
  165. ;
  166.     HANGUP            ; HANGUP and leave modem in cmd mode
  167.     MESSAGE "^M^JWaiting...!"
  168.     PAUSE 3         ; Wait 3 secs
  169.     SET BAUD S20(5:8)    ; Starting speed
  170.     TRANSMIT S21        ; Transmit modem initialization
  171. ;
  172. ;    Wait for a connect
  173. ;
  174. WAIT_IT_OUT:
  175.     RGET S9 80 180
  176.     IF NOT SUCCESS
  177.        GOTO Wait_IT_Out
  178.        ENDIF
  179.  
  180.     FIND S9 "NO CARRIER"
  181.     IF FOUND
  182.        GOTO Restart
  183.        ENDIF
  184.  
  185.     FIND S9 "CONNECT"
  186.     IF NOT FOUND
  187.        GOTO WAIT_IT_OUT
  188.        ENDIF
  189. ;
  190. ;    Connection established: Adjust our linespeed if need be
  191. ;
  192.     GOSUB AutoBaud        ; Change rate according to CONNECT MSG
  193. ;
  194. ;    Issue a greeting
  195. ;
  196.     PAUSE 2         ; Let the modem settle
  197.     RFLUSH            ; Clear junk
  198.     TRAN "^M^JThe Flying Scotsman greets you!!^M^J"
  199.     SET RECHO ON        ; Turn on echo (back to caller)
  200.     SET RDISP ON        ; Turn on display of rcvd chars
  201.     LOG OPEN "HOSTLOG"
  202. ;
  203. ;    Request an ID
  204. ;
  205. ID_Query:
  206.     MESS "^M^JID prompt: "  ; Local console indicator
  207.     TRANSMIT "^M^JEnter your ID: "
  208.  
  209.     GOSUB Read_Comm     ; Read into S9
  210.     IF FLAG(0)        ; If first flag rtns set
  211.        GOTO Exit        ; .. disconnect and start over
  212.        ENDIF        ; ..
  213.  
  214.     SWITCH S9
  215.        CASE "_NULL"         ; Test for nothing entered
  216.           TRAN "You must be someone^M^J"
  217.           GOTO Exit     ; Don't let noone in
  218.       ENDCASE        ; End of ridicule
  219.     ENDSWITCH        ; End of ID test
  220.  
  221.     CLOG "* Host mode logon by "*S9
  222. ;
  223. ;    Request a password
  224. ;
  225.     TRANSMIT "^M^JEnter your password: "
  226.     LOG SUSPEND
  227.     SET RECHO OFF        ; Turn of echo of received text
  228.     SET RDISPLAY OFF    ; Turn off echo to console too
  229.  
  230.     GOSUB Read_Comm     ; Read into S9
  231.     IF FLAG(0)        ; If first flag rtns set
  232.        GOTO Exit        ; .. disconnect and start over
  233.        ENDIF        ; ..
  234.  
  235.     LOG RESUME        ; Restore logging
  236.     SET RECHO ON        ; Restore echo
  237.     SET RDISPLAY ON     ; Turn on echo to console again
  238. ;
  239. ;    Test for the main password
  240. ;
  241.     SWITCH S9
  242.        CASE S0        ; Test for match with S0
  243.           TRANSMIT "^M^J"   ; OK - good password
  244.        ENDCASE        ; End match with S0
  245.        DEFAULT        ; Not one of the above
  246.           TRANSMIT "Sorry , but you're not authorized."
  247.           GOTO Exit     ; And disconnect
  248.        ENDCASE        ; End of DEFAULT
  249.     ENDSWITCH
  250. ;
  251. ;    Now - do something
  252. ;
  253. Main_Prompt:
  254.     MESS "^M^JMain prompt: "; Local console indicator
  255.     TRAN "^M^JC)hdir F)ilelist, P)athlist, U)pload, D)ownload, or E)xit: "
  256.  
  257.     GOSUB Read_Comm     ; Read into S9
  258.     IF FLAG(0)        ; If first flag rtns set
  259.        GOTO EXIT        ; .. disconnect and start over
  260.        ENDIF        ; ..
  261.  
  262.     SWITCH S9        ; Test the entry
  263.        CASE "C"
  264.           GOTO CHDIR
  265.        ENDCASE
  266.  
  267.        CASE "D"
  268.           GOTO DOWNLOAD
  269.        ENDCASE
  270.  
  271.        CASE "E"
  272.           TRAN "Ok... bye^M^J"
  273.           GOTO EXIT
  274.        ENDCASE
  275.  
  276.        CASE "F"
  277.           GOTO FILELIST
  278.        ENDCASE
  279.  
  280.        CASE "P"
  281.           GOTO PATHLIST
  282.        ENDCASE
  283.  
  284.        CASE "U"
  285.           GOTO UPLOAD
  286.        ENDCASE
  287.  
  288.        CASE "X"
  289.           GOTO DOS
  290.        ENDCASE
  291.  
  292.        CASE "Y"
  293.           GOTO DROPDOS
  294.        ENDCASE
  295.  
  296.        CASE "OFF"
  297.           TRAN "Ok... bye^M^J"
  298.           GOTO EXIT
  299.        ENDCASE
  300.     ;
  301.     ;    Default case for typists
  302.     ;
  303.        DEFAULT
  304.           FIND S9 "CHDIR"   ; Try for larger
  305.           IF FOUND        ; If entry contained "CHDIR"
  306.          GOTO CHDIR
  307.          ENDIF
  308.  
  309.           FIND S9 "DOWN"    ; Try for larger
  310.           IF FOUND        ; If entry contained 'Down"
  311.          GOTO DOWNLOAD
  312.          ENDIF
  313.  
  314.           FIND S9 "FILE"    ; Try for larger
  315.           IF FOUND        ; If entry contained 'FILE"
  316.          GOTO FILELIST
  317.          ENDIF
  318.  
  319.           FIND S9 "PATH"    ; Try for larger
  320.           IF FOUND        ; If entry contained 'PATH"
  321.          GOTO PATHLIST
  322.          ENDIF
  323.  
  324.           FIND S9 "UP"      ; Try for larger
  325.           IF FOUND        ; If entry contained 'up"
  326.          GOTO UPLOAD
  327.          ENDIF
  328.  
  329.           FIND S9 "DOS"     ; Try for larger
  330.           IF FOUND        ; If entry contained 'DOS"
  331.          GOTO DOS
  332.          ENDIF
  333.  
  334.           TRAN "^M^JCommand not recognized... try again"
  335.           GOTO Main_Prompt    ; If none of the above
  336.        ENDCASE        ; End of DEFAULT
  337.     ENDSWITCH
  338. ;
  339. ;    Can't get here because of the DEFAULT in the SWITCH above
  340. ;
  341.     TRAN "^M^JThank you veddy much.^M^J"
  342.     GOTO Main_Prompt
  343. ;
  344. ;    General exit routine - don't GOTO from within a subroutine!!!
  345. ;
  346. EXIT:
  347.     CLOG "* Host mode exit"
  348.     LOG CLOSE        ; Turn off logging
  349.     MESS "^G"               ; Beep to indicate completion
  350.     GOTO Restart        ; And start over
  351. ;
  352. ;    Subroutine: Query for a file name - return in S8
  353. ;
  354. File_Query:
  355.     MESS "^M^JFname query: "; Local console indicator
  356.     TRAN "^M^JEnter the file name: "
  357.  
  358.     GOSUB Read_Comm     ; Read into S9
  359.     IF FLAG(0)        ; If first flag rtns set
  360.        RETURN        ; .. disconnect and start over
  361.        ENDIF        ; ..
  362.  
  363.     ASSIGN S8 S9        ; Move fname into another variable
  364.     SWITCH S8
  365.        CASE "_NULL"         ; Test for nothing entered
  366.           SET FLAG(1) ON    ; Report to caller
  367.           RETURN        ; Return right here w/ flag set
  368.        ENDCASE
  369.     ENDSWITCH        ; End of ID test
  370.  
  371.     SET FLAG(1) OFF     ; Report to caller
  372.     RETURN            ; Return to caller
  373. ;
  374. ;    XMODEM Upload (up from caller)
  375. ;
  376. UPLOAD:
  377.     MESS "^M^JUpload from caller"
  378.  
  379.     GOSUB File_Query    ; Ask for a file name
  380.     IF FLAG(0)        ; If first flag rtns set
  381.        GOTO EXIT        ; .. disconnect and start over
  382.        ENDIF        ; ..
  383.  
  384.     IF FLAG(1)        ; If no file returned
  385.        GOTO Main_Prompt    ; .. start over
  386.        ENDIF        ; ..
  387.  
  388.  
  389.     ISFILE S8        ; Test for file already
  390.     IF SUCCESS        ; If file exists
  391.        TRAN "^M^JFile already exists"
  392.        GOTO UPLOAD        ; Ask again
  393.        ENDIF
  394.  
  395.     MESS "!Method prompt: " ; Local console indicator
  396.     TRAN "^M^JW)xmodem, X)modem, Y)modem (X1k), Z)modem, or K)ermit: "
  397.  
  398.     GOSUB Read_Comm     ; Read into S9
  399.     IF FLAG(0)        ; If first flag rtns set
  400.        GOTO Main_Prompt    ; .. disconnect and start over
  401.        ENDIF        ; ..
  402.  
  403.     SWITCH S9        ; Test the entry
  404.        CASE "W"
  405.           GETFILE WXMODEM S8
  406.        ENDCASE
  407.        CASE "X"
  408.           GETFILE XMODEM S8
  409.        ENDCASE
  410.        CASE "Y"
  411.           GETFILE YMODEM S8
  412.        ENDCASE
  413.        CASE "Z"
  414.           GETFILE ZMODEM
  415.        ENDCASE
  416.        CASE "K"
  417.           GETFILE KERMIT    ; FIle name supplied by caller
  418.        ENDCASE
  419.        DEFAULT
  420.           TRAN "^M^JInvalid transfer selection"
  421.           GOTO Main_Prompt
  422.        ENDCASE
  423.     ENDSWITCH
  424.  
  425.     GOTO EOTransfer         ; Report success/failure
  426. ;
  427. ;    XMODEM Download (down to caller)
  428. ;
  429. DOWNLOAD:
  430.     MESS "^M^JDownload to caller"
  431.  
  432.     GOSUB File_Query    ; Ask for a file name
  433.     IF FLAG(0)        ; If first flag rtns set
  434.        GOTO EXIT        ; .. disconnect and start over
  435.        ENDIF        ; ..
  436.  
  437.     IF FLAG(1)        ; If no file returned,
  438.        GOTO Main_Prompt    ; .. start over
  439.        ENDIF        ; ..
  440.  
  441.     ISFILE S8        ; Test for file already
  442.     IF NOT SUCCESS        ; If file doesn't exist
  443.        TRAN "^M^JFile doesn't exist"
  444.        GOTO DOWNLOAD    ; Ask again
  445.        ENDIF
  446.  
  447.     MESS "^M^JMethod prompt "
  448.     TRAN "^MW)xmodem, X)modem, Y)modem (X1k), Z)modem, K)ermit, or A)scii: "
  449.  
  450.     GOSUB Read_Comm     ; Read into S9
  451.     IF FLAG(0)        ; If first flag rtns set
  452.        GOTO Main_Prompt    ; .. disconnect and start over
  453.        ENDIF        ; ..
  454.  
  455.     SWITCH S9        ; Test the entry
  456.        CASE "A"
  457.           SENDFILE ASCII S8
  458.        ENDCASE
  459.        CASE "W"
  460.           SENDFILE WXMODEM S8
  461.        ENDCASE
  462.        CASE "X"
  463.           SENDFILE XMODEM S8
  464.        ENDCASE
  465.        CASE "Y"
  466.           SENDFILE YMODEM S8
  467.        ENDCASE
  468.        CASE "Z"
  469.           SENDFILE ZMODEM S8
  470.        ENDCASE
  471.        CASE "K"
  472.           SENDFILE KERMIT S8
  473.        ENDCASE
  474.        DEFAULT
  475.           TRAN "^M^JInvalid transfer selection"
  476.           GOTO Main_Prompt
  477.        ENDCASE
  478.     ENDSWITCH
  479.  
  480.     GOTO EOTransfer         ; Report success/failure
  481. ;
  482. ;    End of transfer... note result on local console
  483. ;
  484. EOTRANSFER:
  485.     IF NOT SUCCESS
  486.        MESS "^M^JTransfer failed"
  487.     ELSE
  488.        MESS "^M^JTransfer OK"
  489.        ENDIF
  490.     GOTO Main_Prompt
  491. ;
  492. ;    Filelist... awkward... but it works
  493. ;
  494. FILELIST:
  495.     MESS "^M^JFilelist command: "   ; Local console indicator
  496.     TRAN "^M^J Working..."          ; May take a moment
  497.  
  498.     DOS "DIR >HOSTTEMP.TXT"         ; To a temp file
  499.     TRAN "^M^J"                     ; Send a c/r
  500.     SENDFILE ASCII "HOSTTEMP.TXT"
  501.     TRAN "^M^J"                     ; Send a c/r
  502.  
  503.     DOS "DEL HOSTTEMP.TXT"          ; Clean up after us
  504.     GOTO Main_Prompt        ; And continue
  505. ;
  506. ;    CHDIR... Query for a path.
  507. ;
  508. CHDIR:
  509.     MESS "^M^JCHDIR Command: "      ; Local console indicator
  510.     TRAN "^M^JEnter the drive:subdirectory: "
  511.  
  512.     GOSUB Read_Comm     ; Read into S9
  513.     IF FLAG(0)        ; If first flag rtns set
  514.        GOTO Main_Prompt    ; .. disconnect and start over
  515.        ENDIF        ; ..
  516.  
  517.     CHDIR S9        ; Do it.
  518.     GOTO Main_Prompt    ; And continue
  519. ;
  520. ;    Path tree... awkward... but it works
  521. ;
  522. PATHLIST:
  523.     MESS "^M^JPathlist command: "; Local console indicator
  524.     TRAN "^M^J Working..."  ; May take a moment
  525.  
  526.     DOS "Treed >HOSTTEMP.TXT" ; To a temp file
  527.     TRAN "^M^J"             ; Send a c/r
  528.     SENDFILE ASCII "HOSTTEMP.TXT"
  529.     TRAN "^M^J"             ; Send a c/r
  530.  
  531.     DOS "DEL HOSTTEMP.TXT"  ; Clean up after us
  532.     GOTO Main_Prompt    ; And continue
  533. ;
  534. ;    DOS command: Accept a command and execute it
  535. ;
  536. DOS:
  537.     GOSUB DOSPSW        ; Request a password
  538.     IF FAILED GOTO Main_Prompt
  539. ;
  540. ;    DOS... Query for a command
  541. ;
  542.     MESS "^M^JDOS Command: "; Local console indicator
  543.     TRAN "^M^JEnter the command: "
  544.  
  545.     GOSUB Read_Comm     ; Read into S9
  546.     IF FLAG(0)        ; If first flag rtns set
  547.        GOTO Main_Prompt    ; .. disconnect and start over
  548.        ENDIF        ; ..
  549.  
  550.     TRAN "^M^J Working..."  ; May take a moment
  551.  
  552.     CONCAT S9 ">HOSTTEMP.TXT"
  553.     DOS   S9        ; Do it.
  554.  
  555.     TRAN "^M^J"             ; Send a c/r
  556.     SENDFILE ASCII "HOSTTEMP.TXT"
  557.     TRAN "^M^J"             ; Send a c/r
  558.  
  559.     DOS "DEL HOSTTEMP.TXT"  ; Clean up after us
  560.     GOTO Main_Prompt    ; And continue
  561. ;
  562. ;    DOSPSW    Request a password
  563. ;
  564. DOSPSW:
  565.     MESSAGE "^M^JRequesting DOS password"
  566.     LOG SUSPEND        ; Turn off logging
  567.     SET RECHO OFF        ; .. and don't echo passsword
  568.     SET RDISPLAY OFF    ; Turn off echo to console too
  569.  
  570.     TRANSMIT "^M^JEnter the DOS password: "
  571.  
  572.     GOSUB Read_Comm     ; Read into S9
  573.     IF FLAG(0)        ; If first flag rtns set
  574.        GOTO DOSPERR     ; Exit, failed
  575.        ENDIF        ; ..
  576.  
  577.     LOG RESUME        ; Turn on logging again
  578.     SET RECHO ON        ; .. and begin echoing again
  579.     SET RDISPLAY ON     ; Turn on echo to console again
  580. ;
  581. ;    Test for the our password
  582. ;
  583.     SWITCH S9
  584.        CASE S3        ; Test for match with S3
  585.           TRANSMIT "^M^J"   ; OK - good password
  586.        ENDCASE        ; End match with S3
  587.        DEFAULT        ; Not one of the above
  588.           TRANSMIT "Sorry , but you're not authorized."
  589.           GOTO DOSPERR    ; Exit, failed
  590.        ENDCASE        ; End of DEFAULT
  591.     ENDSWITCH
  592. ;
  593. ;    Return with success
  594. ;
  595.     LOG RESUME        ; Restart log
  596.     SET SUCCESS ON        ; Set indicator for caller
  597.     RETURN
  598. ;
  599. ;    Return with success
  600. ;
  601. DOSPERR:
  602.     LOG RESUME        ; Restart log
  603.     SET SUCCESS OFF     ; Set indicator for caller
  604.     RETURN
  605. ;
  606. ;    DROPDOS command: Request a password
  607. ;
  608. DROPDOS:
  609.     IF NULL S24
  610.        TRAN "^M^JCommand not recognized... try again"
  611.        GOTO Main_Prompt    ; Can't do it
  612.        ENDIF
  613.     GOSUB DOSPSW        ; Request a password
  614.     IF FAILED GOTO Main_Prompt
  615. ;
  616. ;    DROPDOS... Build a batch file
  617. ;
  618.     FOPENO "HOSTTEMP.BAT" TEXT
  619.     IF NOT SUCCESS
  620.        TRAN "File error - cannot drop to DOS^M^J"
  621.        GOTO Main_Prompt
  622.        ENDIF
  623.  
  624.     WRITE "ECHO OFF!"       ; Start the batch file
  625.     S0 = S24        ; Setup up drop to DOS command
  626.     PRESERVE S0        ; Make it printable
  627.     WRITE S0        ; Write the Drop to DOS command
  628.     WRITE "!"               ; And a terminating cr
  629.  
  630.     WRITE "CD "*S29*"!"     ; Change a changed directory
  631.     WRITE "COM-AND /q/p/fHOSTART!" ; inhibit COM-AND.CMD; take modem as set
  632.     WRITE "^Z"
  633.     FCLOSEO         ; And we're done with it
  634.  
  635.     CLOG "* Drop-to-DOS"
  636.  
  637.     SET TTHRU OFF        ; Disable type through
  638.     STACK CLEAR        ; Place invocation of the batch file
  639.     STACK "HOSTTEMP.BAT!"   ; .. into BIOS's area
  640.     BYE            ; Do it.
  641. ;
  642. ;    Auto baudrate detect (according to message in S9)
  643. ;
  644. AutoBaud:
  645.     IF FIND S9 "1200"
  646.        SET BAUD 1200        ; Set to new rate
  647.        RETURN            ; We're done.
  648.        ENDIF
  649.  
  650.     IF FIND S9 "2400"
  651.        SET BAUD 2400        ; Set to new rate
  652.        RETURN            ; We're done.
  653.        ENDIF
  654.  
  655.     IF FIND S9 "4800"
  656.        SET BAUD 4800        ; Set to new rate
  657.        RETURN            ; We're done.
  658.        ENDIF
  659.  
  660.     IF FIND S9 "9600"
  661.        SET BAUD 9600        ; Set to new rate
  662.        RETURN            ; We're done.
  663.        ENDIF
  664.  
  665.     IF FIND S9 "19200"
  666.        SET BAUD 19.2        ; Set to new rate
  667.        RETURN            ; We're done.
  668.        ENDIF
  669.  
  670.     IF FIND S9 "19.2"
  671.        SET BAUD 19.2        ; Set to new rate
  672.        RETURN            ; We're done.
  673.        ENDIF
  674. ;
  675. ;    None of the above... set to 300
  676. ;
  677.     SET BAUD 300        ; Set to 1200 baud
  678.     RETURN            ; We're done.
  679.