; ;Simple Host mode ;Tom Jennings ;30 nov 91 ; console 1 ;DEBUG ONLY unattended 1 ;non-interactive fidoterm "c e y" &t= 0 ;disable timeout trap &b= 2400 throttle 0 jmp skip ; ;Initialize the modem, either the first time through ;or after carrier loss. ; waitloop: message "Initializing the modem" throttle 20 ;20 mS per char max. dtr ;reset & disconnect, quiet 500 ;wait for quiet line, output "\r" ;issue one CR to clear modem quiet 100 output "ATV1E1S0=0X3\r" ;send init string match "OK\r" ;wait for result ; ;Answer-modem code goes here. ; answer: call answer ;go answer the modem cd-trap reset ;on carrier loss, restart ; ;Log in the user and verify their password. If error, disconnect and ;wait for the next caller. ; skip: throttle 0 ;type at full speed to the user output "\r\n\n\n\n Yar, who done woken me up?!!\r\n" fopen "users" ;list of users jerror no-user ;oops, file missing... call login ;enter name, verify password &a= &e ;(remember error code) fclose ;close user file jz goodbye ;login failed ; ;User is logged in. Main menu follows. ; main: message "User &r: Main menu" ;tell local sysop... output "\r\nEnter the FIRST LETTER of the command:\r\n" main2: minput "L)ist-Files D)ownload U)pload B)ERT G)oodbye ?=help : " output "\r\n" if "" main2 ;blank line if "L" list-files if "D" download if "U" upload if "G" goodbye if "B" bert if "FidoTerm Auto-BERT sequence:" auto-bert if "?" help jmp main ; ;---- MAIN MENU commands ---------------- ; ; ;HELP! ; help: output "L)ist Displays a list of the files available for D)ownload.\r\n" output "D)ownload Sends a file from FidoTerm HOST to you.\r\n" output "U)pload Receives a file from you to FidoTerm HOST.\r\n" output "B)ERT Manually initiate a BER test.\r\n" output "G)oodbye Terminates this session. (It is also safe to\r\n" output " disconnect manually at any time.)\r\n" jmp main ; ;Goodbye -- disconnect. Simple. However, this one doesn't return to ;main, but back to waiting for a caller. ; goodbye: output "Disconnecting in 5 seconds\r\n\n\n\n" delay 5000 ;wait 5 seconds jmp waitloop ;reset & init modem, start over ; ;Auto-BERT -- not a listed command, but text output by the BERT function ;to invoke an automatic response. The "FidoTerm Auto-BERT starts" line is ;followed by a formatted line containing BERT parameters. ; auto-BERT: minput "AUTOBERT: " if "" main call bert &s ;no quotes, allow expansion jmp main ; ;BERT -- Invoke the correct BERT test. ; bert: minput "Duration of test (MMM:SS or minutes): " output "\r\n" if "" main &a= &s ;(converts to a number!) jz bert ;insist on one! &1= &s ;but preserve orig. input minput "B)i-dir L)oopback R)ecv-only T)ransmit-only: " output "\r\n" if "" main if "b" bert-bi if "l" bert-loop if "r" bert-rcv if "t" bert-send jmp bert ; ;These are the test invokations -- they are also called from the main ;command input loop as "autoBERT" commands. ; bert-bi: fidoterm "t b &1" ;ESC TEST bidir jmp main bert-loop: fidoterm "t l &1" ;ESC TEST loop jmp main bert-rcv: fidoterm "t r &1" ;ESC TEST recv jmp main bert-send: fidoterm "t b &1" ;ESC TEST transmit jmp main ; ;List files -- open the file list "FILES", display the contents. This ;pauses every 24 lines if necessary. ; list-files: fopen "files" ;open the file list jerror lf2 ; not found lf0: &a= 24 ;pause every (these many) lines lf1: fread ;read lines (records) jerror lf3 ; no more files in list output "&1 &2 &3\r\n" ;FILENAME SIZE DESCRIPTION djnz lf1 ;every N lines minput "ENTER=more ESCape=quit: " ;pause jerror lf3 ;if ESCape, quit jmp lf0 ;else continue lf2: output "SORRY: File list missing!\r\n" lf3: fclose ;(fclose safe when no file open) jmp main ; ;DOWNLOAD -- get a filename, start sending the file. ; download: minput "File to download: " ;ask for filename(s) output "\r\n" if "" main ;nothing entered files &s ;see if they exist jz dl1 ; none! fidoterm "f p z" ;set ZMODEM protocol fidoterm "f u &s" ;upload == FidoTerm --> user jmp main dl1: output "There is no file \"&s\" to download! ABORTED\r\n" jmp main ; ;UPLOAD -- make sure the file doesn't exist. ; upload: minput "File to upload: " ;ask for filename(s) output "\r\n" if "" main ;nothing entered files &s ;see if they exist jz ul1 output "That file already exists! ABORTED\r\n" jmp main ul1: &1= &s ;&1 == filename minput "Enter a brief description of the file: " &2= &s ;&2 == description fidoterm "f p z" ;set ZMODEM protocol fidoterm "f d &s" ;download == user --> FidoTerm ; ;Add the filename and description to the files list. ; fopen "FILES" jerror main ;(doesnt exist!) ul2: fread ;find EOF &a= &e ;so's we can append jz ul2 ;(wait for error) fwrite ;write fclose jmp main no-user: output "SORRY system error: \"USER file missing\"" console 0 nu1: message "ERROR: Missing USER file! (ESC to abort)" jmp nu1