home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol128 / bye72k.aqm / BYE72K.ASM
Encoding:
Assembly Source File  |  1985-02-10  |  53.9 KB  |  2,359 lines

  1.     TITLE    'BYE Vers 7.2K of April 6, 1983'
  2. ;
  3. VER    EQU    72    ;Current version number
  4. REV    EQU    'K'    ;Current sub revsion
  5. DAY    EQU    06    ;Day of the month in range 1 to 31
  6. MONTH    EQU    04    ;Month of the year in range 1 to 12
  7. YEARS    EQU    83    ;Year in range 00 to 99
  8. ;
  9. ;            BYE V7.2
  10. ;    REMOTE CONSOLE PROGRAM FOR CP/M AND MODEM
  11. ;
  12. ;This program allows modem callers to use your CP/M system
  13. ;just as if they were seated at the system console.  Special
  14. ;assembly-time options allow limiting the caller's access by
  15. ;password and/or access to only a message-service program.
  16. ;
  17. ;Based on an original program written by Dave Jaffe, January 1979
  18. ;Rewritten for PMMI modem by Ward Christensen, February 1979.
  19. ;Be sure to set the equates for the modem
  20. ;you are using.
  21. ;
  22. ;Thanks to Bill Precht for the "label + offset" idea allowing
  23. ;this program to relocate itself without using DDT to initially
  24. ;set it up.
  25. ;
  26. ;Adapted for Telecom Australia Auto answer modem
  27. ;operation with 2651 based UART interface. April, 1982
  28. ;
  29. ;Bill Bolton,
  30. ;Software Tools,
  31. ;P.O. Box 80,
  32. ;Newport Beach,
  33. ;NSW, 2106,
  34. ;Australia.
  35. ;
  36. ;Modifications/fixes: (in reverse order to minimize reading time)
  37. ;
  38. ;06/Oct/83 Added optional code to limit number of attempts at answering
  39. ;       questions to stop turkeys from monopolising the system all
  40. ;       day by setting up programs that just send occasional CRs,
  41. ;       (yes folks they DO exist). Tries for the "nulls" response
  42. ;       can be set to a different (probably higher) number from that
  43. ;       for the remaining questions. Ver 7.2K <WFB>
  44. ;
  45. ;07/Oct/82 Fixed BCD math bug in BOPLOG, replaced INR A with
  46. ;       ADI 1 as carry flag was upsetting DAA when number passed
  47. ;       100 BCD. Ver 7.2J <WFB>
  48. ;
  49. ;02/Sep/82 Rearranged auto logoff warning code.  Made the command
  50. ;       line passed to CCP "silent" to remote user so they can't
  51. ;       tell what the exit file is called. No new Version number.
  52. ;       <WFB>
  53. ;       
  54. ;27/Aug/82 Added conditional code to perform a "real" warm boot after
  55. ;       inactivity timeout and then pass out a fixed command line
  56. ;       to load a .COM file. Performing a warm boot should always be
  57. ;       safe if there has been no activity for several minutes. I
  58. ;       experimented with using LODCOM to load a file but the most
  59. ;       likely case for a timeout is when waiting for a respone to the
  60. ;       CP/M ">" prompt. This means that the call to MINPUT has
  61. ;       already come through the BDOS so any attempt at a BDOS call
  62. ;       results in reentering the BDOS and as we all know its not
  63. ;       renterent. A warm boot avoids this problem and cancels all
  64. ;       bets. I use this feature to execute a program called TIMEOUT
  65. ;       ( a modified EXITRBBS) which records the auto logoff against
  66. ;       the users name in the CALLERS file and then renters BYE for a
  67. ;       normal logout. This leaves a carrier loss as the only
  68. ;       "uncontrolled" exit from the RCPM system. Also added
  69. ;       conditional code to give the user a warning of impending
  70. ;       auto logoff a predetermined time before it happens. Ver 7.2I <WFB>
  71. ;
  72. ;26/Aug/82 Added code to count inactivity timeouts, added WELFILE equate
  73. ;       to disable "WELCOME" file display code if not needed.
  74. ;        Removed KDELAY routine and adjusted MINUTES equate so that
  75. ;       DELAY could do it all. Ver 7.2H <WFB>
  76. ;
  77. ;08/Aug/82 Added code to reset mode of 2651 UART before each new call.
  78. ;       This will force a reseting of the baud rate etc., in case
  79. ;       it got glitched. Also added date and version equates for
  80. ;       signon message to make maintenance easier. Ver 7.2G <WFB>
  81. ;
  82. ;25/Jun/82 Added conditional code to trap RST 7 and jump to a
  83. ;       Warm Boot. Ver 7.2F <WFB>
  84. ;
  85. ;18/Jun/82 Added code to clear tx register of the UART after
  86. ;       each carrier loss. With CCITT direct connect modems
  87. ;       CTS goes inactive simultaneously with Carrier detect.
  88. ;       On the 2651 UART, CTS inactive clamps the transmitter
  89. ;       even if its in the middle of a character.
  90. ;       If carrier was permanently lost in the middle of a
  91. ;       character, this would sometimes clamp the 2651
  92. ;          transmitter in a "space" condition. The next caller would
  93. ;       get "ANSWER" carrier offset to the "space" and some modems
  94. ;       don't carrier detect on that, therefore CD and CTS never went
  95. ;       active and never unclamped the transmitter (round and round
  96. ;       in ever decreasing circles until it....). Ver 7.2E <WFB>
  97. ;       
  98. ;16/Jun/82 Added conditional code for "flip" to answer mode after
  99. ;       upper case question. Ver 7.2D <WFB>
  100. ;
  101. ;11/Jun/82 Added code to protect current state of frequency mode
  102. ;       bit in command byte of UART during error reset and also
  103. ;       added a few more UART equates. Ver 7.2C <WFB>
  104. ;
  105. ;25/May/82 Added ring detect to carrier timeout loop enable full
  106. ;       carrier detect period after answering a new call and to
  107. ;       prevent hanging up on new call as soon as it is answered
  108. ;       if it arrived at the end of a timeout period. Added
  109. ;       CTIME equate for carrier timeout period. Ver 7.2B <WFB>
  110. ;
  111. ;24/May/82 Added correct error reset code for 2651 to overcome
  112. ;       the system sending data but refusing to accept data from
  113. ;       modem. Many comments tabbed over to constant column
  114. ;       position. Carrier dropout counter added to detect
  115. ;       Telecom "open line" beep which occurs if remote user
  116. ;       hangs up or line drops out. Telecom modems detect this
  117. ;       as intermitant carrier and otherwise BYE will never
  118. ;       time out. Ver 7.2A <WFB>
  119. ;    
  120. ; 6/Apr/82 Deleted DC Hayes and PMMI routines and replaced
  121. ;       with general purpose UART interface to control Telecom
  122. ;       auto answer modem. Deleted CPM2 switch, now permanently
  123. ;       set for CPM2. UART may be banked type. Deleted ringback
  124. ;       code. <WFB>
  125. ;
  126. ;11/Oct/81 Print password on local console with DUAL$IO. Allow
  127. ;      return from PRNLOG with USRLOG. Make <CR><LF> instead
  128. ;      of <LF><CR> in USRLOG reports. Print out BYE version
  129. ;      number for easy identification. Position PRNLOG after
  130. ;      cold boot routine, and change cold boot routine to
  131. ;      jump to MBOOT, thereby defining path to PRNLOG for
  132. ;      all BYE programs and allowing one trivial program
  133. ;      that can be run to get the BYE log. Make counters
  134. ;      16 bits for greater range. By Steve Bogolub
  135. ;
  136. ;1/Oct/81 Added CALL CHECK to MSTAT routine to eliminate
  137. ;      possibility of system crash when carrier lost while
  138. ;      performing repeated console status checks without
  139. ;      any console output.  This problem occurs during the
  140. ;      password input of USERPW.ASM, and potentially any other
  141. ;      program that does repeated direct console input, such
  142. ;      as MBASIC, etc.  
  143. ;      By Ron Fowler and Dave Hardy
  144. ;
  145. ;14/May/81 Added CCS disk support (to turn off disks when idle)
  146. ;      Added support for Godbout SS1 Real time clock.
  147. ;      Added Phone to Lister, Punch & Reader patch. (AAJ)
  148. ;
  149. ;20/Mar/81 Fixed MOUTPUT so parity bit is stripped before outputting
  150. ;      character to modem.  Corrected 3/18/81 null fix.  Added
  151. ;      additional description to heading of this file.  (KBP)
  152. ;
  153. ;18/Mar/81 Add first-ring debounce routine, change PMMI HANGUP
  154. ;      to do break for faster disconnect, fix error in P3TODTR
  155. ;      equate for PMMI, added end-of-program error message to
  156. ;      mark ending address (see note at label DEST). By KBP.
  157. ;      Fix bug that prevented nulls at end of line if DUAL$IO
  158. ;      was true.  By Hank Szyszka.
  159. ;
  160. ;23/Feb/81 Conditional assembly added for Intertec SuperBrain
  161. ;      with Racal-Vadic 3451 modem. Corrected lack of RET in
  162. ;      CONIN. In MOUTPUT, replaced CZ CHECK with JNZ SILENT,
  163. ;      CALL CHECK; this eliminates chance of looping in MOUTPUT
  164. ;      if modem doesn't empty USART after carrier lost.
  165. ;      Also had to write a routine to patch BIOS so that after
  166. ;      the warm boot disk read this program repatches the BIOS.
  167. ;      Apparently the SuperBrain warm boot overwrites a portion
  168. ;      of the BIOS. By P.L. Kelley
  169. ;
  170. ;17/Feb/81 Added check for extraneous control characters in
  171. ;       hardcopy log.  (Formfeed seems to be a common "hit").
  172. ;       Changed local startup test to directly test for carrier
  173. ;       instead of calling CARCK, to avoid 15 second delay.
  174. ;       <BRR>
  175. ;
  176. ;15/Feb/81 Removed dependance on DC Hayes hardware timer so that
  177. ;          DCHAYES conditional assembly is compatible with both
  178. ;          old-style 80-103A and new-style MM100 boards.
  179. ;          Rearranged patch list to "most recent first" order.
  180. ;       Added message for invalid-drive test.
  181. ;          Added ANI 7Fh to upper case conversion test so that
  182. ;          it's not fooled by bit 7 being set.
  183. ;          Added WELUSR equate for user # containing WELCOME file.
  184. ;          Removed PTRPORT equate and changed hardcopy logic to
  185. ;          work through the BIOS printer driver. <BRR>
  186. ;
  187. ;22/Jan/81 CHANGED CARRIER DETECT ROUTINE FOR DC HAYES TO WAIT FOR
  188. ;       15 SECONDS AFTER LOSS OF CARRIER TO RETURN.  <DAVID KOZINN>
  189. ;
  190. ;17/Jan/81 CHANGED TIMING LOOPS TO USE DC HAYES HARDWARE TIMER
  191. ;       IF PRESENT.   <DAVID KOZINN>
  192. ;
  193. ;16/Jan/81 ADDED EQUATES AND CODE FOR THE DC-HAYES 
  194. ;       MICROMODEM 100.  <DAVID KOZINN>
  195. ;
  196. ;23/Sep/80 Fixed bugs that prevented "bye /a" and "bye /c" from
  197. ;      working properly.  Also repaired several errors in
  198. ;      conditional assembly nesting. -->Ron Fowler
  199. ;
  200. ;20/Sep/80 Modified status checking during ring-wait routine to
  201. ;      use cp/m BDOS call, as suggested by Keith Petersen.
  202. ;      This should make the program more portable.  Also
  203. ;      added Bruce Ratoff's update to DCHBYE program (5.5),
  204. ;      that allows the use of bye from non-zero user areas.
  205. ;      By Ron Fowler
  206. ;
  207. ;19/Sep/80 Modified COM file load routine to prevent BDOS
  208. ;      overwrite if the COM file won't fit in the TPA
  209. ;      By Ron Fowler
  210. ;
  211. ;19/Sep/80 Added new '/' option C, which has the same affect as
  212. ;      /A, except that /C loads the com file after answering
  213. ;      the phone, while /A boots cp/m.
  214. ;      By Ron Fowler
  215. ;
  216. ;19/Sep/80 Added conditional assembly to give the operator a
  217. ;      'twit' logout key. Added conditionals for 'message
  218. ;      from operator' and 'system down in 5 minutes' keys.
  219. ;      Added front-panel selection of hard-copy log, remote
  220. ;      'black-out', and password option.  Also, if cpm/2 is
  221. ;      used, a message is printed when an unsupported user
  222. ;      area is entered.
  223. ;      By Ron Fowler and Dave Hardy
  224. ;
  225. ;19/Sep/80 Modified to prevent re-load of the com file when
  226. ;      a voice call comes in.  Reset the DMA address back
  227. ;      to 80h after the com file is loaded.
  228. ;      By Ron Fowler
  229. ;
  230. ;16/Sep/80 Added conditional assembly to allow automatic
  231. ;      loading of a com file instead of cp/m boot. Also
  232. ;      added decimal usrlog counters as conditional as-
  233. ;      sembly.
  234. ;      By Ron Fowler
  235. ;
  236. ;15/Sep/80 Added conditional assembly for automatic timed
  237. ;      log-out, drive and user number masking, lower
  238. ;      case query at login, and cp/m 2.x.  Thanks to
  239. ;      Bruce Ratoff for the routines (lifted from his
  240. ;      'DCHBYE54.ASM') used to implement these functions
  241. ;      NOTE: in order to implement the timed log-out, it
  242. ;      was necessary to do timing in software loops.
  243. ;      Therefore, a new equate, FASTCLK, has been added
  244. ;      to allow for 4mhz clock speeds. Also added Bruce
  245. ;      Ratoff's overrun/framing error checking when read-
  246. ;      ing the modem port.
  247. ;      By Ron Fowler
  248. ;
  249. ;16/Jul/80 Added "/R" command option to allow USRLOG
  250. ;      counters to be reset upon entry.
  251. ;      By Dave Hardy
  252. ;
  253. ;11/Jul/80 Added conditional assembly for password and
  254. ;      user log routines, and routines to print USRLOG
  255. ;      information on console after program exit.
  256. ;      By Dave Hardy
  257. ;
  258. ;10/Jul/80 Added code to allow auto-answer after first
  259. ;      or second ring for more reliable auto-answer
  260. ;      when using "ringback" option.
  261. ;      By Dave Hardy
  262. ;
  263. ;29/Jun/80 Added USRLOG routines to keep track of number
  264. ;      of callers, and display on front panel
  265. ;      of IMSAI (i.e. output number to port FFH).
  266. ;      By Dave Hardy
  267. ;
  268. ;11/Jun/80 Added 710 Baud rate selection option at sign-on.
  269. ;      By Dave Hardy and Bruce Levison.
  270. ;
  271. ;11/Jun/80 Added routines to allow conditional assembly for
  272. ;      Morrow's Discus 2D board (all Rev's) with memory
  273. ;      mapped I/O.
  274. ;      By Dave Hardy
  275. ;
  276. ;24/Jan/80 Added routines to preserve registers when calling
  277. ;      the user's CBIOS.  Added conditional assembly for
  278. ;      callback feature.  Increased stack space to 60.
  279. ;      By Keith Petersen.
  280. ;
  281. ;24/Sep/79 Added routines to allow automatic multiple baud
  282. ;      rate selection, exit to CP/M from local console,
  283. ;      echo nr. of nulls selected. By Keith Petersen,
  284. ;      with thanks to Bob Mathias for suggestions.
  285. ;
  286. ;6/Jul/79 Added routine to allow "callback" operation so modem
  287. ;      does not answer normal voice calls.  By Robbin Hough
  288. ;      and Keith Petersen, W8SDZ.
  289. ;
  290. ;
  291. ;------------------------------------------------
  292. ;    SYSTEM EQUATES
  293. FALSE    EQU    0
  294. TRUE    EQU    NOT FALSE
  295. BDOS    EQU    5
  296. CR    EQU    0DH
  297. LF    EQU    0AH
  298. BEL    EQU    07H
  299. ESC    EQU    01BH
  300. MINUTES    EQU    10*60    ;CONSTANT FOR 1 MIN TIM DLY
  301. ;
  302. ;CHANGE THE FOLLOWING EQUATE TO AN AREA IN YOUR
  303. ;HI MEMORY WHERE THIS PROGRAM MAY PATCH ITSELF IN.
  304. ;APPROX MEMORY REQUIREMENTS: UP TO xxxx BYTES.
  305. ;
  306. DEST    EQU    0F400H    ;RUNNING LOCATION OF CODE
  307. ;
  308. ;YOU WILL LIKELY ALSO WANT TO CHANGE THE PASSWORD,
  309. ;LOCATED BELOW AT LABEL "PASSWD", AND THE MESSAGES
  310. ;PRINTED AT LABEL "WELCOME" AND JUST ABOVE LABEL
  311. ;"HANGUP"
  312. ;
  313. ;------------------------------------------------
  314. ;
  315. ;THIS PROGRAM RUNS UP IN HIGH RAM.  IT GETS THERE
  316. ;BY BEING MOVED THERE WHEN 'BYE' IS TYPED.
  317. ;
  318. ;THE PROGRAM IN HI RAM DOES THE FOLLOWING:
  319. ;
  320. ;    1.    HANGS UP THE PHONE
  321. ;    2.    AWAITS RING DETECT, ALLOWS EXIT
  322. ;        TO CP/M IF LOCAL KBD TYPES CTL-C
  323. ;    3.    OUTPUTS CARRIER
  324. ;    4.    AWAITS INCOMING CARRIER
  325. ;        GOING TO STEP 1 IF NONE
  326. ;        FOUND IN 25 SECONDS
  327. ;    5.    ASKS NUMBER OF NULLS (0-9)
  328. ;    6.    TYPES THE FILE "STARTUP" FROM
  329. ;        DISK, ALLOWING CTL-C TO SKIP IT
  330. ;    7.    OPTIONALLY ASKS FOR A PASSWORD, ALLOWING
  331. ;        5 TRIES TO GET IT RIGHT.
  332. ;    8.    WHEN PASSWORD ENTERED, IF USED, DROPS
  333. ;        INTO CP/M.
  334. ;    9.    CALLER CAN LEAVE BY HANGING UP,
  335. ;        (ANY TIME CARRIER IS LOST, IT
  336. ;        WAITS 25 SECONDS, THEN GOES
  337. ;        BACK TO STEP 1), OR THE CALLER
  338. ;        MAY TYPE THE PROGRAM NAME (BYE)
  339. ;
  340. ;
  341. ;****************************************************
  342. ;*        OPTION CONFIGURATION SECTION        *
  343. ;****************************************************
  344. ;
  345. PRINTER EQU    FALSE    ;WANT TO RETAIN LIST DEVICE?
  346. DUAL$IO EQU    TRUE    ;WANT CONSOLE & MODEM?
  347. CALLBAK EQU    FALSE    ;WANT CALLBACK FEATURE?
  348. PWRQD    EQU    FALSE    ;WANT TO USE PASSWORD?
  349. USRLOG    EQU    TRUE    ;WANT TO COUNT NUMBER OF USERS?
  350. ACTIME    EQU    TRUE    ;True to count activity timeouts
  351. IMSAI    EQU    FALSE     ;ADDS VARIOUS OPIONS W/SENSE SW'S
  352. MAX$USER EQU    1    ;Highest user number supported
  353. MAX$DRIVE EQU    4    ;HIGHEST DRIVE SUPPORTED
  354. SPEED    EQU    4    ;Speed in Mhz of CPU (for timing loops)
  355. TIMEOUT EQU    TRUE    ;WANT AUTO LOG-OFF FOR SLEEPY CALLERS?
  356. TOVALUE EQU    5    ;THIS IS Time in MINUTES TO AUTO LOGOUT
  357. WARNING    EQU    TRUE    ;True to warn user about impending auto logout
  358. TMWARN    EQU    30    ;Number of seconds before auto logout to give warning
  359. RINGS    EQU    4    ;Numer of bells to give as warning (not same as CHAT)
  360. EXITFIL    EQU    TRUE    ;True to execute a COM file on auto logout
  361. CTIME    EQU    25    ;Number of seconds for carrier timeout (25 max)
  362. MAXDROP    EQU    25    ;Maximum number of allowable carrier losses
  363. WELFILE    EQU    TRUE    ;True if display of a welcome file required
  364. WELUSR    EQU    0    ;USER # THAT WELCOME FILE IS KEPT IN
  365. COMFILE EQU    TRUE    ;WANT TO AUTOBOOT A COM FILE?
  366. COMUSR    EQU    0    ;USER # THAT COMFILE IS KEPT IN
  367. DECIMAL EQU    TRUE    ;WANT DECIMAL VALUES FOR LOGS?
  368. CK$LWC    EQU    TRUE    ;WANT TO TRAP LOWER CASE?
  369. RTC    EQU    TRUE    ;True if Godbout System Support 1
  370. MOTOR    EQU    TRUE    ;True for motor control of drives
  371. INTER3    EQU    FALSE    ;True for Gobout Interfacer 3/4 I/O board
  372. FLIP    EQU    TRUE    ;Want to swap modem mode?
  373. RETIME    EQU    6    ;Time for remote modem to detect new carrier 
  374. RESTART    EQU    TRUE    ;True for trapping one RST vector
  375. RSVECT    EQU    038H    ;Address of restart vector to patch
  376. LENFCB    EQU    12    ;Length of filename to move for LODCOM
  377. ANSTRY    EQU    TRUE    ;True for logoff after fixed number of attempts
  378. ANSNUL    EQU    8    ;Number of tries at answer nulls question
  379. ANSCASE    EQU    3    ;Number of tries at answer case question
  380. ;
  381. ;
  382.     if    motor
  383. DISKON    EQU    0H    ;Turn drive motor on for YE-180
  384. DISKOFF    EQU    80H    ;Turn drive motor off for YE-180
  385. DISK    EQU    0C3H    ;For Godbout Disk 1
  386.     endif    ;motor
  387. ;
  388. ; SPECIAL KEYS FOR SPECIAL FUNCTIONS
  389. ;
  390. FKEYS    EQU    TRUE    ;WANT SPECIAL FUNCTION KEYS?
  391. ;
  392. ;ASSIGN FUNCTION KEYS TO THE FOLLOWING CONTROL CODES (IF USED):
  393. ;
  394. TWITKEY EQU    'N'-40H ;KEYCODE TO LOG-OUT A CREEP
  395. MSGKEY    EQU    'Q'-40H ;KEYCODE TO PRINT 'MESG FROM OPER:'
  396. SYSDKEY EQU    'O'-40H ;KEYCODE TO PRINT SYS DOWN MSG
  397. ;
  398. ;    FRONT-PANEL SELECTION OPTIONS
  399. ;
  400. SENSE    EQU    0FFH    ;SENSE SWITCH PORT NUMBER
  401. ;
  402. BLACKOUT EQU    TRUE    ;SWITCH TO TURN OFF REMOTE SEND
  403. HARDLOG EQU    FALSE    ;SWITCH TO ECHO REMOTE KBD TO PRINTER
  404. SELPASS EQU    TRUE     ;SWITCH TO REQUIRE A PASSWORD
  405. ;
  406. ;    ASSIGNMENT OF FRONT-PANEL OPTIONS TO SWITCHES:
  407. ;
  408. LOGSW    EQU    01H    ;TURN ON FOR HARDCOPY
  409. PWDSW    EQU    02H    ;TURN ON FOR 'PASSWORD' MODE
  410. BLACKSW EQU    04H    ;TURN ON TO BLACK OUT REMOTE END
  411. ENABLF    EQU    08H    ;TURN ON TO ENABLE SPL FUNC KEYS
  412. ;
  413. ;****************************************************
  414. ;*     END OF OPTION CONFIGURATION SECTION        *
  415. ;****************************************************
  416. ;
  417. ;ALL MODEM I/O AND CONTROL ARE HERE.
  418. ;
  419. ;************************************************
  420. ;*                        *
  421. ;*         2651 Baud Rate Table        *
  422. ;*                        *
  423. ;************************************************
  424. ;
  425. B50    EQU    0000B            ;50 bps
  426. B75    EQU    0001B            ;75 bps
  427. B110    EQU    0010B            ;110 bps
  428. B134    EQU    0011B            ;134.5 bps
  429. B150    EQU    0100B            ;150 bps
  430. B300    EQU    0101B            ;300 bps
  431. B600    EQU    0110B            ;600 bps
  432. B1200    EQU    0111B            ;1200 bps
  433. B1800    EQU    1000B            ;1800 bps
  434. B2000    EQU    1001B            ;2000 bps
  435. B2400    EQU    1010B            ;2400 bps
  436. B3600    EQU    1011B            ;3600 bps
  437. B4800    EQU    1100B            ;4800 bps
  438. B7200    EQU    1101B            ;7200 bps
  439. B9600    EQU    1110B            ;9600 bps
  440. B19200    EQU    1111B            ;19200 bps
  441.  
  442. ;************************************************
  443. ;*                        *
  444. ;*        2651 Equates            *
  445. ;*                        *
  446. ;************************************************
  447. ;
  448. BASE    EQU    05CH    ;2651 base port
  449. DATA    EQU    BASE    ;2651 data port
  450. STATUS    EQU    BASE+1    ;2651 status port
  451. MODE    EQU    BASE+2    ;2651 mode port
  452. CMMD    EQU    BASE+3    ;2651 command port
  453.  
  454.     if    inter3
  455. USER    EQU    BASE+7H    ;UART select port
  456. CONS    EQU    0    ;Console relative UART
  457. MODEM    EQU    6    ;Modem relative UART
  458.     endif    ;inter3
  459.  
  460. ;
  461. MODE1    EQU    01101110B        ;Asynch,16x,8 data bits,
  462.                     ; no parity, even, 1 stop bit
  463. MODE2    EQU    00110000B + B300    ;Baud rate
  464. CMMDB    EQU    00100111B        ;Tx enabled, RX enabled, no break
  465.                     ; DTR high, RTS high
  466. ;
  467. ; Status bits
  468. ;
  469. GBTBMT    equ    00000001b    ;Transmit buffer empty
  470. GBDAV    equ    00000010b    ;Data available
  471. GBTXE    equ    00000100b    ;Transmit shift reg empty
  472. GBPE    equ    00001000b    ;Parity error
  473. GBOE    equ    00010000b    ;Overrun error
  474. GBFE    equ    00100000b    ;Framing error
  475. GBCD    equ    01000000b    ;RS 232 Carrier Detect input
  476. GBDSR    equ    10000000b    ;RS 232 Data Set Ready input
  477. RING    EQU    GBDSR        ;Ring detect input
  478. ;
  479. ; Control bits
  480. ;
  481. GBTXEN    equ    00000001b    ;Transmitter enable
  482. GBDTR    equ    00000010b    ;DTR (CCITT 108) control
  483. GBRXEN    equ    00000100b    ;Receiver enable
  484. GBREAK    equ    00001000b    ;Send break
  485. ERESET    equ    00010000b    ;Error reset
  486. GBRTS    equ    00100000b    ;RTS control (used as mode select)
  487. ;
  488. ;
  489.     ORG    100H
  490. ;
  491. ;MOVE THE MODEM INTERFACE PROGRAM UP TO HI RAM
  492. ;AND JUMP TO IT.
  493. ;
  494. MOVEUP    LXI    B,PEND-START+1    ;NUMBER OF BYTES TO MOVE
  495.     LXI    H,DEST+PEND-START+1 ;END OF MOVED CODE
  496.     LXI    D,SOURCE+PEND-START    ;END OF SOURCE CODE
  497. MVLP    LDAX    D        ;GET BYTE
  498.     DCX    H        ;BUMP POINTERS
  499.     MOV    M,A        ;NEW HOME
  500.     DCX    D
  501.     DCX    B        ;BUMP BYTE COUNT
  502.     MOV    A,B        ;CHECK IF ZERO
  503.     ORA    C
  504.     JNZ    MVLP        ;IF NOT, DO SOME MORE
  505.  
  506.     PUSH    H        ;SAVE FOR LATER JUMP
  507.     MVI    A,0C3H        ;CLEAR ANY TRAPS SO SYSOP..
  508.     STA    0        ;CAN USER "BYE /A"
  509.     XRA    A        ;NEXT WARMBOOT TO USR0/DRV A
  510.     STA    4
  511.     MVI    C,14        ;MAKE DRIVE A DEFAULT
  512.     MOV    E,A        ;LOG-IN DRIVE CP/M FUNCTION
  513.     CALL    BDOS
  514.     MVI    C,32        ;GET/SET USR CP/M FUNCTION
  515.     MVI    E,WELUSR
  516.     CALL    BDOS
  517.     RET            ;TO ADRS PUSHED ABOVE
  518. ;
  519. VMSG:    DB    'BYE version '
  520.     DB    VER/10 + '0','.',(VER MOD 10) + '0',REV
  521.     DB    ' of '
  522.     if    month = 1
  523.     DB    'January'
  524.     endif
  525.     if    month = 2
  526.     DB    'February'
  527.     endif
  528.     if    month = 3
  529.     DB    'March'
  530.     endif
  531.     if    month = 4
  532.     DB    'April'
  533.     endif
  534.     if    month = 5
  535.     DB    'May'
  536.     endif
  537.     if    month = 6
  538.     DB    'June'
  539.     endif
  540.     if    month = 7
  541.     DB    'July'
  542.     endif
  543.     if    month = 8
  544.     DB    'August'
  545.     endif
  546.     if    month = 9
  547.     DB    'September'
  548.     endif
  549.     if    month = 10
  550.     DB    'October'
  551.     endif
  552.     if    month = 11
  553.     DB    'November'
  554.     endif
  555.     if    month = 12
  556.     DB    'December'
  557.     endif
  558.  
  559.     DB    ' ',DAY/10 +'0',(DAY MOD 10) + '0'
  560.     DB    ', 19',YEARS/10 + '0', (YEARS MOD 10) + '0',CR,LF,'$'
  561. ;
  562. SOURCE    EQU    $    ;BOUNDARY MEMORY MARKER
  563. ;
  564. OFFSET    EQU    DEST-SOURCE ;RELOC AMOUNT
  565. ;-----------------------------------------------;
  566. ;    THE FOLLOWING CODE GETS MOVED        ;
  567. ;     TO HI RAM LOCATED AT "DEST",        ;
  568. ;        WHERE IT IS EXECUTED.        ;
  569. ;-----------------------------------------------;
  570. ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  571. ;XX   C A U T I O N :  IF MODIFYING ANYTHING    XX
  572. ;XX    IN THIS PROGRAM FROM HERE ON:        XX
  573. ;XX    A-L-L  LABELS MUST BE OF THE FORM:    XX
  574. ;XX    label    EQU    $+OFFSET        XX
  575. ;XX    IN ORDER THAT THE RELOCATION TO HI RAM    XX
  576. ;XX    WORK SUCCESSFULLY.  FORGETTING TO    XX
  577. ;XX    SPECIFY '$+OFFSET' WILL CAUSE THE PRO-    XX
  578. ;XX    GRAM TO JMP INTO WHATEVER IS CURRENTLY    XX
  579. ;XX    IN LOW MEMORY, WITH UNPREDICTABLE    XX
  580. ;XX    RESULTS.  BE CAREFUL....        XX
  581. ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  582. ;
  583. ;    IF CARRIER LOST, HANG UP, AWAIT RING.
  584. ;    OTHERWISE, SAY GOODBYE, AND HANG UP
  585. ;
  586. START    EQU    $+OFFSET
  587. ;
  588.     XRA    A        ;GET 0
  589.     STA    LOSTFLG        ;SHOW NO CARR. LOST
  590.     STA    TOUT
  591.     STA    BYEFLG        ;Reset the "left BYE" flag
  592. ;
  593. ;    DON'T ALLOW A REMOTE USER TO DO 'BYE /A'
  594. ;
  595.     if    inter3
  596.     mvi    a,modem
  597.     out    user        ;Select modem UART
  598.     endif    ;inter3
  599.  
  600.     IN    STATUS
  601.     ANI    GBCD        ;Carrier?
  602.     JNZ    GOODBY        ;Yes, remote user so say goodbye
  603.  
  604. ;
  605. ;Indentify version of program
  606. ;
  607.     mvi    c,printf
  608.     lxi    d,vmsg
  609.     call    bdos
  610. ;
  611. ;CHECK FOR /A OPTION ON COMMAND - REQUEST TO
  612. ;GO IMMEDIATELY INTO ANSWER MODE
  613. ;
  614.     LXI    H,FCB+1        ;TO OPTION
  615.     MOV    A,M
  616.     CPI    '/'        ;OPTION?
  617.     JNZ    HANGUP
  618. ;GOT AN OPTION - VALIDATE IT
  619.     INX    H        ;TO OPTION BYTE
  620.     MOV    A,M        ;GET IT
  621.     STA    OPTION        ;MIGHT NEED LATER
  622.     CPI    'A'        ;ANSWER?
  623.     JZ    ANSWER
  624.  
  625.     if    comfile
  626.     CPI    'C'
  627.     JZ    ANSWER
  628.     endif    ;comfile
  629.  
  630.     if    usrlog        ;CHECK FOR RESET OF COUNTERS
  631.     CPI    'R'
  632.     CZ    RESET
  633.     endif    ;usrlog
  634.  
  635.     JMP    HANGUP        ;WE KNOW IT'S LOCAL, SO SKIP CALL TO CARCK
  636.  
  637. ;NO OPTION, OR INVALID ONE
  638. NOSLASH EQU    $+OFFSET
  639.     CALL    CARCK        ;SIGNED OFF W/THIS PROG?
  640.     JC    HANGUP        ;NOBODY THERE
  641. ;
  642. GOODBY    EQU    $+OFFSET
  643. UNDO    EQU    $+OFFSET
  644.     CALL    ILPRT        ;PRINT THIS MSG:
  645. ;
  646.     DB    CR,LF,'GOOD BYE, CALL AGAIN'
  647. ;
  648.     if    rtc
  649. ;
  650.     db    CR,LF,CR,LF,'Off at ',0
  651. ;
  652.     call    time
  653.     endif    ;RTC
  654.  
  655.     call    ilprt
  656. ;
  657.     DB    CR,LF,0
  658. ;
  659.     CALL    UNPATCH     ;UNDO BIOS PATCHES
  660. ;
  661. ;    NOBODY THERE, OR WE ARE DONE, SO HANG UP
  662. ;
  663. HANGUP    EQU    $+OFFSET
  664.     LXI    SP,STACK    ;SET UP LOCAL STACK
  665.     XRA    A         ;FORCE NEXT WARMBOOT TO USER 0
  666.     STA    4         ;AND DRIVE A
  667.     MVI    C,14         ;MAKE DRIVE A DEFAULT
  668.     MOV    E,A
  669.     CALL    BDOS
  670.     MVI    A,' '        ;DON'T ALLOW OPTIONS..
  671.     STA    OPTION        ;..AFTER 1 "BYE / <ANYTHING>"
  672.  
  673.     if    comfile
  674.     MVI    C,32        ;GET/SET USER CODE
  675.     MVI    E,COMUSR    ;LOCATION OF OUR COMFILE
  676.     CALL    BDOS
  677.     CALL    LODCOM        ;LOAD THE COM FILE
  678.     endif    ;comfile
  679.  
  680.     if    restart
  681.     MVI    A,0C3H        ;Set up restart 7 trap
  682.     STA    RSVECT        ; to do a warm boot
  683.     XRA    A
  684.     STA    RSVECT+1
  685.     STA    RSVECT+2
  686.     endif    ;restart
  687. ;
  688. ;
  689. HANGUP2    EQU    $+OFFSET
  690. ;
  691.  
  692.     if    motor
  693.     CALL    DSKOFF
  694.     endif    ;motor
  695.  
  696. ;CLEAR DTR CAUSING PHONE TO HANG UP AND RESET BAUD
  697. ;RATE ON USART IN CASE IT GOT CHANGED
  698.  
  699.     if    inter3
  700.     mvi    a,modem
  701.     out    user        ;Select modem UART
  702.     endif    ;inter3
  703.  
  704.     MVI    A,MODE1
  705.     OUT    MODE
  706.     MVI    A,MODE2
  707.     OUT    MODE
  708.     MVI    A,GBRTS        ;Turn off DTR, Tx and Rx enable, break,
  709.     OUT    CMMD        ; reset and test modes (but not RTS)
  710.     push    b
  711.     mvi    b,10        ;1 second delay
  712.  
  713. OFFTI    EQU    $+OFFSET
  714.     call    delay
  715.     dcr    b
  716.     jnz    offti
  717.     pop    b
  718.     mvi    a,cmmdb        ;Enable Tx, Rx, DTR, RTS
  719.     out    cmmd
  720.     MVI    A,0C3H        ;CLEAR ANY TRAPS..
  721.     STA    0        ;..LEFT FROM COM FILE
  722.     XRA    A
  723.     STA    DROPOUT        ;Initialise count of carrier losses
  724. ;
  725. ;    AWAIT RINGING
  726. ;
  727. ;CHECK LOCAL KEYBOARD FOR CTL-C EXIT REQUEST.
  728. ;NOTE: MUST DO DIRECT INPUT BECAUSE CBIOS PATCHES
  729. ;ARE NOT DONE UNTIL CALL COMES IN.
  730. ;
  731. RINGWT    EQU    $+OFFSET
  732.     CALL    UCSTS
  733.     ANI    7FH        ;STRIP PARITY BIT
  734.     CPI    'C'-40H        ;CONTROL C?
  735.  
  736.     if    motor
  737.     CZ    DSKON
  738.     endif    ;motor
  739.  
  740.     if    NOT USRLOG
  741.     JZ    0        ;YES, --EXIT-- TO CP/M
  742.     endif    ;NOT USRLOG
  743. ;
  744.     if    USRLOG        ;PRINT OUT USER INFO
  745.     cz    usrchk
  746.     endif    ;USRLOG
  747. ;
  748. ;SETUP MODEM
  749. ;
  750. ANSWER    EQU    $+OFFSET
  751.     if    inter3
  752.     mvi    a,modem
  753.     out    user        ;Select modem UART
  754.     endif    ;inter3
  755.  
  756.     MVI    A,CMMDB        ;TURN ON
  757.     OUT    CMMD        ;..DTR
  758.     CALL    DELAY        ;GIVE TIME FOR ANSWER
  759.     CALL    UCSTS        ;CLEAR LOCAL CONSOLE
  760.     IN    DATA        ;CLEAR MODEM PORT
  761.     CALL    MRESET        ;Reset any modem UART errors
  762.     CALL    CARCK        ;LOOK FOR CARRIER
  763.     JC    HANGUP2        ;Not found
  764.     CALL    PATCH        ;PATCH JMP TABLE
  765.     JMP    WELCOME
  766. ;
  767. ;    Get the console status when unpatched
  768. ;
  769. UCSTS    EQU    $+OFFSET
  770.     MVI    C,DIRECTIO    ;DIRECT I/O CALL WILL RETURN
  771.     MVI    E,0FFH        ;ASK FOR INPUT
  772.     CALL    BDOS           ;A=0 IF NO CHAR WAITING
  773.     RET
  774. ;
  775. ;
  776. ;FOLLOWING ARE THE USRLOG ROUTINES
  777. ;
  778.     if    usrlog        ;INCLUDE RESET FUNCTIONS
  779. RESET    EQU    $+OFFSET    ;RESET ALL LOGON COUNTERS
  780.     lxi    h,0
  781.     endif    ;usrlog
  782.  
  783.     if    usrlog
  784.     shld    ATTUSR        ;RESET ATTEMPT COUNTER
  785.     endif    ;usrlog
  786.  
  787.     if    usrlog
  788.     shld    NEWUSR        ;RESET LOGON COUNTER
  789.     endif    ;usrlog
  790.  
  791.     if    usrlog and actime
  792.     shld    INACT        ;Reset inactivity logout timer
  793.     endif    ;usrlog and actime
  794.  
  795.     if    usrlog and imsai
  796.     mvi    a,0ffh
  797.     OUT    SENSE        ;RESET IMSAI PANEL DISPLAY
  798.     endif    ;usrlog and imsai
  799.  
  800.     if    usrlog
  801.     RET
  802.     endif    ;usrlog
  803. ;
  804. MCBOOT    equ    $+offset
  805.     jmp    mboot
  806. ;
  807. ;See comments above, PRNLOG must begin here
  808. ;
  809. PRNLOG    EQU    $+OFFSET
  810. ;
  811.     if    usrlog        ;PRINT # OF LOGON ATTEMPTS
  812.     MVI    C,printf
  813.     LXI    D,ATMSG
  814.     CALL    BDOS
  815.     lxi    h,ATTUSR+1    ;point to high byte
  816.     CALL    HXOUT
  817.     endif    ;usrlog
  818. ;
  819.     if    usrlog        ;PRINT # OF LOGONS
  820.     MVI    C,printf
  821.     LXI    D,SUMSG
  822.     CALL    BDOS
  823.     lxi    h,newusr+1
  824.     CALL    HXOUT
  825.     endif    ;usrlog
  826.  
  827.     if    usrlog and actime
  828.     MVI    C,printf    ;Print number of inactivity timeouts
  829.     LXI    D,ACTMSG
  830.     CALL    BDOS
  831.     lxi    h,INACT+1
  832.     CALL    HXOUT
  833.     endif    ;usrlog and actime
  834.  
  835.     RET
  836.  
  837.     if    usrlog
  838. USRCHK    equ    $+offset
  839.     call    prnlog        ;give info
  840.     mvi    c,printf
  841.     lxi    d,rs1msg
  842.     call    bdos        ;prompt for resume bye
  843. PRNREL    equ    $+offset
  844.     call    ucsts        ;get reply
  845.     ora    a
  846.     jz    prnrel
  847.     cpi    'R'        ;R for resume?
  848.     jz    prnres        ;yes
  849.     cpi    'R'+20H        ;lower case also
  850.     jnz    0        ;no, warm boot
  851. PRNRES    equ    $+offset
  852.     mvi    c,printf
  853.     lxi    d,rs2msg
  854.     jmp    bdos        ;resume via bdos after message
  855. ;
  856. ;BOPLOG increments the 16 bit counter pointed to by HL
  857. ;If decimal switch is active, number is kept as 4 BCD digits
  858. ;
  859. BOPLOG    equ    $+offset
  860.     mov    a,m        ;get low byte
  861.     adi    1
  862.     endif    ;usrlog
  863.  
  864.     if    usrlog and decimal
  865.     daa
  866.     endif    ;usrlog and decimal
  867.  
  868.     if    usrlog
  869.     mov    m,a        ;replace low order
  870.     rnc            ;if no carry, BOP done
  871.     inx    h        ; else carry to high byte
  872.     mov    a,m        ;get high byte
  873.     adi    1
  874.     endif    ;usrlog
  875.  
  876.     if    usrlog and decimal
  877.     daa
  878.     endif    ;usrlog and decimal
  879.  
  880.     if    usrlog
  881.     mov    m,a        ;replace high byte
  882.     ret
  883.      endif    ;usrlog
  884. ;
  885.  
  886.     if    usrlog
  887. ATMSG    EQU    $+OFFSET
  888.     DB    CR,LF,'Attempted  Logons : $'
  889.     endif    ;usrlog
  890.  
  891.     if    usrlog
  892. SUMSG    EQU    $+OFFSET
  893.     DB    CR,LF,'Successful Logons : $'
  894.     endif    ;usrlog
  895.  
  896.     if    usrlog and actime
  897. ACTMSG    EQU    $+OFFSET
  898.     DB    CR,LF,'Activity Timeouts : $'
  899.     endif    ;usrlog and actime
  900.  
  901.     if    usrlog
  902. RS1MSG    equ    $+offset
  903.     DB    CR,LF,CR,LF,'Type R to Resume,'
  904.     DB    ' anything else to Warm Boot: $'
  905.  
  906. RS2MSG    equ    $+offset
  907.     DB    'Resuming . . .',CR,LF,CR,LF,'$'
  908.     endif    ;usrlog
  909.     
  910.     if    usrlog
  911. HXOUT    EQU    $+OFFSET
  912.     push    h        ;save pointer
  913.     call    hxhaf        ;do high byte first
  914.     pop    h
  915.     dcx    h        ;point to low byte
  916.  
  917. HXHAF    equ    $+offset
  918.     mov    a,m
  919.     MOV    B,A        ;SAVE NUMBER
  920.     RAR            ;ROTATE RIGHT 4 BITS
  921.     RAR            ;TO MAKE AN ASCII DIGIT
  922.     RAR
  923.     RAR
  924.     CALL    ONEOUT        ;OUTPUT MSH TO CONSOLE
  925.     MOV    A,B        ;GET NUMBER BACK
  926.  
  927. ONEOUT    EQU    $+OFFSET
  928.     ANI    0FH        ;GET LSH FOR OUTPUT
  929.     adi    90h
  930.     daa
  931.     aci    40h
  932.     daa
  933.     PUSH    B
  934.     MVI    C,02H
  935.     MOV    E,A        ;OUTPUT THE NUMBER
  936.     CALL    BDOS
  937.     POP    B
  938.     RET
  939.     endif    ;usrlog
  940. ;
  941. ;WELCOME TO THE SYSTEM
  942. ;
  943. WELCOME    EQU    $+OFFSET
  944. ;
  945.     if    usrlog        ;COUNT # OF LOGON ATTEMPTS
  946.     lxi    h,ATTUSR    ;GET # OF ATTEPMTS
  947.     call    boplog        ;ADD THIS CALL
  948.     endif    ;usrlog
  949. ;
  950.     if    anstry
  951.     MVI    A,ANSNUL+1    ;SET UP COUNT FOR MAX ANSWER TRIES
  952.     STA    COUNT
  953.     endif    ;anstry
  954.         
  955. GETNULL EQU    $+OFFSET
  956.     if    anstry
  957.     LDA    COUNT
  958.     DCR    A        ;Max number of tries?
  959.     JZ    UNDO        ;Yes, exit
  960.     STA    COUNT        ;No
  961.     endif    ;anstry
  962.  
  963.     if    motor
  964.     CALL    DSKON
  965.     endif    ;motor
  966.  
  967.     CALL    ILPRT        ;PRINT THIS MSG:
  968. ;
  969.     DB    CR,LF
  970.     DB    'HOW MANY NULLS (0-9) DO YOU NEED? ',0
  971. ;
  972.     CALL    MINPUT        ;GET VALUE
  973.     MOV    C,A
  974.     CALL    MOUTPUT     ;ECHO CHAR
  975.     MOV    A,C
  976.     CPI    '0'
  977.     JC    GETNULL        ;BAD, RETRY
  978.     CPI    '9'+1
  979.     JNC    GETNULL        ;BAD
  980.     SUI    '0'        ;MAKE BINARY
  981.     STA    NULLS        ;SAVE COUNT
  982. ;
  983.     if    ck$lwc
  984.     if    anstry
  985.     MVI    A,ANSCASE+1
  986.     STA    COUNT
  987.     endif    ;anstry
  988.  
  989. GETULC    EQU    $+OFFSET
  990.     if    anstry
  991.     LDA    COUNT
  992.     DCR    A        ;Max number of tries?
  993.     JZ    UNDO        ;Yes, exit
  994.     STA    COUNT        ;No
  995.     endif    ;anstry
  996.  
  997.     CALL    ILPRT        ;NOW, PRINT THIS MSG:
  998. ;
  999.     DB    CR,LF
  1000.     DB    'CAN YOUR TERMINAL DISPLAY LOWER CASE? ',0
  1001. ;
  1002.     MVI    A,20H        ;FORCE CASE CONVERSION FOR NOW
  1003.     STA    ULCSW
  1004.     CALL    MINPUT        ;GET Y OR N
  1005.     MOV    C,A
  1006.     CALL    MOUTPUT     ;ECHO
  1007.     MOV    A,C
  1008.     CPI    'N'
  1009.     JZ    DONEOPT     ;WE'RE ALREADY SET UP FOR NO LWR CASE
  1010.     CPI    'Y'
  1011.     JNZ    GETULC        ;WASN'T Y OR N...ASK HIM AGAIN
  1012.     XRA    A
  1013.     STA    ULCSW        ;SET FLAG FOR NO CONVERSION
  1014. ;
  1015. DONEOPT EQU    $+OFFSET
  1016.     endif    ;ck$lwc
  1017. ;
  1018.     if    flip
  1019.     if    anstry
  1020.     MVI    A,ANSCASE+1
  1021.     STA    COUNT
  1022.     endif    ;anstry
  1023.  
  1024. FLIPMD    EQU    $ + OFFSET
  1025.     if    anstry
  1026.     LDA    COUNT
  1027.     DCR    A        ;Max number of tries?
  1028.     JZ    UNDO        ;Yes, exit
  1029.     STA    COUNT        ;No
  1030.     endif    ;anstry
  1031.  
  1032.     CALL    ILPRT
  1033. ;
  1034.     DB    CR,LF
  1035.     DB    'DO YOU  WANT TO "FLIP" THE MODEM MODE ? ',0
  1036. ;
  1037.     CALL    MINPUT        ;GET Y OR N
  1038.     ANI    05FH        ;Make upper case
  1039.     MOV    C,A
  1040.     CALL    MOUTPUT     ;ECHO
  1041.     MOV    A,C
  1042.     CPI    'N'        ;NO?
  1043.     JZ    DONEFLP     ;OK, NO CHANGE
  1044.     CPI    'Y'
  1045.     JNZ    FLIPMD        ;WASN'T Y OR N...ASK HIM AGAIN
  1046.     CALL    ILPRT
  1047. ;
  1048.     DB    CR,LF,CR,LF
  1049.     DB    'If  you answer "Y" to the next question you have 20 seconds to',CR,LF
  1050.     DB    'switch your  modem to the "ANSWER"  mode.  If you change  mode',CR,LF
  1051.     DB    'now,  you  CAN''T  change  back until you get to  CP/M  command',CR,LF
  1052.     DB    'level.'
  1053.     DB    CR,LF,0
  1054. ;
  1055.     if    anstry
  1056.     MVI    A,ANSCASE+1
  1057.     STA    COUNT
  1058.     endif    ;anstry
  1059.  
  1060. FLIPLP    EQU    $ + OFFSET
  1061.     if    anstry
  1062.     LDA    COUNT
  1063.     DCR    A        ;Max number of tries?
  1064.     JZ    UNDO        ;Yes, exit
  1065.     STA    COUNT        ;No
  1066.     endif    ;anstry
  1067.  
  1068.     CALL    ILPRT
  1069. ;
  1070.     DB    CR,LF
  1071.     DB    'DO YOU WANT TO CHANGE TO "ANSWER" MODE ? ',0
  1072. ;
  1073.     CALL    MINPUT        ;GET Y OR N
  1074.     ANI    05FH        ;Make upper case
  1075.     MOV    C,A
  1076.     CALL    MOUTPUT     ;ECHO
  1077.     MOV    A,C
  1078.     CPI    'N'        ;NO?
  1079.     JZ    NOCHNG         ;OK, NO CHANGE
  1080.     CPI    'Y'
  1081.     JNZ    FLIPLP        ;WASN'T Y OR N...ASK HIM AGAIN
  1082. ;
  1083. ;SET MODEM FOR DTR ON & ORIGINATE
  1084. ;
  1085.     if    inter3
  1086.     mvi    a,modem
  1087.     out    user        ;Select modem UART
  1088.     endif    ;inter3
  1089.  
  1090.     IN    CMMD        ;Get the current mode
  1091.     XRI    GBRTS        ;Toggle the bit
  1092.     OUT    CMMD        ;Flip the mode
  1093.     CALL    CARCK        ;Wait for carrier
  1094.     MVI    B,RETIME*10
  1095. FLLOOP    EQU    $ + OFFSET
  1096.     CALL    DELAY        ;Let remote modem detect carrier
  1097.     DCR    B        ;Remote modem ready yet?
  1098.     JNZ    FLLOOP        ;No
  1099.     CALL    ILPRT        ;Yes
  1100. ;
  1101.     DB    CR,LF,CR,LF
  1102.     DB    'If you see this, the mode change was successful.'
  1103.     DB    CR,LF,0
  1104. ;
  1105.     JMP    DONEFLP
  1106. ;
  1107. NOCHNG    EQU    $ + OFFSET
  1108.     CALL    ILPRT
  1109. ;
  1110.     DB    CR,LF,CR,LF
  1111.     DB    'OK, NO CHANGE IN MODE',CR,LF,0
  1112. ;
  1113. DONEFLP    EQU    $ +OFFSET
  1114.     endif    ;flip
  1115. ;
  1116.     CALL    ILPRT
  1117. ;
  1118.     DB    CR,LF,CR,LF,0
  1119. ;
  1120. ;PRINT THE WELCOME FILE
  1121. ;
  1122.     if    welfile
  1123.     LXI    H,WELFILN     ;SOURCE
  1124.     LXI    D,FCB        ;DESTINATION
  1125.     MVI    B,13        ;LENGTH
  1126.     CALL    MOVE        ;MOVE THE NAME
  1127. ;SET DMA ADDR TO 80H
  1128.     LXI    D,80H
  1129.     MVI    C,STDMA
  1130.     CALL    BDOS
  1131. ;
  1132. ;SET USER FOR WELCOME FILE
  1133.     MVI    C,32
  1134.     MVI    E,WELUSR
  1135.     CALL    BDOS
  1136. ;
  1137. ;OPEN THE WELCOME FILE
  1138.     LXI    D,FCB
  1139.     MVI    C,OPEN
  1140.     CALL    BDOS
  1141. ;DID IT EXIST?
  1142.     INR    A        ;A=> 0 MEANS "NO"
  1143.     JZ    PASSINT     ;NO WELCOME FILE
  1144. ;GOT A FILE, TYPE IT
  1145.     XRA    A        ;GET 0
  1146.     STA    FCBRNO        ;ZERO RECORD #
  1147.     LXI    H,100H        ;GET INITIAL BUFF POINTER
  1148. ;TYPE THE WELCOME FILE
  1149. WELTYLP EQU    $+OFFSET
  1150.     CALL    RDBYTE        ;GET A BYTE
  1151.     CPI    1AH        ;EOF?
  1152.     JZ    PASSINT     ;YES, DONE
  1153.     MOV    C,A        ;SETUP FOR TYPE
  1154.     CALL    MOUTPUT     ;TYPE THE CHAR
  1155.     CALL    MSTAT        ;CHECK FOR..
  1156.     ORA    A        ;CHAR TYPED?
  1157.     JZ    WELTYLP     ;..NO, LOOP
  1158.     CALL    MINPUT        ;..YES, GET CHAR
  1159.     CPI    'C'-40H     ;CTL-C?
  1160.     JNZ    WELTYLP     ;..NO, LOOP UNTIL EOF
  1161.     endif    ;welfile
  1162. ;
  1163. ;GET THE PASSWORD
  1164. ;
  1165. PASSINT EQU    $+OFFSET
  1166. ;
  1167. ;
  1168.     if    pwrqd and imsai and selpass 
  1169.     IN    SENSE        ;TURN THE SWITCH UP..
  1170.     ANI    PWDSW        ;..TO REQUIRE THE PASSWORD
  1171.     JZ    NOPASS
  1172.     endif    ;pwrqd and imsai and selpass
  1173.  
  1174.     if    pwrqd
  1175.     MVI    D,5        ;5 TRIES AT PASSWORD
  1176. PASSINP EQU    $+OFFSET
  1177.     CALL    ILPRT
  1178. ;
  1179.     DB    CR,LF,'ENTER PASSWORD: ',0
  1180. ;
  1181.     LXI    H,PASSWD    ;POINT TO PASSWORD
  1182.     MVI    E,0        ;NO MISSED LETTERS
  1183.  
  1184.     if    inter3
  1185.     mvi    a,modem
  1186.     out    user        ;Select modem UART
  1187.     endif    ;inter3
  1188.  
  1189.     IN    DATA        ;CLEAR OUT GARBAGE
  1190. PWMLP    EQU    $+OFFSET
  1191.     CALL    MINPUT        ;GET A CHAR
  1192.     CPI    60H        ;LOWER CASE?
  1193.     JC    NOTLC        ;NO,
  1194.     ANI    5FH        ;MAKE UPPER CASE ALPHA
  1195.  
  1196.     if    dual$io
  1197.     push    psw        ;save chararcter
  1198.     cpi    ' '        ;control?
  1199.     jnc    pwdis        ;no, display it
  1200.     mvi    c,'^'        ;yes, prefix it
  1201.     call    conout
  1202.     pop    psw
  1203.     push    psw
  1204.     adi    40h
  1205. pwdis    equ    $+offset
  1206.     mov    c,a
  1207.     call    conout
  1208.     pop    psw
  1209.     endif    ;dual$io
  1210.     
  1211.     cpi    'U'-40h        ;Control-U?
  1212.     jz    passinp        ;Yes, another try
  1213.     CMP    M        ;MATCH PASSWORD?
  1214.     JZ    PWMAT        ;..YES
  1215.     MVI    E,1        ;..NO, SHOW MISS
  1216.     CPI    CR        ;C/R?
  1217.     JNZ    PWMLP        ;..NO, WAIT FOR C/R
  1218. ;
  1219. ;PASSWORD DIDN'T MATCH
  1220. ;
  1221. PWNMAT    EQU    $+OFFSET
  1222.     CALL    ILPRT
  1223. ;
  1224.     DB    '++INCORRECT++',CR,LF,0
  1225. ;
  1226.     DCR    D        ;MORE TRIES?
  1227.     JNZ    PASSINP     ;YES
  1228.     JMP    BADPASS     ;NO, GO HANG UP
  1229. ;
  1230. ;CHARACTER MATCHED IN PASSWORD
  1231. ;
  1232. PWMAT    EQU    $+OFFSET
  1233.     INX    H        ;TO NEXT CHAR
  1234.     CPI    CR        ;END?
  1235.     JNZ    PWMLP        ;..NO, LOOP
  1236. ;END OF PASSWORD.  ANY MISSED CHARS?
  1237.     MOV    A,E        ;GET FLAG
  1238.     ORA    A
  1239.     JNZ    PWNMAT        ;NOT RIGHT
  1240. ;PASSWORD CORRECT
  1241.     endif    ;pwrqd
  1242.  
  1243. NOPASS    EQU    $+OFFSET
  1244.  
  1245.     if    rtc
  1246.     call    ilprt
  1247. ;
  1248.     db    CR,LF,CR,LF,'On system at ',0
  1249. ;
  1250.     call    time
  1251.     call    ilprt
  1252. ;
  1253.     db    CR,LF,0
  1254. ;
  1255.     endif    ;rtc
  1256.  
  1257.     if    usrlog        ;COUNT # OF SUCCESSFUL LOGONS
  1258.     lxi    h,NEWUSR    ;GET LAST VALUE
  1259.     call    boplog        ;add one
  1260.     endif    ;usrlog
  1261.  
  1262.     if    usrlog and imsai    ;DISPLAY ON IMSAI
  1263.     lda    newusr        ;re-get low order value
  1264.     CMA            ;invert for lights
  1265.     OUT    SENSE        ;DISPLAY ON IMSAI FRONT PANEL
  1266.     endif    ;usrlog and imsai
  1267.  
  1268.     CALL    ILPRT
  1269. ;
  1270. ;
  1271.     DB    CR,LF,'Please wait a moment . . .',CR,LF,CR,LF,0
  1272. ;               ^^^^^^^^^^^^^^^^^^^^^^^^^^etc
  1273. ;            PUT BOOT-UP MSG HERE
  1274. ;
  1275.     if    comfile
  1276.     MVI    C,32
  1277.     MVI    E,COMUSR    ;SWITCH TO COM FILE USER #
  1278.     CALL    BDOS
  1279.     MVI    A,0FFH
  1280.     STA    BYEFLG
  1281.     LDA    OPTION
  1282.     CPI    'A'        ;SYSOP CAN BYPASS COM FILE BY..
  1283.     JZ    0        ;..TYPING "BYE /A"
  1284.     CPI    'C'        ;OPER CAN ALSO GO TO COM..
  1285.     JNZ    100H        ;..FILE LOAD WITH "BYE /C"
  1286.     CALL    ILPRT        ;PRINT THIS MESSAGE
  1287. ;
  1288.     DB    'Loading system...',CR,LF,0
  1289. ;
  1290.     CALL    LODCOM
  1291.     JMP    100H        ;EVERYONE ELSE GETS COM FILE
  1292.     endif    ;comfile
  1293.  
  1294.     if    not comfile
  1295.     MVI    A,0FFH
  1296.     STA    BYEFLG
  1297.     JMP    0
  1298.     endif    ;not comfile
  1299. ;
  1300. CARCK    EQU    $+OFFSET
  1301. ;    LOSS OF CONNECTION TEST
  1302. ;
  1303. ;IF WE DETECT THAT THERE IS NO CARRIER UPON ENTRY TO
  1304. ;THIS ROUTINE, WE'LL KEEP CHECKING FOR 25 SECONDS TO SEE IF THE
  1305. ;CARRIER RETURNS. IF SO, WE'LL JUST CONTINUE ON. IF NOT, WE'LL
  1306. ;SIGNAL THIS BY SETTING THE CARRY FLAG.
  1307. ;
  1308.     if    inter3
  1309.     mvi    a,modem
  1310.     out    user        ;Select modem UART
  1311.     endif    ;inter3
  1312.  
  1313.     IN    STATUS        ;GET MODEM STATUS
  1314.     ANI    GBCD        ;GOT A CARRIER?
  1315.     JNZ    CARCK2        ;YES, GO ON WITH TESTS
  1316.     LDA    DROPOUT        ;Get dropout count
  1317.     ADI    1        ;Increment it
  1318.     CPI    MAXDROP        ;Bad line?
  1319.     JZ    BADPASS        ;Yes, reset system
  1320.     STA    DROPOUT        ;Save for later
  1321.     PUSH    B        ;PRESERVE BC SO WE CAN USE IT
  1322.     MVI    B,CTIME*10    ;Initialise timeout value
  1323. CARLP    EQU    $+OFFSET
  1324.     CALL    DELAY        ;WAIT .1 SECONDS
  1325.     IN    STATUS
  1326.     ANI    RING        ;Phone ringing?
  1327.     JZ    NO$RING        ;No
  1328.     MVI    B,CTIME*10    ;Yes, reintialise count
  1329. NO$RING    EQU    $+OFFSET
  1330.     IN    STATUS        ;GET MODEM STATUS
  1331.     ANI    GBCD        ;HAS CARRIER RETURNED?
  1332.     MOV    A,B        ;PRESERVE COUNTDOWN VALUE
  1333.     POP    B        ;FIX STACK IN CASE ALL IS OK
  1334.     JNZ    CARCK2        ;GOT CARRIER, CONTINUE ON
  1335.     DCR    A        ;COUNT TIME DOWN
  1336.     STC            ;IN CASE THIS IS THE END OF TIME
  1337.     RZ            ;RETURN IF TIMED OUT
  1338.     PUSH    B        ;PRESERVE B
  1339.     MOV    B,A        ;GET COUNTER VALUE IN B
  1340.     JMP    CARLP        ;KEEP CHECKING
  1341. ;
  1342. ;    NOW TEST DRIVE #'S AND (IF CPM 2.X)
  1343. ;    USER #'S TO INSURE THAT MAXIMUMS
  1344. ;    ARE NOT EXCEEDED
  1345. ;
  1346. CARCK2    EQU    $+OFFSET
  1347.     LDA    4        ;CHECK DISK/USER #
  1348.     ANI    0FH        ;ISOLATE DRIVE
  1349.     CPI    MAX$DRIVE    ;VALID DRIVE?
  1350.     JC    CARCK3        ;YES, SKIP THIS JUNK
  1351.     LDA    4        ;RESTORE WHOLE LOGIN BYTE
  1352.     ANI    0F0H        ;RETAIN USER #
  1353.     STA    4        ;FORCE DRIVE TO A
  1354.     CALL    ILPRT        ;TELL USER WHAT HE DID
  1355. ;
  1356.     DB    'INVALID DRIVE - RETURNING TO A:',0
  1357. ;
  1358.     JMP    0        ;FORCE WARM BOOT
  1359.  
  1360. CARCK3    EQU    $+OFFSET
  1361. ;
  1362.     LDA    4        ;REFRESH LOGIN BYTE AGAIN
  1363.     ANI    0F0H        ;ISOLATE USER #
  1364.     CPI    MAX$USER*16+1    ;VALID USER #?
  1365.     JC    CARCK4        ;YES, DON'T CHANGE
  1366.     LDA    4        ;GET BACK LOGIN BYTE
  1367.     ANI    0FH        ;KEEP DRIVE, ZERO USER
  1368.     STA    4
  1369.     CALL    ILPRT        ;TELL HIM WHAT HAPPENED
  1370. ;
  1371.     DB    'INVALID USER NUMBER - RETURNING TO 0',0
  1372. ;
  1373.     JMP    0        ;FORCE WARM BOOT
  1374. ;
  1375. CARCK4    EQU    $+OFFSET
  1376.     ORA    A
  1377.     RET
  1378. ;
  1379. ;    .1 SEC DELAY ROUTINE
  1380. ;
  1381. DELAY    EQU    $+OFFSET
  1382.     PUSH    B
  1383.     LXI    B,SPEED*4167     ;TIMING CONSTANT
  1384. ;
  1385. DELAY1    EQU    $+OFFSET
  1386.     DCX    B
  1387.     MOV    A,B
  1388.     ORA    C
  1389.     JNZ    DELAY1
  1390.     POP    B
  1391.     RET
  1392. ;
  1393. ;PATCH IN THE NEW JMP TABLE (SAVING THE OLD)
  1394. ;
  1395. PATCH    EQU    $+OFFSET
  1396.     CALL    TBLADDR        ;CALC HL= CP/M JMP TABLE
  1397.     LXI    D,VCOLDBT    ;POINT TO SAVE LOCATION
  1398.     MVI    B,18        ;ALWAYS SAVE PRINTER VECTOR
  1399.     CALL    MOVE        ;MOVE IT
  1400. ;NOW MOVE NEW JMP TABLE TO CP/M
  1401.     CALL    TBLADDR        ;CALC HL=CP/M'S JMP TABLE
  1402.     XCHG            ;MOVE TO DE
  1403.     LXI    H,NEWJTBL     ;POINT TO NEW
  1404.     CALL    MOVE        ;MOVE IT
  1405.     RET
  1406. ;
  1407. UNPATCH EQU    $+OFFSET
  1408.     CALL    TBLADDR     ;HL=CP/M'S JMP TABLE
  1409.     XCHG            ;MOVE TO DE
  1410.     LXI    H,VCOLDBT     ;GET SAVED TABLE
  1411.     CALL    MOVE        ;MOVE ORIG BACK
  1412.     RET            
  1413. ;
  1414. ;CALCULATE HL=CP/M'S JUMP TABLE, B=LENGTH
  1415. ;
  1416. TBLADDR EQU    $+OFFSET
  1417.     LHLD    1        ;GET BIOS POINTER
  1418.     DCX    H        ;..SKIP
  1419.     DCX    H        ;..TO
  1420.     DCX    H        ;..COLD BOOT
  1421.  
  1422.     if    printer     ;RETAIN LIST DEVICE?
  1423.     MVI    B,15        ;DON'T MOVE LISTER JUMP
  1424.     else
  1425.     MVI    B,18        ;BYTES TO MOVE
  1426.     endif    ;printer
  1427.  
  1428.     RET
  1429. ;
  1430. ;MOVE (HL) TO (DE), LENGTH IN (B)
  1431. ;
  1432. MOVE    EQU    $+OFFSET
  1433.     MOV    A,M        ;GET A BYTE
  1434.     STAX    D        ;PUT AT NEW HOME
  1435.     INX    D        ;BUMP POINTERS
  1436.     INX    H
  1437.     DCR    B        ;DEC BYTE COUNT
  1438.     JNZ    MOVE        ;IF MORE, DO IT
  1439.     RET            ;IF NOT,RETURN
  1440. ;
  1441. ;COMMON ROUTINE TO CHECK FOR CARRIER LOST,
  1442. ;CALLED FROM  CONSOLE OUT
  1443. ;
  1444. CHECK    EQU    $+OFFSET
  1445.     CALL    CARCK        ;SEE IF CARRIER STILL ON
  1446.     RNC            ;ALL OK
  1447. ;CARRIER IS LOST.  TYPE MESSAGE SO LOCAL CONSOLE
  1448. ;    SHOWS THE REASON
  1449. BADPASS EQU    $+OFFSET    ;COME HERE ON BAD PASSWORD
  1450.     MVI    A,1        ;SHOW CARRIER LOST SO
  1451.     STA    LOSTFLG        ;..WE WON'T CK AGAIN
  1452.     LXI    SP,STACK    ;ENSURE VALID STACK
  1453.     CALL    ILPRT
  1454. ;
  1455.     DB    CR,LF,'++CARRIER LOST++',CR,LF,'   ',0
  1456. ;
  1457.     CALL    UNPATCH        ;RESTORE ORIG BIOS JMP TBL
  1458.     XRA    A        ;CLEAR OUT CARRIER..
  1459.     STA    LOSTFLG     ;..LOST FLAG
  1460.     JMP    HANGUP
  1461. ;
  1462. ;READBYTE ROUTINE - USED TO READ THE
  1463. ;    WELCOME FILE
  1464. ;
  1465.     if    welfile
  1466. RDBYTE    EQU    $+OFFSET
  1467.     MOV    A,H        ;TIME TO READ?
  1468.     ORA    A        ;..IF AT 100H
  1469.     JZ    NORD        ;NO READ REQ'D
  1470. ;HAVE TO READ A SECTOR
  1471.     LXI    D,FCB
  1472.     MVI    C,READ
  1473.     CALL    BDOS
  1474.     ORA    A        ;OK?
  1475.     MVI    A,1AH        ;FAKE UP EOF
  1476.     RNZ            ;RET EOF IF BAD
  1477.     LXI    H,80H
  1478. NORD    EQU    $+OFFSET
  1479.     MOV    A,M        ;GET CHAR
  1480.     INX    H        ;TO NEXT
  1481.     RET
  1482.     endif    ;welfile
  1483. ;
  1484. ;KEYBOARD/MODEM STATUS TEST ROUTINE
  1485. ;
  1486. MSTAT    EQU    $+OFFSET
  1487.     call    check
  1488.  
  1489.     if    dual$io        ;WANT LOCAL CONSOLE?
  1490.     CALL    CONSTAT     ;GET LOCAL STATUS
  1491.     ORA    A
  1492.     RNZ            ;RET IF LOCAL CHAR
  1493.     endif    ;dual$io
  1494. ;
  1495.  
  1496.     if    inter3
  1497.     mvi    a,modem
  1498.     out    user        ;Select modem UART
  1499.     endif    ;inter3
  1500.  
  1501.     IN    STATUS        ;GET MODEM STATUS
  1502.     ANI    GBDAV        ;GOT A CHARACTER?
  1503.     RZ            ;RETURN IF NOT
  1504.     IN    STATUS        ;GET MODEM STATUS
  1505.     ANI    GBFE+GBOE    ;CHECK FOR FRAMING AND OVERRUN ERROR
  1506.     JZ    MSTAT1        ;NO ERROR, CHARACTER IS VALID
  1507.     CALL    MRESET        ;Reset modem UART errors
  1508.     XRA    A        ;RETURN FALSE
  1509.     RET
  1510. ;
  1511. MSTAT1    EQU    $+OFFSET
  1512.     MVI    A,0FFH        ;SHOW READY
  1513.     ORA    A
  1514.     RET
  1515. ;
  1516. MRESET    EQU    $+OFFSET
  1517.     IN    DATA        ;Swallow questionable character
  1518.     IN    CMMD        ;Get command byte
  1519.     ADI    ERESET        ;Clear Overrun & Framing errors
  1520.     OUT    CMMD        ;Reset UART ERROR
  1521.     SUI    ERESET
  1522.     OUT    CMMD        ;Clear UART reset
  1523.     RET
  1524. ;
  1525. ;MODEM INPUT FUNCTION, CHECKS LOCAL CONSOLE FIRST
  1526. ;
  1527. MINPUT    EQU    $+OFFSET
  1528. ;
  1529.     if    timeout
  1530.     PUSH    H
  1531.     LXI    H,TOVALUE*MINUTES ;INITIALIZE TIMEOUT COUNTER
  1532.     SHLD    TOCNT
  1533.     POP    H
  1534.     endif    ;timeout
  1535. ;
  1536. MINPUT1 EQU    $+OFFSET
  1537.     LDA    LOSTFLG        ;KNOWN LOSS..
  1538.     ORA    A        ;..OF CARRIER?
  1539.     CZ    CHECK        ;No, better check if carrier still there
  1540.  
  1541.     if    exitfil
  1542.     LDA    TOUT        ;Timeout out?
  1543.     ORA    A
  1544.     JNZ    FORCED        ;Yes, accept forced input
  1545.     endif    ;exitfil
  1546.  
  1547.     CALL    MSTAT        ;ANYTHING?
  1548.     ORA    A
  1549.  
  1550.     if    timeout
  1551.     JNZ    MINPUT2
  1552.     CALL    DELAY        ;KILL 100 MS
  1553.     PUSH    H
  1554.     LHLD    TOCNT        ;KNOCK DOWN TIMEOUT COUNTER
  1555.     DCX    H
  1556.     SHLD    TOCNT
  1557.  
  1558.     if    warning
  1559.     PUSH    D
  1560.     LXI    D,10*TMWARN    ;Warning time in seconds
  1561.     MOV    A,H
  1562.     CMP    D        ;High bytes match?
  1563.     JNZ    NOMATCH        ;No
  1564.     MOV    A,L        ;Yes
  1565.     CMP    E        ;Low bytes match?
  1566.     JNZ    NOMATCH        ;No
  1567.     CALL    DINGER        ;Yes, wake up user
  1568.     CALL    ILPRT
  1569.     DB    '++ AUTO LOGOFF SOON ++ ',0
  1570. ;
  1571.     CALL    DINGER        ;Ring my chimes, maybe I'll come    
  1572. NOMATCH    EQU    $ + OFFSET
  1573.     POP    D
  1574.     endif    ;warning
  1575.  
  1576.     MOV    A,H
  1577.     ORA    L
  1578.     POP    H
  1579.     JNZ    MINPUT1     ;STILL TIME LEFT..KEEP TRYING
  1580.     CALL    ILPRT
  1581. ;
  1582.     DB    CR,LF,'++ INPUT TIMED OUT ++',BEL,0
  1583. ;
  1584.     if    usrlog and actime
  1585.     PUSH    H
  1586.     lxi    h,INACT
  1587.     call    boplog        ;Add 1 to inactivity timeout counter
  1588.     endif    ;usrlog and actime
  1589.  
  1590.     if    exitfil
  1591.     LDA    BYEFLG        ;Still in BYE?
  1592.     ORA    A
  1593.     JZ    NOSLASH        ;Yes, just internal logout
  1594.     MVI    A,0FFH        ;No, send through exit file
  1595.     STA    TOUT        ;Set logout flag 
  1596.     LXI    H,CMMDSTR    ;Point to start of command string
  1597.     SHLD    CMMDPTR
  1598.     POP    H        ;Keep stack straight
  1599.     LHLD    VWARMBT+1    ;Do a "real" warm boot
  1600.     PCHL
  1601. ;
  1602. CMMDSTR    EQU    $+OFFSET    ;The following string get passed to CCP
  1603.     DB    'TIMEOUT',CR+80H    ;Load up the exit program
  1604.  
  1605.     endif    ;exitfil
  1606.  
  1607.     if    not exitfil
  1608.     POP    H
  1609.     JMP    NOSLASH
  1610.     endif    ;not exitfil
  1611.  
  1612.     else
  1613.  
  1614.     JZ    MINPUT        ;LOOP TILL CHAR RCD
  1615.     endif    ;timeout
  1616. ;
  1617. MINPUT2    EQU    $+OFFSET
  1618.  
  1619.     if    dual$io        ;BOTH LOCAL AND REMOTE
  1620.     CALL    CONSTAT     ;CHECK LOCAL CONSOLE
  1621.     ORA    A        ;CHAR?
  1622.     JNZ    CONIN        ;..YES, READ IT, RET.
  1623.     endif    ;dual$io
  1624. ;
  1625. ;    LOCAL CONSOLE WASN'T READY, SO READ MODEM
  1626. ;
  1627.     if    inter3
  1628.     mvi    a,modem
  1629.     out    user        ;Select modem UART
  1630.     endif    ;inter3
  1631.  
  1632.     IN    DATA        ;GET DATA BYTE
  1633.     ANI    7FH        ;DELETE PARITY
  1634.     JZ    MINPUT        ;IGNORE NULLS
  1635.  
  1636.     if    imsai and hardlog
  1637.     PUSH    B
  1638.     MOV    B,A
  1639.     IN    SENSE
  1640.     ANI    LOGSW
  1641.     MOV    A,B
  1642.     POP    B
  1643.     JZ    NOLOG
  1644.     endif    ;imsai and hardlog
  1645.  
  1646.     if    hardlog
  1647.     CPI    20H
  1648.     JNC    MINPUT3
  1649.     CPI    CR
  1650.     JNZ    NOLOG
  1651.  
  1652. MINPUT3    EQU    $+OFFSET
  1653.     CALL    LISTOUT        ;ECHO ON PRINTER
  1654.     CPI    CR
  1655.     JNZ    NOLOG        ;CR NEEDS LINEFEED
  1656.     MVI    A,LF
  1657.     CALL    LISTOUT        ;SO SEND IT
  1658.     MVI    A,CR        ;GET BACK CR
  1659.     endif    ;hardlog
  1660. ;
  1661. NOLOG    EQU    $+OFFSET
  1662. ;
  1663.     CPI    3        ;IS IT CONTROL-C?
  1664.     RNZ            ;NO, PASS IT THRU
  1665.     LDA    0        ;SEE IF WARM BOOT DISABLED
  1666.     CPI    0C3H        ;JMP MEANS WARM BOOT OK
  1667.     MVI    A,3        ;SO RETURN CONTROL-C
  1668.     RZ
  1669.     XRA    A        ;ELSE CONVERT TO NULL
  1670.     RET
  1671. ;
  1672.     if    warning
  1673. DINGER    EQU    $ + OFFSET
  1674.     MVI    D,RINGS
  1675. DING1    EQU    $ +OFFSET
  1676.     CALL    ILPRT        ;Ring my chimes, maybe I'll come
  1677.     DB    BEL,0        ; as Chuck Foresburg says...
  1678.     MVI    E,5        ;Pause between bells
  1679. DING2    EQU    $ + OFFSET
  1680.     CALL    DELAY
  1681.     DCR    E
  1682.     JNZ    DING2
  1683.     DCR    D        ;Done ringing?
  1684.     JNZ    DING1        ;No
  1685.     RET
  1686.     endif    ;warning
  1687.  
  1688.     if    exitfil
  1689. FORCED    EQU    $+OFFSET
  1690.     push    h
  1691.     LHLD    CMMDPTR        ;Get pointer into command string
  1692.     MOV    A,M        ;Get a byte from the string
  1693.     CPI    CR+80H        ;Bit 7 set high? (terminates)
  1694.     JZ    FDONE        ;Yes
  1695.     INX    H        ;No, adjust pointer
  1696.     SHLD    CMMDPTR        ;Save for next time
  1697.     pop    h
  1698.     RET            ;Give CCP the character
  1699. ;    
  1700. FDONE    EQU    $+OFFSET
  1701.     pop    h
  1702.     PUSH    PSW
  1703.     XRA    A
  1704.     STA    TOUT        ;Reset the flag
  1705.     POP    PSW
  1706.     ANI    07FH
  1707.     RET
  1708.     endif    ;exitfil
  1709. ;
  1710. ;
  1711. MOUTPUT    EQU    $+OFFSET
  1712. ;IF WE ALREADY KNOW CARRIER IS LOST,
  1713. ;DON'T CHECK FOR IT AGAIN
  1714.     LDA    LOSTFLG        ;KNOWN LOSS OF CARRIER?
  1715.     ORA    A
  1716.     jnz    silent        ;avoid loop in case carrier lost
  1717.     call    CHECK        ;CARRIER STILL ON?
  1718.     lda    tout        ;Forced timeout?
  1719.     ora    a
  1720.     jnz    silent        ;Yes, don't let user see what happens
  1721.  
  1722.     if    inter3
  1723.     mvi    a,modem
  1724.     out    user        ;Select modem UART
  1725.     endif    ;inter3
  1726.  
  1727.     IN    STATUS        ;GET MODEM STATUS
  1728.     ANI    GBTBMT        ;TRANSMIT REGISTER EMPTY?
  1729.     JZ    MOUTPUT        ;LOOP IF NOT READY
  1730.  
  1731.     if    imsai and blackout and dual$io
  1732.     IN    SENSE        ;FLIP SWITCH UP...
  1733.     ANI    BLACKSW     ;..TO BLIND REMOTE USER
  1734.     JNZ    SILENT
  1735.     endif    ;imsai and blckout and dual$io
  1736.  
  1737.     MOV    A,C        ;GET CHAR
  1738.     ANI    7FH
  1739. ;
  1740.     if    ck$lwc
  1741.     CPI    60H        ;CHECK FOR LOWER CASE
  1742.     JC    MOUTP2        ;SKIP IF NOT LC
  1743.     CPI    7FH        ;CHECK FOR RUBOUT
  1744.     JZ    MOUTP2
  1745.     PUSH    H
  1746.     LXI    H,ULCSW        ;SUBTRACT EITHER 20H OR 0
  1747.     SUB    M
  1748.     POP    H
  1749.     MOV    C,A        ;FORCE ON LOCAL AS WELL AS REMOTE
  1750. MOUTP2    EQU    $+OFFSET
  1751.     endif    ;ck$lwc
  1752. ;
  1753.     OUT    DATA        ;OUTPUT TO MODEM
  1754.  
  1755. SILENT    EQU    $+OFFSET
  1756. ;
  1757.     if    dual$io        ;TO LOCAL ALSO?
  1758.     push    psw
  1759.     CALL    CONOUT        ;SEND TO REGULAR BIOS
  1760.     pop    psw
  1761.     endif    ;dual$io
  1762. ;
  1763. ;CHECK FOR NULLS
  1764. ;
  1765.     CPI    LF        ;TIME FOR NULLS?
  1766.     RNZ            ;NO, RETURN
  1767. ;SEND NULLS IF REQUIRED
  1768.     LDA    NULLS        ;GET COUNT
  1769.     ORA    A        ;ANY?
  1770.     RZ            ;..NO
  1771.     PUSH    B
  1772.     MOV    B,A        ;SAVE COUNT
  1773.     MVI    C,0        ;0 IS A NULL
  1774. NULLP    EQU    $+OFFSET
  1775.     CALL    MOUTPUT     ;TYPE A NULL
  1776.     DCR    B        ;MORE?
  1777.     JNZ    NULLP        ;..YES, LOOP
  1778.     POP    B
  1779.     RET
  1780. ;
  1781. ;    BOOT TRAP-BECOMES DISCONNECT IF
  1782. ;    JMP AT 0 HAS BEEN ALTERED
  1783. ;
  1784. MBOOT    EQU    $+OFFSET
  1785.     LDA    0        ;LOOK AT OPCODE
  1786.     CPI    0C3H        ;IS IT STILL JMP?
  1787.     JZ    VWARMBT        ;YES, ALLOW IT
  1788.     JMP    NOSLASH        ;NO, DISCONNECT
  1789. ;
  1790. ;    INLINE PRINT ROUTINE
  1791. ;    CALL ILPRT
  1792. ;    DB    'MSG',0
  1793. ;
  1794. ILPRT    EQU    $+OFFSET
  1795.     XTHL            ;SAVE HL, GET MSG
  1796.     PUSH    B        ;SAVE
  1797.  
  1798. ILPLP    EQU    $+OFFSET
  1799.     MOV    C,M        ;GET CHAR
  1800.     CALL    MOUTPUT        ;OUTPUT IT
  1801.     INX    H        ;POINT TO NEXT
  1802.     MOV    A,M        ;TEST
  1803.     ORA    A        ;..FOR END
  1804.     JNZ    ILPLP
  1805.     POP    B        ;RESTORE
  1806.     XTHL            ;RESTORE HL, RET ADDR
  1807.     RET            ;RET PAST MSG
  1808. ;
  1809.     IF    pwrqd        ;KEEP PASSWORD HERE
  1810. ;ACCESS PASSWORD (ENDS IN C/R)
  1811. ;
  1812. PASSWD    EQU    $+OFFSET
  1813.     DB    'PLAUGER'    ;THE PASSWORD ITSELF
  1814.     DB    CR        ;END OF PASSWORD
  1815. ;ALLOW ROOM FOR BIGGER PASSWORD TO BE
  1816. ;    PATCHED IN
  1817.     DB    0,0,0,0,0,0,0,0,0,0,0
  1818.     endif    ;pwrqd
  1819. ;
  1820. ;    ROUTINE TO LOAD THE COM FILE
  1821. ;
  1822.     if    comfile
  1823. LODCOM    EQU    $+OFFSET
  1824.     XRA    A        ;INITIALIZE FCB
  1825.     STA    COMFCB
  1826.     LXI    H,COMFCB+12
  1827.     MVI    B,21
  1828. ZLOOP    EQU    $+OFFSET
  1829.     MVI    M,0
  1830.     INX    H
  1831.     DCR    B
  1832.     JNZ    ZLOOP
  1833.  
  1834.     MVI    C,OPEN        ;NOW OPEN THE FILE
  1835.     LXI    D,COMFCB
  1836.     CALL    BDOS
  1837.     INR    A        ;SHOULD BE NON-ZERO
  1838.     JZ    ABORT        ;NO FILE, ABORT
  1839. ;
  1840. ;    NOW LOAD THE FILE
  1841. ;
  1842.     LHLD    6        ;GET TOP OF MEMORY
  1843.     LXI    D,-80H        ;RECORD LOADS CAN'T START..
  1844.     DAD    D        ;..ABOVE (BDOS) - 80H
  1845.     PUSH    H        ;SAVE ON STACK
  1846. ;
  1847.     LXI    D,80H        ;TPA-80H
  1848.     LXI    B,0        ;KEEP A RECORD COUNTER
  1849.     PUSH    B        ;SAVE COUNTER
  1850.     PUSH    D        ;AND LOAD ADDRESS
  1851. GLOOP    EQU    $+OFFSET
  1852.     POP    D        ;GET TPA ADRS
  1853.     LXI    H,80H        ;POINT TO NXT ADRS TO READ TO
  1854.     DAD    D        ;HL HAS THE ADDRESS
  1855.     POP    B        ;INCREMENT THE COUNTER
  1856. ;
  1857. ;    CHECK FOR LOAD PAST TOP-OF-MEMORY
  1858. ;
  1859.     POP    D        ;GET -(TOP-OF-MEMORY)
  1860.     PUSH    D        ;RE-SAVE FOR NEXT TIME
  1861. ;
  1862.     MOV    A,E        ;SUBTRACT: (TOP) - (ADRS)
  1863.     SUB    L
  1864.     MOV    A,D        ;ONLY THE CARRY NEEDED
  1865.     SBB    H
  1866. ;
  1867.     JNC    SIZEOK        ;CY= BETTER MOVCPM
  1868.     CALL    ERRXIT        ;SO TELL THE STORY
  1869. ;
  1870.     DB    '++ PROGRAM AREA TOO SMALL ++','$'
  1871. ;;
  1872. SIZEOK    EQU    $+OFFSET
  1873.     INX    B
  1874.     PUSH    B
  1875.     PUSH    H        ;SAVE TPA ADRS
  1876.     XCHG            ;ALIGN REGISTERS
  1877.     MVI    C,STDMA        ;TELL BDOS WHERE TO PUT RECORD
  1878.     CALL    BDOS
  1879.     LXI    D,COMFCB    ;NOW READ THE RECORD
  1880.     MVI    C,READ
  1881.     CALL    BDOS
  1882.     ORA    A
  1883.     JZ    GLOOP        ;A=0 IF MORE TO READ
  1884.     POP    B        ;UNJUNK STACK
  1885.     POP    B        ;THIS IS OUR COUNTER
  1886.     POP    H        ;MORE JUNK ON STACK
  1887.     MOV    A,B        ;CHECK FOR ZERO
  1888.     ORA    C
  1889.     JZ    ABORT        ;WE SHOULD HAVE READ SOMETHING
  1890.     LXI    D,80H        ;WE DID, RESET DMA TO 80H
  1891.     MVI    C,STDMA
  1892.     CALL    BDOS
  1893.     CALL    LOADOK        ;PRINT THIS MSG TO CONSOLE:
  1894. ;
  1895.     DB    '++ COM FILE LOADED ++',CR,LF,'$'
  1896. ;
  1897. LOADOK    EQU    $+OFFSET
  1898.     POP    D
  1899.     LDA    OPTION        ;SEE IF THIS WAS "BYE /C"
  1900.     CPI    'C'        ;IF IT WAS THEN..
  1901.     RZ            ;..DON'T PRINT MESSAGE
  1902.     MVI    C,PRINTF
  1903.     CALL    BDOS
  1904.     RET
  1905. ;
  1906. ABORT    EQU    $+OFFSET
  1907.     CALL    ERRXIT
  1908. ;
  1909.     DB    CR,LF,'+++CANNOT FIND COM FILE+++','$'
  1910. ;
  1911. ERRXIT    EQU    $+OFFSET
  1912.     POP    D
  1913.     MVI    C,PRINTF
  1914.     CALL    BDOS        ;PRINT THE ABORT MSG
  1915.     JMP    0        ;GIVE UP
  1916.     endif    ;comfile
  1917.  
  1918. ;
  1919. ;THIS AREA IS USED FOR VECTORING CALLS TO THE
  1920. ;USER'S CBIOS, BUT SAVING THE REGISTERS FIRST
  1921. ;IN CASE THEY ARE DESTROYED.
  1922. ;
  1923. CONSTAT EQU    $+OFFSET
  1924.     PUSH    B
  1925.     PUSH    D
  1926.     PUSH    H
  1927.     CALL    VCONSTAT
  1928.     POP    H
  1929.     POP    D
  1930.     POP    B
  1931.     RET
  1932. ;
  1933. CONIN    EQU    $+OFFSET
  1934.     PUSH    B
  1935.     PUSH    D
  1936.     PUSH    H
  1937.     CALL    VCONIN
  1938.  
  1939.     if    fkeys
  1940.     CALL    CKFUNC
  1941.     endif    ;fkeys
  1942.  
  1943.     POP    H
  1944.     POP    D
  1945.     POP    B
  1946.     RET
  1947. ;
  1948. CKFUNC    EQU    $+OFFSET
  1949. ;
  1950.     if    fkeys and imsai
  1951.     PUSH    B
  1952.     MOV    B,A        ;SAVE CHAR
  1953.     IN    SENSE        ;READ THE SWITCHES
  1954.     ANI    ENABLF        ;CHECK FKEY ENAB SW
  1955.     MOV    A,B
  1956.     POP    B
  1957.     RZ            ;NO FUNCT IF SW OFF
  1958.     endif    ;fkeys and imsai
  1959. ;
  1960.     if    fkeys
  1961.     CPI    SYSDKEY
  1962.     JZ    SYSDOWN     ;TELL CALLER TO LEAVE
  1963.     CPI    TWITKEY
  1964.     JZ    GOODBY        ;MAKE CALLER LEAVE
  1965.     CPI    MSGKEY
  1966.     RNZ
  1967.     CALL    ILPRT        ;SEND CALLER A MESSAGE
  1968. ;
  1969.     DB    'MESSAGE FROM OPERATOR:',0
  1970. ;
  1971.     MVI    A,' '        ;SOMETHING TO RETURN WITH
  1972.     RET
  1973. ;
  1974. SYSDOWN EQU    $+OFFSET
  1975.     CALL    ILPRT
  1976. ;
  1977.     DB    'SYSTEM DOWN IN'
  1978.     DB    ' 5 MINUTES....',0
  1979. ;
  1980.     MVI    A,' '
  1981.     RET
  1982.     endif    ;fkeys
  1983. ;
  1984. CONOUT    EQU    $+OFFSET
  1985.     PUSH    B
  1986.     PUSH    D
  1987.     PUSH    H
  1988.     CALL    VCONOUT
  1989.     POP    H
  1990.     POP    D
  1991.     POP    B
  1992.     RET
  1993. ;
  1994.     if    hardlog
  1995. LISTOUT    EQU    $+OFFSET
  1996.     PUSH    B
  1997.     PUSH    D
  1998.     PUSH    H
  1999.     PUSH    PSW
  2000.     MOV    C,A
  2001.     CALL    VLISTOUT
  2002.     POP    PSW
  2003.     POP    H
  2004.     POP    D
  2005.     POP    B
  2006.     RET
  2007.     endif    ;hardlog
  2008. ;
  2009. ;
  2010. ;    THIS IS THE JMP TABLE WHICH IS COPIED
  2011. ;    ON TOP OF THE ONE POINTED TO BY
  2012. ;    LOCATION 1 IN CP/M
  2013. ;
  2014. NEWJTBL EQU    $+OFFSET
  2015.     JMP    MCBOOT        ;COLD BOOT
  2016.     JMP    MBOOT        ;WARM BOOT
  2017.     JMP    MSTAT        ;MODEM STATUS TEST
  2018.     JMP    MINPUT        ;MODEM INPUT ROUTINE
  2019.     JMP    MOUTPUT     ;MODEM OUTPUT ROUTINE
  2020.     RET            ;DUMMY LIST DEVICE
  2021.     NOP
  2022.     NOP
  2023. ;
  2024.     if    motor
  2025. ;
  2026. DSKON    EQU    $+OFFSET
  2027.     PUSH    PSW        ;SAVE THE A AND FLAGS
  2028.     MVI    A,DISKON    ;VALUE TO TURN ON MOTORS
  2029.     OUT    DISK        ;TO THE DISK CONTROLLER
  2030.     PUSH    H        ;THIS IS TIMER
  2031.     LXI    H,0        ;THIS LONG
  2032. DSKLP    EQU    $+OFFSET
  2033.     XTHL
  2034.     XTHL
  2035.     DCX    H        ;COUNT LOOP
  2036.     MOV    A,H        ;CHECK FOR DONE
  2037.     ORA    L
  2038.     JNZ    DSKLP
  2039.     POP    H        ;RESTORE HL
  2040.     POP    PSW        ;AND A & FLAGS
  2041.     RET
  2042. ;
  2043. DSKOFF    EQU    $+OFFSET
  2044.     PUSH    PSW        ;SAVE A & FLAG
  2045.     MVI    A,DISKOFF    ;VALUE TO TURN MOTORS OFF
  2046.     OUT    DISK
  2047.     POP    PSW
  2048.     RET
  2049. ;
  2050.     endif    ;motor
  2051. ;
  2052.     if    rtc
  2053. CLKBASE    EQU    50H        ;BASE OF SYSTEM SUPPORT 1 CARD
  2054. CLKCTL    EQU    CLKBASE+10    ;CLOCK CONTROL PORT
  2055. CLKDATA    EQU    CLKBASE+11    ;CLOCK DATA PORT
  2056. CREAD    EQU    10H+40H        ;READ COMMAND + HOLD COUNT COMMAND
  2057. ;
  2058. TIME    EQU    $+OFFSET
  2059.     PUSH    H
  2060.     PUSH    D
  2061.     PUSH    B
  2062.     PUSH    PSW
  2063.     MVI    D,CREAD+5    ;POINT TO 10s OF HOURS
  2064.     MVI    B,3        ;3 LOOPS
  2065.     JMP    TX        ;START W/ NO SEPARATOR
  2066. ;
  2067. T1    EQU    $+OFFSET
  2068.     MVI    C,':'        ;SEPARATOR
  2069.     CALL    MOUTPUT        ;TO THE PRINTER
  2070. TX    EQU    $+OFFSET
  2071.     MOV    A,D        ;GET THE DIGIT ADDRESS
  2072.     CALL    CLOCK        ;GET THE VALUE
  2073.     MOV    C,A        ;SAVE IT
  2074.     MVI    A,CREAD+5    ;TEST FOR FIRST LOOP
  2075.     CMP    D        ;1ST LOOP?
  2076.     MOV    A,C        ;RECOVER THE VALUE
  2077.     JNZ    T2        ;JUMP IF NOT 1ST LOOP
  2078.     ANI    3        ;DROP PM INDICATOR
  2079. T2    EQU    $+OFFSET
  2080.     ADI    '0'        ;ADD ASCII BIAS
  2081.     MOV    C,A
  2082.     CALL    MOUTPUT        ;AND PRINT IT
  2083.     DCR    D        ;POINT TO NEXT DIGIT
  2084.     MOV    A,D        ;GET THE DIGIT ADDRESS TO A
  2085.     CALL    PCLOCK        ;GET & PRINT ASCII
  2086.     DCR    D        ;BUMP DIGIT COUNTER
  2087.     DCR    B
  2088.     JNZ    T1        ;LOOP TILL ALL PRINTED
  2089. ;
  2090. ;
  2091.     CALL    ILPRT        ;PRINT THE TIME ZONE
  2092. ;
  2093.     DB    ' EST ',0     ;Australian EST
  2094. ;
  2095. ; WE WILL NOW PRINT THE DAY OF THE WEEK, FOLLOWED
  2096. ; BY THE MONTH, DATE AND YEAR
  2097. ;
  2098. ;
  2099.     MVI    A,CREAD+6        ;THIS IS DAY OF WEEK 
  2100.     CALL CLOCK        ;GET THE DAY NUMBER
  2101. ;
  2102. DAYDONE    EQU    $+OFFSET
  2103.     ADD    A        ;DOUBLE DAY COUNT
  2104.     LXI    H,DAYS        ;POINT TO TABLE
  2105.     MOV    E,A        ;ADD OFFSET TO DE
  2106.     MVI    D,0
  2107.     DAD    D        ;NEW POINTER IN HL
  2108.     MOV    A,M        ;GET LO BYTE OF WORD
  2109.     INX    H        ;POINT TO HI BYTE
  2110.     MOV    H,M        ;TO H
  2111.     MOV    L,A        ;PLUS LO BYTE POINTS TO STRING
  2112.     CALL    LINOUT        ;PRINT THE DAY
  2113. ;
  2114.     MVI    A,CREAD+10    ;10s OF MONTHS
  2115.     CALL    CLOCK
  2116.     ORA    A        ;WE GOT 10's OF MONTHS?
  2117.     JZ    NOTENS        ;JUMP IF NOT
  2118.     MVI    A,10        ;ADD 10s IF WE GOT EM
  2119. NOTENS    EQU    $+OFFSET
  2120.     MOV    B,A        ;SAVE 10s IN B
  2121.     MVI    A,CREAD+9    ;GET THE ONES
  2122.     CALL    CLOCK
  2123.     ADD    B        ;ADD TO THE 10s PLACE TO GET MONTH
  2124.     DCR    A        ;CORRECT FOR JAN=1
  2125.     ADD    A        ;DOUBLE MONTH NUMBER
  2126.     LXI    H,MONTHS    ;POINT TO DISPATCH TABLE
  2127.     MOV    E,A        ;OFF SET TO DE
  2128.     MVI    D,0
  2129.     DAD    D        ;POINTER TO STRING AT (HL)
  2130.     MOV    A,M        ;GET LO BYTE TO A
  2131.     INX    H        ;POINT TO NEXT
  2132.     MOV    H,M        ;HI BYTE TO H
  2133.     MOV    L,A        ;LO BYTE TO L POINTS TO STRING
  2134.     CALL    LINOUT        ;PRINT THE MONTH
  2135. ;
  2136.     MVI    A,CREAD+8    ;10s OF DAYS
  2137.     CALL    CLOCK
  2138.     ANI    3        ;DROP LEAP YEAR INDICATOR
  2139.     JZ    NTENS        ;JUMP IF NO TENS PLACE
  2140.     CALL    PASC        ;PRINT IT
  2141. NTENS    EQU    $+OFFSET
  2142.     MVI    A,CREAD+7    ;ONES OF DAYS
  2143.     CALL    PCLOCK        ;PRINT THEM
  2144.     LXI    H,YEAR        ;PLUS YEAR MESSAGE
  2145.     CALL    LINOUT        ;TO LISTER
  2146.     MVI    A,CREAD+12    ;TENS OF YEAR
  2147.     CALL    PCLOCK        ;PRINT THEM
  2148.     MVI    A,CREAD+11    ;ONES OF YEAR
  2149.     CALL    PCLOCK
  2150.     CALL    ILPRT        ;FINISH THE LINE
  2151. ;
  2152.     DB    CR,LF,0
  2153. ;
  2154.     POP    PSW
  2155.     POP    B
  2156.     POP    D
  2157.     POP    H
  2158.     RET
  2159. ;
  2160. PCLOCK    EQU    $+OFFSET
  2161.     CALL    CLOCK        ;GET THE DIGIT
  2162. PASC    EQU    $+OFFSET
  2163.     ADI    '0'        ;ADD ASCII BIAS
  2164.     MOV    C,A
  2165.     JMP    MOUTPUT        ;AND PRINT
  2166. ;
  2167. CLOCK    EQU    $+OFFSET
  2168.     OUT    CLKCTL        ;TELL IT ADDRESS
  2169.     IN    CLKDATA        ;GET THE DATA NYBBLE
  2170.     PUSH    PSW        ;SAVE THE DATA
  2171.     XRA    A        ;GET 0
  2172.     OUT    CLKCTL        ;RESET HOLD BIT
  2173.     POP    PSW        ;RESTORE DATA
  2174.     RET
  2175. ;
  2176. LINOUT    EQU    $+OFFSET
  2177.     MOV    A,M        ;GET THE CHARACTER
  2178.     CPI    '$'        ;DONE?
  2179.     RZ            ;RETURN IF DONE
  2180.     MOV    C,A        ;ELSE PRINT IT
  2181.     CALL    MOUTPUT
  2182.     INX    H        ;POINT TO NEXT CHARACTER
  2183.     JMP    LINOUT        ;THEN LOOP TILL DONE
  2184. ;
  2185. ;
  2186. SUN    EQU    $+OFFSET
  2187.     DB    'Sunday, $'
  2188. MON    EQU    $+OFFSET
  2189.     DB    'Monday, $'
  2190. TUE    EQU    $+OFFSET
  2191.     DB    'Tuesday, $'
  2192. WED    EQU    $+OFFSET
  2193.     DB    'Wednesday, $'
  2194. THU    EQU    $+OFFSET
  2195.     DB    'Thursday, $'
  2196. FRI    EQU    $+OFFSET
  2197.     DB    'Friday, $'
  2198. SAT    EQU    $+OFFSET
  2199.     DB    'Saturday, $'
  2200. ;
  2201. JAN    EQU    $+OFFSET
  2202.     DB    'January $'
  2203. FEB    EQU    $+OFFSET
  2204.     DB    'February $'
  2205. MAR    EQU    $+OFFSET
  2206.     DB    'March $'
  2207. APR    EQU    $+OFFSET
  2208.     DB    'April $'
  2209. MAY    EQU    $+OFFSET
  2210.     DB    'May $'
  2211. JUN    EQU    $+OFFSET
  2212.     DB    'June $'
  2213. JUL    EQU    $+OFFSET
  2214.     DB    'July $'
  2215. AUG    EQU    $+OFFSET
  2216.     DB    'August $'
  2217. SEP    EQU    $+OFFSET
  2218.     DB    'September $'
  2219. OCT    EQU    $+OFFSET
  2220.     DB    'October $'
  2221. NOV    EQU    $+OFFSET
  2222.     DB    'November $'
  2223. DEC    EQU    $+OFFSET
  2224.     DB    'December $'
  2225. ;
  2226. YEAR    EQU    $+OFFSET
  2227.     DB    ', 19$'
  2228. ;
  2229. ;#################################################
  2230. DAYS    EQU    $+OFFSET
  2231.     DW    SUN
  2232.     DW    MON
  2233.     DW    TUE
  2234.     DW    WED
  2235.     DW    THU
  2236.     DW    FRI
  2237.     DW    SAT
  2238.     DW    SUN
  2239. ;
  2240. MONTHS    EQU    $+OFFSET
  2241.     DW    JAN
  2242.     DW    FEB
  2243.     DW    MAR
  2244.     DW    APR
  2245.     DW    MAY
  2246.     DW    JUN
  2247.     DW    JUL
  2248.     DW    AUG
  2249.     DW    SEP
  2250.     DW    OCT
  2251.     DW    NOV
  2252.     DW    DEC
  2253. ;
  2254. ;
  2255.     endif    ;RTC
  2256. ;
  2257.     if    welfile
  2258. WELFILN EQU    $+OFFSET
  2259.     DB    0,'STARTUP    ',0
  2260. ;WELCOME FILE NAME ^^^^^^^^^^^
  2261.     endif    ;welfile
  2262. ;
  2263. NULLS    EQU    $+OFFSET
  2264.     DB    5
  2265. ;
  2266.     if    comfile
  2267. COMFCB    EQU    $+OFFSET
  2268.     DB    0,'ENTRBBS COM'
  2269. ;COM FILE NAME     ^^^^^^^^^^^
  2270.     endif    ;comfile
  2271.  
  2272. PEND    EQU    $+OFFSET     ;END OF RELOCATED CODE
  2273. ;
  2274. ;    THESE AREAS ARE NOT INITIALIZED
  2275. ;
  2276.     DS    21        ;REST OF COM FCB
  2277. ULCSW    EQU    $+OFFSET
  2278.     DS    1
  2279. OPTION    EQU    $+OFFSET
  2280.     DS    1
  2281. TOCNT    EQU    $+OFFSET
  2282.     DS    2
  2283. ;
  2284. ;KEEP TRACK OF LOST CARRIER WHEN TYPING
  2285. ;"++CARRIER LOST++" SO WE DON'T LOOP
  2286. ;
  2287. LOSTFLG EQU    $+OFFSET
  2288.     DS    1
  2289. DROPOUT    EQU    $+OFFSET
  2290.     DS    1
  2291. ;
  2292. ;These are for the timeout exit routine
  2293. ;
  2294.     if    exitfil
  2295. TOUT    EQU    $+OFFSET
  2296.     DS    1
  2297. BYEFLG    EQU    $+OFFSET
  2298.     DS    1
  2299. CMMDPTR    EQU    $+OFFSET
  2300.     DS    2
  2301.     endif    ;exitfil
  2302. ;
  2303. ;Counter for number of tries at answering questions
  2304. ;
  2305.     if    anstry
  2306. COUNT    EQU    $+OFFSET
  2307.     DS    1
  2308.     endif    ;anstry
  2309. ;
  2310. ;SAVE THE CP/M JUMP TABLE HERE
  2311. ;
  2312. VCOLDBT EQU    $+OFFSET
  2313.     DS    3
  2314. VWARMBT EQU    $+OFFSET
  2315.     DS    3
  2316. VCONSTAT EQU    $+OFFSET
  2317.      DS    3
  2318. VCONIN     EQU    $+OFFSET
  2319.      DS    3
  2320. VCONOUT  EQU    $+OFFSET
  2321.      DS    3
  2322. VLISTOUT EQU    $+OFFSET
  2323.      DS    3
  2324. ;
  2325. ;    SINCE THESE AREAS ARE NOT INITIALIZED,
  2326. ;    THE FOLLOWING COUNTERS WILL NOT BE CHANGED
  2327. ;    BY SUBSEQUENT LOADS OF THIS PROGRAM
  2328. ;
  2329.     if    usrlog
  2330. ATTUSR    EQU    $+OFFSET
  2331.     DS    2
  2332. NEWUSR    EQU    $+OFFSET
  2333.     DS    2
  2334. NONUSR    EQU    $+OFFSET
  2335.     DS    2
  2336. INACT    EQU    $+OFFSET
  2337.     DS    2
  2338.     endif
  2339. ;
  2340. ;
  2341.     DS    60
  2342. STACK    EQU    $+OFFSET    ;LOCAL STACK
  2343. ;
  2344. ENDMARK    EQU    $+OFFSET ;! IGNORE ERROR. THIS MARKS END OF PGM
  2345. ;
  2346. CI    EQU    1
  2347. WRCON    EQU    2
  2348. DIRECTIO EQU    6
  2349. PRINTF    EQU    9
  2350. CSTS    EQU    11
  2351. DRESET    EQU    13
  2352. OPEN    EQU    15
  2353. READ    EQU    20
  2354. STDMA    EQU    26
  2355. FCB    EQU    5CH 
  2356. FCBRNO    EQU    FCB+32
  2357. ;
  2358.     END
  2359.