home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / MODEMS / MODEM7 / M7-SCAT.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  27KB  |  1,099 lines

  1. ; M7SCAT.ASM  Novation Smart-Cat overlay for MDM714 - 03/10/84
  2. ; NOTES: (1) This overlay will not work with MDM724. (CEH)
  3. ;     (2) The machine dependent code in this overlay is for
  4. ;         the H/Z H-89.  It might need to be changed for you use.
  5. ;
  6. ; This overlay is a modification of M7RV-1.ASM, which was written for
  7. ; the Racal-Vadic VA212PA modem.  That overlay had some problems with
  8. ; sending characters out to the modem too fast for it to accept them.
  9. ; This problem was corrected in the overlay for the VA3451.  This overlay
  10. ; was, in turn, created from it.  The delay timer routine is called TIMER5,
  11. ; and is called with a delay value in the B register.  This value is
  12. ; obtained from the value that is stored at the TDELAY equate, which
  13. ; must be selected before assembly.  TDELAY is the number of 100mS
  14. ; segments in the delay.  The default value for the Smart-Cat is 3.
  15. ;
  16. ; A DEBUG feature had been added that can be selected by setting the
  17. ; DBUG equate to YES.  This function was added mainly to permit
  18. ; debugging with full control over the DTR signal to the phone.  This
  19. ; function might be desired as a permanent feature.  It becomes one of
  20. ; the SET choices if selected, and appears in the SET menu.
  21. ;
  22. ; This overlay is configured for the Heath/Zenith H-89.  Other machines
  23. ; will require changes to the PORT addresses and functions and the
  24. ; INITMOD routine as required for a particular UART.  Also, change
  25. ; SETUPR, SETDTRH, and SETDTRL as required.  Changes might also be
  26. ; needed at the CLREOS and CLRSCRN DB values.  The SYSVER can be
  27. ; configured to any reasonable signon desired.
  28. ;
  29. ; Caution is advised in setting up names in the internal number library.
  30. ; The Smart-Cat does not have an offline command arrangement, as found
  31. ; in the Hayes SmartModem and The Vadic units.    It reserves the character
  32. ; '%' to tell the modem that a command is comming.  This character is
  33. ; not sent out to the line, and will be accepted at any time to set the
  34. ; modem into the command mode.    This character is sent out by the program
  35. ; as a preamble to sending out the phone number.  IT SHOULD NEVER be
  36. ; included in the library listing in ANY location.  The modem also recog-
  37. ; nizes several other characters that may be placed within the phone
  38. ; number string.  They are 'I' (impulse dialing - default is DTMF),
  39. ; 'P' (pause), and 'W' (wait).    Also '*' and '#' (used in PABX dialing).
  40. ; All other alpha characters are discarded by the program.
  41. ; The reserved alpabetical characters may appear in the name field of
  42. ; the library listing, BUT ONLY AS LOWER CASE CHARACTERS).  The program
  43. ; scans the entire library entry for the number; hence, NO RESERVED
  44. ; character or NO DIGIT may appear unless it is actually part of the
  45. ; number.  If Novation ever adopts the procedure of sending control
  46. ; strings only when DTR is off, then placing the modem in UNLISTEN
  47. ; mode when DTR is on, this problem can be solved.
  48. ;
  49. ; Another consequence of this arrangement is that the modem can not be
  50. ; used for XMODEM transfers unless it is placed into the UNLISTEN mode,
  51. ; either by internal switch or by terminal mode command.  After this is
  52. ; done, the power must be cycled to get it back into command mode.  It
  53. ; also defaults to 7-bit characters for ASCII operation.  It must be set
  54. ; for 8-bit characters for XMODEM transfers.
  55. ;
  56. ; This code may not be optimum by any means.  The TDELAY value of 3
  57. ; might be reduced without causing problems.  The 3.5 second delay that
  58. ; is provided at DISCONNT2 to provide plenty of time for the modem to
  59. ; recover from a disconnect might be greater than needed and slows the
  60. ; response to redialing.  The disabled code at DISCONNT that was supposed
  61. ; to help reinitialize the modem prevented the program from working,
  62. ; perhaps because there was insufficient time delay to recover from it.
  63. ; the %I initialization command was not used because the modem takes
  64. ; 5-10 seconds to cycle through its routine.  It might have been used
  65. ; to some advantage.  If the program seems slow, the user is invited to
  66. ; experiment with these values and features.
  67. ;
  68. ; The Novation Smart-Cat modem is configured as follows:
  69. ;
  70. ;    SWITCH        SETTING     RESULT
  71. ;    1        OFF        Transparent mode not forced
  72. ;    2        ON        Not quiet mode
  73. ;    3        ON        Verbose responses (required here)
  74. ;    4        ON        1200 baud default data rate
  75. ;    5        OFF        Auto-answer off
  76. ;    6        OFF        Carrier detect not required.
  77. ;
  78. ; For PABX use, # and * may be used on the phone number command line.
  79. ; (Read the manual for use of the I, P, and W commands within the number).
  80. ;
  81. ; Initialization routines need to be changed to support your I/O devices
  82. ; are INITMOD:,  SETUPR: SETDTRH: and SETDTRL: - Examples for USART
  83. ; initialization may be found in BYE2-16.LBR.  The modem is disconnected
  84. ; from on-line by dropping the DTR line, this must be implemented in the
  85. ; SETDTRL: routine in accordance with your I/O devices.  The modem is
  86. ; enabled by setting DTR high and must be implemented in your SETDTRH:
  87. ; routine.
  88. ;
  89. ;    To install the overlay make your changes for the USART
  90. ;    dependent routines.  This overlay may directly be used
  91. ;    if using a Zilog Z-80 SIO for I/O and a CTC for the baud
  92. ;    rate clock, just change ports and time constant for CTCs
  93. ;
  94. ;    A>DDT MDM7xx.COM   (Any .COM version of MDM714)
  95. ;    DDT VERS 2.2
  96. ;    NEXT   PC
  97. ;    4300  0100
  98. ;    -IM7SCAT.HEX
  99. ;    -R
  100. ;    NEXT   PC
  101. ;    4300  0000
  102. ;    -G0           (or CTRL-C)
  103. ;
  104. ;    A>SAVE 66 M7SCAT.COM
  105. ;
  106. ;***********************************************************************
  107. ;
  108. ; 03/10/84 - Configured for the Novation
  109. ;         Smart-Cat Modem and called M7SCAT.ASM - Charles Horn
  110. ; 03/03/84 - Configured for the VA3451 and
  111. ;               called M7RV3451.ASM    - Charles Horn
  112. ; 11/11/83 - Renamed to M7RV-1.ASM, no changes    - Irv Hoff
  113. ; 10/15/83 - First version for Racal-Vadic    - Fred Willink
  114. ;
  115. ;***********************************************************************
  116. ;
  117. ; Change these equates for YOUR ports
  118. ; Change the value at MODDATP if it does not match what you are using.
  119. ;
  120. MODDATP:    EQU    0D8H        ;data port for H89
  121. MODCTL1:    EQU    MODDATP+5    ;status port for H89
  122. MODRCVB:    EQU    1        ;bit to test for received data
  123. MODRCVR:    EQU    1        ;modem receive ready
  124. MODSNDB:    EQU    20H        ;bit to test for ready to send
  125. MODSNDR:    EQU    20H        ;modem send ready bit
  126. ;
  127. ;
  128. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  129. ;
  130. YES:        EQU    0FFH
  131. NO:        EQU    0
  132. ;
  133. DBUG:        EQU    YES        ;Set to NO for normal use (CEH)
  134. ;
  135. TDELAY:     EQU    3        ;DELAY5 value. 1=100 mS, 2=200mS,etc.
  136. ;
  137. CANCEL:        EQU    'X'-40H    ;^X = Cancel
  138. ESC:        EQU    '['-40H    ;^[ = escape
  139. BELL:        EQU    'G'-40H    ;^G = bell character
  140. LF:        EQU    'J'-40H    ;^J = linefeed
  141. CR:        EQU    'M'-40H    ;^M = carriage return
  142. PRINT:        EQU    9
  143. BDOS:        EQU    0005H
  144. ;
  145. LIBLEN:        EQU    34
  146. ;
  147. ;=======================================================================
  148. ;
  149.         ORG    0100H
  150. ;
  151. ;
  152.         JMP    START    ;skip the data area below
  153. ;
  154. PMMIMODEM:    DB    NO
  155. SMARTMODEM:    DB    YES    ; yes=Novation Smart-Cat. The main
  156.                 ; program test this byte to use the
  157.                 ; new routines
  158.         DS    1
  159. CLOCK:        DB    20    ;clock speed x10, up to 25.5 mhz.
  160.                 ;2 MHz=20, 3.68 MH=37, 4 MHz=40, etc.
  161. MSPEED:        DB    5    ;sets display time for sending a file
  162.                 ;0=110    1=300  2=450  3=600  4=710
  163.                 ;5=1200 6=2400 7=4800 8=9600 9=19200
  164. BYTDLY:     DB    0    ;Default time to send character in
  165.                 ;terminal mode file transfer (0-9)
  166. CRDLY:        DB    0    ;End of line delay after CRLF in terminal
  167.                 ;mode file transfer (0-9).
  168.                 ;0=zero delay, 1=10mS, 5=50mS, 9=90mS.
  169. NOOFCOL:    DB    5    ;number of columns in directory
  170. SETUPTST:    DB    YES    ;yes=non-PMMI setup routine
  171. SCRNTEST:    DB    YES    ;yes=home cursor and clear screen
  172.         DS    29
  173. ;
  174. ;
  175. ; Handles in/out ports for data and status
  176. ;
  177. IN$MODCTL1:    IN    MODCTL1 ! RET    ;in modem control port
  178.         DB    0,0,0,0,0,0,0    ;spares if needed for non-PMMI
  179. OUT$MODDATP:    OUT    MODDATP    ! RET    ;out modem data port
  180.         DB    0,0,0,0,0,0,0    ;spares if needed for non=PMMI
  181. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port
  182.         DB    0,0,0,0,0,0,0    ;spares if needed for non-PMMI
  183. ANI$MODRCVB:    ANI    MODRCVB ! RET    ;bit to test for receive ready
  184. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of receive bit when ready
  185. ANI$MODSNDB:    ANI    MODSNDB ! RET    ;bit to test for send ready
  186. CPI$MODSNDR:    CPI    MODSNDR ! RET    ;value of send bit when ready
  187. ;
  188. IN$BAUDRP:    RET    !  NOP    ! NOP     ;in baudrate port
  189. OUT$BAUDRP:    RET    !  NOP    ! NOP     ;out baudrate port
  190. OUT$MODCTL1:    OUT    MODCTL1    ! RET     ;out modem control port #1
  191. OUT$MODCTL2:    RET    !  NOP    ! NOP     ;out modem control port #2
  192. ;
  193. LOGONPTR:    DW    LOGON
  194. JMP$DIAL:    JMP    DIAL
  195. JMP$DISCONNT:    JMP    DISCONNT
  196. JMP$GOODBYE:    JMP    GOODBYE
  197. JMP$INITMOD:    JMP    INITMOD
  198. JMP$NEWBAUD:    RET
  199.         DS    2
  200. JMP$NOPARITY:    RET
  201.         DS    2
  202. JMP$PARITY:    RET
  203.         DS    2
  204. JMP$SETUPR:    JMP    SETUPR
  205. JMP$SPCLMENU:    RET
  206.         DS    2
  207. JMP$SYSVER:    JMP    SYSVER
  208. JMP$BREAK    RET
  209.         DS    2
  210. ;
  211. JMP$ILPRT:    JMP    ILPRT
  212. JMP$INBUF:    JMP    INBUF
  213. JMP$INLNCOMP:    JMP    INLNCOMP
  214. JMP$INMODEM:    JMP    INMODEM
  215. JMP$NXTSCRN:    JMP    NXTSCRN
  216. JMP$TIMER:    JMP    TIMER
  217. ;
  218. ;
  219. ; Clear sequences are for H/Z H-89.  Change to match
  220. ; your terminal.
  221. ;
  222. CLREOS:        CALL    ILPRT
  223.         DB    ESC,'J',0,0,0    ;HZ-89
  224.         RET
  225. ;.....
  226. ;
  227. ;
  228. CLRSCRN:    CALL    ILPRT
  229.         DB    ESC,'E',0,0,0    ;HZ-89
  230.         RET
  231. ;.....
  232. ;
  233. ;
  234. ;======================== SIGN-ON MESSAGE ==============================
  235. ;
  236. ; Send version number and date
  237. ;
  238. SYSVER: CALL    ILPRT
  239.     DB    'Version for the Novation SmartCat Modem',CR,LF
  240.     DB    '(Starts at 1200 Baud)',CR,LF,0
  241.     RET
  242. ;.....
  243. ;
  244. ;
  245. ;==================== LOGON MESSAGE (IF ANY) ===========================
  246. ;
  247. ; Insert your logon message here.  End with a 0 (for "CALL ILPRT").
  248. ;
  249. LOGON:    DS    59        ;UP TO 59 CHARACTERS ALLOWED
  250.     DB    0        ;TO TERMINATE THE LOGON MESSAGE
  251. ;.....
  252. ;
  253. ;
  254. ;===================== USART INITIALIZATION ============================
  255. ;
  256. ; Begining of USART dependent routines change as needed
  257. ;
  258. ;=======================================================================
  259. ;
  260. ; NOTE: The DTR line is used to control the modem
  261. ;
  262.  
  263. INITMOD:  MVI    A,5        ;default transfer speed to 1200 baud
  264.       STA    MSPEED
  265.       DI            ;turn off interrupts for init.
  266.       XRA    A
  267.       OUT    MODDATP+1    ;interrupt enable register
  268.       MVI    A,80H        ;insure out of mode to set baud rate
  269.       OUT    MODDATP+3    ;line control register
  270.       OUT    MODDATP+3    ;again
  271. ;
  272. LSPSPD:   MVI    A,60H        ;default 'LSP' speed for 1200 baud
  273.       OUT    MODDATP        ;register for 'LSP' speed if enabled
  274. ;
  275. MSPSPD:   MVI    A,00H        ;default 'MSP' speed for 1200 baud
  276.       OUT    MODDATP+1    ;register for 'MSP' speed if enabled
  277. ;
  278.       MVI    A,03H        ;8-level, 1 stop bit, no parity
  279.       OUT    MODDATP+3    ;line control register
  280.       MVI    A,01H        ;set 'DTR' for proper modem output level
  281.       OUT    MODDATP+4    ;modem control register
  282.       EI            ;restore interrupts to normal
  283.       RET
  284. ;.....
  285. ;The following routine changes the baud rate for the H89 with the SET
  286. ; command.
  287. ;
  288. ;SETUPR = SPEED CHANGE
  289. SETUPR:      LXI    D,BAUDBUF    ;point to input buffer for INLNCOMP
  290.       CALL    JMP$ILPRT
  291.     IF DBUG
  292.       DB    '(DTR ON: Type ON) (DTR OFF: Type OFF)',CR,LF
  293.     ENDIF    ;DBUG
  294.       DB    'Input Baud Rate (300, 450, 600, 1200, 9600): ',0
  295.       CALL    JMP$INBUF
  296.       LXI    D,BAUDBUF+2
  297.       CALL    JMP$INLNCOMP    ;compare BAUDBUF+2 with characters below
  298.       DB    '300',0
  299.       JNC    OK300        ;go if got match
  300.       CALL    JMP$INLNCOMP
  301.       DB    '450',0
  302.       JNC    OK450
  303.       CALL    JMP$INLNCOMP
  304.       DB    '600',0
  305.       JNC    OK600
  306.       CALL    JMP$INLNCOMP
  307.       DB    '1200',0
  308.       JNC    OK1200
  309.       CALL    JMP$INLNCOMP
  310.       DB    '9600',0
  311.       JNC    OK9600
  312. ;
  313.     IF DBUG         ;not normally needed
  314.       CALL    JMP$INLNCOMP
  315.       DB    'ON',0
  316.       JNC    SETDTRH
  317.       CALL    JMP$INLNCOMP
  318.       DB    'OFF',0
  319.       JNC    SETDTRL
  320.     ENDIF    ;DBUG
  321. ;
  322.       CALL    JMP$ILPRT    ;all matches failed - tell operator
  323.       DB    '++ Incorrect entry ++',CR,LF,BELL,0
  324.       JMP    SETUPR        ;try again
  325. ;
  326. OK300:      MVI    A,1        ;MSPEED 300 baud value
  327.       LHLD    BD300        ;get 300 baud parameters in HL
  328.       JMP    LOADBD        ;go load them
  329. ;
  330. OK450:      MVI    A,2
  331.       LHLD    BD450
  332.       JMP    LOADBD
  333.  
  334. OK600:      MVI    A,3
  335.       LHLD    BD600
  336.       JMP    LOADBD
  337. ;
  338. OK1200:      MVI    A,5
  339.       LHLD    BD1200
  340.       JMP    LOADBD
  341. ;
  342. OK9600:      MVI    A,8
  343.       LHLD    BD9600
  344. ;
  345. LOADBD:      STA    INITMOD+1    ;store speed to show transfer time 
  346.       MOV    A,L        ;get least significant baud rate byte
  347.       STA    LSPSPD+1    ;store in INITMOD
  348.       MOV    A,H        ;get most signifcant baud rate byte
  349.       STA    MSPSPD+1    ;store in INITMOD
  350.       JMP    INITMOD        ;reset H89 8250
  351. ;
  352. ;
  353. ; Table of baud rate parameters
  354. ;
  355. BD300:      DW    0180H
  356. BD450:      DW    0100H
  357. BD600:      DW    00C0H
  358. BD1200:      DW    0060H
  359. BD9600:      DW    000CH
  360. ;
  361. BAUDBUF:  DB    10,0
  362.       DS    10
  363. ;
  364. ;
  365. ;RAISE DTR TO ENABLE MODEM
  366. ;
  367. SETDTRH:  MVI    A,01H
  368.       OUT    MODDATP+4    
  369.       RET
  370. ;
  371. ;DROP DTR TO DISABLE MODEM
  372. ;
  373. SETDTRL:  MVI    A,00H
  374.       OUT    MODDATP+4
  375.       RET
  376. ;            End of USART dependent routines
  377. ;=======================================================================
  378. ;
  379. ;             RACAL-VADIC DIALING ROUTINES
  380. ;
  381. ;=======================================================================
  382. ;
  383. ; Dialing routine
  384. ;
  385. DIAL:      XRA    A
  386.       STA    CRFLAG
  387.       STA    RINGBKFL
  388.       STA    RINGFLG
  389.       LXI    H,0
  390.       SHLD    DIALCT
  391.       LXI    H,CMDBUF+1
  392.       MOV    A,M
  393.       CPI    3+1
  394.       JC    DIAL1            ;if only CAL was entered
  395. ;
  396. ;
  397. ; If there were only 3 characters, then "CAL<RET>" was typed -- the user
  398. ; obviously expecting to get a phone number (or letter) from the library
  399. ; file.  If 4 or more, a number (or letter) was typed in from the menu
  400. ; command line, so move the characters down 4 to compensate.  Needed for
  401. ; auto-redialing of menu command line entries.
  402. ;
  403.       MOV    C,A
  404.       MVI    B,0
  405.       SUI    4
  406.       MOV    M,A
  407.       INX    H
  408.       XCHG
  409.       LXI    H,CMDBUF+6
  410.       CALL    MOVER
  411.       JMP    DIAL4            ;with letter or number at CMDBUF+2
  412. ;...
  413. ;
  414. ;
  415. ; Comes here if no phone number was manually entered after "CAL" and if
  416. ; no phone library letter was entered.    Displays the phone number li-
  417. ; brary, then asks for an entry.
  418. ;
  419. DIAL1:      MVI    C,13
  420.       LXI    H,NUMBLIB
  421.       LXI    D,BUFFER
  422.       CALL    NEWLINE
  423.       STAX    D
  424.       INX    D
  425. ;
  426. DIAL2:      MVI    B,LIBLEN
  427.       CALL    MOVE
  428.       CALL    SPACES
  429.       MVI    B,LIBLEN
  430.       CALL    MOVE
  431.       CALL    NEWLINE
  432.       DCR    C
  433.       JNZ    DIAL2
  434. ;
  435. DIAL3:      MVI    A,'$'
  436.       STAX    D
  437.       CALL    CLRTST        ;clear screen
  438.       MVI    C,PRINT
  439.       LXI    D,BUFFER    ;show library
  440.       CALL    BDOS
  441.       CALL    ILPRT
  442.       DB    CR,LF,'Enter library letter or phone number,',CR,LF
  443.       DB    'CTL-X quits while dialing or ringing: ',0
  444.       LXI    D,CMDBUF
  445.       CALL    INBUF        ;get input, library letter or phone #
  446. ;
  447. ;
  448. ; You now have either a library letter or a manually entered phone num-
  449. ; ber.    These either came from the menu command line or from the library
  450. ; command line.  Next we see if a letter, if so, get the corresponding
  451. ; line with phone number from the library.  If a number we ignore the
  452. ; library look-up.  (Ringback numbers must end with letter 'R'.)
  453. ;
  454. DIAL4:      LXI    H,CMDBUF+1
  455.       MOV    A,M
  456.       ORA    A
  457.       JZ    DIALEXIT    ;no entry in command line exit
  458.       PUSH    H
  459.       CALL    DISCONNT    ;hangup modem and drop DTR
  460.       POP    H
  461.       INX    H
  462.       MVI    B,'A'
  463.       MVI    E,0
  464.       MVI    C,26
  465.       MOV    A,M
  466. ;
  467. DIAL5:      CMP    B
  468.       JZ    DIAL6        ;If a letter
  469.       INR    B
  470.       INR    E
  471.       DCR    C
  472.       JZ    DIAL9        ;If a number
  473.       JMP    DIAL5
  474. ;
  475. ;
  476. ; Now have a match between the requested letter and one in the library
  477. ; E-reg. holds the decimal equivalent (1-26) of the letter (A-Z).
  478. ;
  479. DIAL6:      LXI    H,NUMBLIB    ;come here if a letter
  480.       LXI    B,LIBLEN
  481.       MOV    A,E
  482.       ORA    A
  483.       JZ    DIAL8
  484. ;
  485. DIAL7:      MOV    A,M
  486.       ORA    A
  487.       JZ    DIALBAD
  488.       DAD    B
  489.       DCR    E
  490.       JNZ    DIAL7
  491. ;
  492. ;
  493. ; Now have the line in the phone number library matching the requested
  494. ; letter so store that line starting at 'CMDBUF+1'
  495. ;
  496. DIAL8:      MVI    B,LIBLEN
  497.       LXI    D,CMDBUF+1
  498.       XCHG
  499.       MOV    M,B
  500.       XCHG
  501.       INX    D
  502.       CALL    MOVE
  503. ;
  504. ;
  505. ; Now have the full line including phone number in 'CMDBUF' area.
  506. ;
  507. DIAL9:      LDA    SMARTMODEM    ;comes here if CAL (number)
  508.       ORA    A
  509.       CNZ    SMINIT        ;turns DTR back on
  510. ;    
  511. DIAL10:      LXI    H,CMDBUF+1
  512.       MOV    E,M
  513.       INX    H
  514. ;
  515. DIAL11:      MOV    A,M
  516.       ORA    A
  517.       JZ    DIALBAD
  518. ;
  519. ;
  520. ; Dial a digit, check keyboard for abort
  521. ;
  522.       CALL    DIALA
  523.       CALL    STAT
  524.       JZ    DIAL13
  525.       CALL    KEYIN
  526.       CPI    CANCEL
  527.       JNZ    DIAL13
  528.       JMP    DIALEXIT
  529. ;
  530. DIAL13:      INX    H
  531.       DCR    E
  532.       JNZ    DIAL11
  533. ;
  534. ;
  535. ; Show the number of dial attempts
  536. ;
  537.       MVI    B,CR        ;end with cr to start dialing
  538.       CALL    TIMER5        ;preset delay (CEH)
  539.       CALL    SENDCHR
  540.       MVI    B,30        ;wait 3 sec for SmartCat to echo number
  541.       CALL    TIMER        ;...and gobble whatever
  542. ;
  543. EATIT:      CALL    JMP$INMODEM    ;gobble anything else that remains
  544.       JNC    EATIT
  545. ;
  546.       CALL    ILPRT
  547.       DB    ' - try #',0
  548.       LHLD    DIALCT
  549.       INX    H
  550.       SHLD    DIALCT
  551.       CALL    DECOUT
  552.       MVI    A,' '
  553.       CALL    TYPE
  554. ;
  555. DIAL14:   CALL    JMP$INMODEM    ;gobble some more if there
  556.       JNC    DIAL14
  557.       JMP    SMRESULT
  558. ;
  559. DIALAGN:  LDA    CRFLAG
  560.       ORA    A
  561.       JNZ    DIALAGN1
  562.       CALL    ILPRT
  563.       DB    ' Redial? '
  564.       DB    '(Y/N/C): ',BELL,0
  565.       CALL    KBDCHR
  566.       CALL    CRLF
  567.       CPI    'N'
  568.       JZ    DIALAGN2
  569.       CPI    'Y'
  570.       JZ    DIALAGN1
  571.       CPI    'C'
  572.       JNZ    DIALAGN
  573.       MVI    A,1
  574.       STA    CRFLAG
  575. ;
  576. DIALAGN1: MVI    B,35
  577.       CALL    TIMER
  578.       CALL    CRLF
  579.       LDA    RINGBKFL
  580.       ORA    A
  581.       JZ    DIAL4
  582.       STA    CMDBUF+1
  583.       JMP    DIAL4
  584. ;.....
  585. ;
  586. ;
  587. DIALAGN2: CALL    DIALBGN        ;disconnect the modem
  588.       JMP    MENU
  589. ;
  590. ;
  591. ; Connection has been made
  592. ;
  593. CONMADE:  CALL    ILPRT
  594.       DB    CR,LF,LF,'CONNECTION MADE',BELL,0
  595.       LDA    CRFLAG
  596.       ORA    A
  597.       JZ    RETURN
  598.       CALL    ILPRT
  599.       DB    ' - hit any key to stop the bell ',0
  600. ;
  601. CONMADE1: CALL    STAT
  602.       JZ    CONMADE2
  603.       CALL    KEYIN
  604.       XRA    A
  605.       JMP    RETURN
  606. ;
  607. CONMADE2: MVI    B,10
  608.       CALL    TIMER
  609.       MVI    A,BELL
  610.       CALL    TYPE
  611.       JMP    CONMADE1
  612. ;.....
  613. ;
  614. ;
  615. ; Automatic dialing routine, prints the number being dialed
  616. ;
  617. DIALA:      CALL    TYPE        ;comes here with character in A
  618.       CPI    'R'
  619.       JNZ    DIALA1
  620.       PUSH    PSW
  621.       MOV    A,E
  622.       CPI    1        ;was 'R' last character?
  623.       JZ    RINGBK
  624.       POP    PSW
  625. ;
  626. DIALA1:      MOV    B,A
  627.       CALL    DIALAD
  628.       MOV    A,B
  629.       CPI    '*'        ;* is valid dial digit, must not be in name
  630.       JZ    DIALA2
  631.       CPI    '#'        ;# is valid dial digit, must not be in name
  632.       JZ    DIALA2
  633.       CPI    'I'        ;I indicates pulse dialing is requested.
  634.       JZ    DIALA2        ;all I's, P's, and W's
  635.       CPI    'P'        ;in the library names MUST be lower case.
  636.       JZ    DIALA2
  637.       CPI    'W'
  638.       JZ    DIALA2
  639.       CPI    '0'
  640.       RC
  641.       CPI    '9'+1
  642.       RNC
  643. ;
  644. ;
  645. ; Must be a number.  Send it to the modem
  646. ;
  647. DIALA2:
  648.       MOV    C,A
  649.       CALL    TIMER5        ;preset delay (CEH)
  650.       JMP    SENDCHR     ;In main program. RETs to caller
  651. ;
  652. ;
  653. ; Print bad library number message and abort if a null is encountered.
  654. ;
  655. DIALBAD:  CALL    ILPRT
  656.       DB    CR,LF,'++ Bad library number called ++',CR,LF,0
  657. ;
  658. DIALEXIT: CALL    DISCONNT
  659. ;
  660. DIALEXT1: CALL    CRLF
  661.       XRA    A
  662.       STA    CRFLAG
  663. ;
  664. DIALEXT2: CALL    JMP$INMODEM
  665.       JNC    DIALEXT2
  666.       CALL    JMP$GOODBYE
  667.       JMP    MENU
  668. ;.....
  669. ;
  670. ;
  671. DIALBGN:  JMP    DISCONNT
  672. ;
  673. ;
  674. ; Do any alternate dialing such as 'MCI' or 'SPRINT'
  675. ;
  676. DIALAD:      MOV    A,B
  677.       CPI    '<'
  678.       JNZ    DIALAD1
  679.       PUSH    H
  680.       LXI    H,ALTDIAL1
  681.       JMP    DIALAD2
  682. ;
  683. DIALAD1:  CPI    '>'
  684.       RNZ
  685.       PUSH    H
  686.       LXI    H,ALTDIAL2
  687. ;
  688. DIALAD2:  MOV    A,M
  689.       CPI    '$'
  690.       JZ    DIALAD3
  691.       CALL    TYPE
  692.       MOV    B,A
  693.       CALL    TIMER5        ;preset delay (CEH)
  694.       CALL    SENDCHR     ;In main program
  695.       INX    H
  696.       CALL    STAT
  697.       JZ    DIALAD2
  698.       CALL    KEYIN
  699.       CPI    CANCEL
  700.       JZ    DIALEXIT
  701.       JMP    DIALAD2
  702. ;
  703. DIALAD3:  MVI    A,' '
  704.       CALL    TYPE
  705.       POP    H
  706.       RET
  707. ;.....
  708. ;
  709. ;
  710. ; Provide a preset delay between command characters to the modem (CEH)
  711. ; (See header for usege)
  712. ;
  713. TIMER5:
  714.       PUSH    H    ;Save all registers
  715.       PUSH    D
  716.       PUSH    B
  717.       PUSH    PSW
  718.       MVI    A,TDELAY    ;Get selected delay value
  719.       ANA    A        ;Zero?
  720.       JZ    TIMER5A     ;If so - no delay
  721.       MOV    B,A        ;Number of 100 mS intervals
  722.       CALL    TIMER
  723. TIMER5A:  POP    PSW    ;Restore registers
  724.       POP    B
  725.       POP    D
  726.       POP    H
  727.       RET
  728. ;.....
  729. ;
  730. ;
  731. ; Disconnect the Smartmodem from the phone line
  732. ;
  733. GOODBYE:
  734. DISCONNT: CALL    SETDTRH     ;in case it wasn't
  735. ;(disbled)LXI    H,DISC0     ;send the hangup command
  736. ;(disbled)CALL    SENDMDM
  737. ;
  738.       CALL    TIMER5        ;delay some and
  739. DISCONN2: CALL    JMP$INMODEM    ;gobble any return garbage
  740.       JNC    DISCONN2
  741.       CALL    SETDTRL     ;now drop the DTR
  742.       MVI    B,35        ;and give modem time to
  743.       CALL    TIMER        ;reinitialize
  744.       RET
  745. ;.....
  746. ;
  747. ;
  748. DISC0:      DB    '%H',CR,'$'    ;not called if disabled above but is
  749. ;.....                ;used by the HANGUP routine.
  750. ;
  751. ;
  752. ; Set Smartmodem for dialing
  753. ;
  754. SMINIT:      CALL    SETDTRH        ;enable dtr
  755.       LXI    H,SM$DAL1    ;put out the dial command
  756.       CALL    SENDMDM
  757.       RET
  758. ;
  759. SMINIT1:  RET
  760. ;.....
  761. ;
  762. ;
  763. SM$DAL1:  DB    '%D ','$'      ;send the <CM>, DIAL command, and SPACE
  764. ;
  765. ;
  766. ; Send the string pointed to by 'HL' to both the CRT and the modem.
  767. ;
  768. SENDOUT:  PUSH    H
  769.       CALL    SENDNOW
  770.       POP    H
  771.       MOV    A,M
  772.       CPI    '$'
  773.       RZ
  774.       MOV    A,M
  775.       CALL    TIMER5        ;preset delay between string char (CEH)
  776.       CALL    OUT$MODDATP    ;Call to main program
  777.       CALL    TYPE
  778.       INX    H
  779.       JMP    SENDOUT
  780. ;.....    
  781. ;
  782. ;
  783. ; Send the string pointed to by 'HL' to the modem only
  784. ;
  785. SENDMDM:  PUSH    H
  786.       CALL    SENDNOW
  787.       POP    H
  788.       MOV    A,M
  789.       CPI    '$'
  790.       RZ
  791.       CALL    TIMER5        ;preset delay between string char (CEH)
  792.       CALL    OUT$MODDATP    ;Call to main program
  793.       INX    H
  794.       JMP    SENDMDM
  795. ;......
  796. ;
  797. ;
  798. ; Checks for answer from Smartmodem
  799. ;
  800. SMRESULT: LXI    H,RESULBUF
  801.       PUSH    H
  802. ;
  803. SMRESUL2: CALL    RCVREADY    ;loop here 'till something happens
  804.       JZ    SMRESUL1
  805.       CALL    STAT
  806.       JZ    SMRESUL2
  807.       CALL    KEYIN
  808.       CPI    CANCEL
  809.       JNZ    SMRESUL2
  810.       MVI    B,CR
  811.       CALL    TIMER5        ;preset delay (CEH)
  812.       CALL    SENDCHR     ;Call to main program
  813.       POP    H
  814.       JMP    DIALEXT1
  815. ;
  816. RESULBUF: DS    16
  817. ;
  818. SMRESUL1: CALL    JMP$INMODEM
  819.       JC    SMRESUL4    ;no more characters coming
  820. ;
  821. SMRESUL6: ANI    7FH
  822.       CPI    ' '
  823.       JZ    SMRESUL1    ;throw away spaces, lf, cr, nuls
  824.       CPI    LF        ;bell, %, and * in the resulbuf
  825.       JZ    SMRESUL1
  826.       CPI    00H
  827.       JZ    SMRESUL1
  828.       CPI    '*'
  829.       JZ    SMRESUL1
  830.       CPI    CR
  831.       JZ    SMRESUL1
  832.       CPI    BELL
  833.       JZ    SMRESUL1
  834.       CPI    '%'
  835.       JZ    SMRESUL1
  836.       POP    H
  837.       MOV    M,A
  838.       INX    H
  839.       PUSH    H
  840.       JMP    SMRESUL1    ;get next char for RESULBUF
  841. ;
  842. ;
  843. ; Compare the SmartCat response
  844. ;
  845. SMRESUL4: POP    H
  846.       LXI    D,RESULBUF
  847.       CALL    INLNCOMP
  848.       DB    'OK',0            ;should never happen in dialing
  849.       JNC    DISCONNT        ;....routine
  850.       CALL    INLNCOMP
  851.       DB    'BUSY',0        ;busy response
  852.       JNC    NUM$BUSY
  853.       CALL    INLNCOMP
  854.       DB    'NO AN',0        ;no answer
  855.       JNC    FAILCAL
  856.       CALL    INLNCOMP
  857.       DB    'NO DI',0        ;no dialtone
  858.       JNC    NO$DT
  859.       CALL    INLNCOMP
  860.       DB    'RI',0             ;ringing...
  861.       JNC    RING
  862.       CALL    INLNCOMP
  863.       DB    'CONNECT',0        ;connection made...
  864.       JNC    CONMADE
  865.       CALL    INLNCOMP
  866.       DB    'CONN L',0        ;connection lost...
  867.       JNC    CARLOST
  868. ;
  869. SMDM1:      JMP    FAILCAL
  870. ;.....
  871. ;
  872. ;
  873. ; Carrier lost is a result of the remote end hanging up or a failure
  874. ; in the telephone circuit.  This is reported by the SmartCat.
  875. ;
  876. CARLOST:  CALL    CRLF
  877.       CALL    ILPRT
  878.       DB    'Connection lost....',0
  879.       JMP    DISCONNT
  880. ;.....
  881. ;
  882. ;
  883. ; Failed call is the result of no answer after 60 sec of ringing, wrong
  884. ; baud rate, or an incorrect response from the modem.
  885. ;
  886. FAILCAL:  CALL    CRLF
  887.       CALL    ILPRT
  888.       DB    'No answer... Failed call....',0
  889.       JMP    DIALAGN
  890. ;
  891. ;
  892. ; No dial tone can occur when using the alternate dialing option and a
  893. ; dial tone is not detected after the pause 'P' or within 5 sec after
  894. ; the start of the modem dialing routine
  895. ;
  896. NO$DT:      CALL    CRLF
  897.       CALL    ILPRT
  898.       DB    'No dial tone present....',0
  899.       JMP    DIALAGN
  900. ;
  901. NUM$BUSY: CALL    CRLF
  902.       CALL    ILPRT
  903.       DB    'Number busy....',0
  904.       JMP    DIALAGN
  905. ;
  906. RING:      CALL    CRLF
  907.       CALL    ILPRT
  908.       DB    'Ringing....',0
  909.       LDA    RINGFLG
  910.       ORA    A
  911.       JZ    SMRESULT
  912.       JMP    RINGBK1
  913. ;
  914. ;
  915. ; Handles the special ringback numbers.  Dials, lets it ring only once,
  916. ; hangs up and then redials.
  917. ;
  918. RINGFLG:  DB    0
  919. ;
  920. RINGBK:      POP    PSW
  921.       LDA    CMDBUF+1
  922.       STA    RINGBKFL
  923.       STA    RINGFLG
  924.       SUI    1
  925.       STA    CMDBUF+1
  926.       RET
  927. ;.....
  928. ;
  929. ;
  930. ; Hang up and redial
  931. ;
  932. RINGBK1:  CALL    CRLF
  933.       CALL    ILPRT
  934.       DB    'Ringback active - hanging up on first ring....',0
  935.       CALL    HANGUP
  936.       MVI    B,50
  937.       CALL    TIMER
  938.       CALL    CRLF
  939.       JMP    DIAL9
  940. ;.....
  941. ;
  942. ;
  943. HANGUP:   MVI    B,CR        ;abort the dialing process
  944.       CALL    SENDCHR
  945.       CALL    TIMER5        ;delay some
  946.       LXI    H,DISC0     ;send the hangup command
  947.       CALL    SENDMDM
  948.       XRA    A
  949.       STA    RINGFLG        ;clear flag for next dial
  950.       CALL    TIMER5        ;wait some
  951. ;
  952. HANGUP1:  CALL    JMP$INMODEM    ;wait for the modem to complete its
  953.       JNC    HANGUP1     ;response to the abort
  954.       JMP    DISCONNT    ;return here
  955. ;.....
  956. ;
  957. ;
  958. ; Time-out routine.  Must be called with mask in 'D' reg. for input at
  959. ; relative port 2 and number of seconds (times 10) in 'C' reg.
  960. ;
  961. WAIT:      MVI    B,2
  962.       CALL    TIMER
  963.       CALL    IN$MODCTL1
  964.       ANA    D
  965.       RZ
  966.       PUSH    B
  967.       PUSH    D
  968.       CALL    STAT
  969.       JZ    WAIT1
  970.       CALL    KEYIN
  971.       CPI    CANCEL
  972.       JZ    WAIT2
  973. ;
  974. WAIT1:      POP    D
  975.       POP    B
  976.       DCR    C
  977.       JNZ    WAIT
  978.       STC
  979.       RET
  980. ;.....
  981. ;
  982. ;
  983. WAIT2:      POP    D
  984.       POP    B
  985.       JMP    DONETCD
  986. ;.....
  987. ;
  988. ;
  989. ; Patch for SETUPENT: to prevent sending of Hayes commands to SmartCat
  990. ;
  991. ;
  992.       ORG    404BH
  993. ;
  994. ;
  995. SETUPENT: LDA    SETUPTST
  996.       ORA    A
  997.       JZ    NOTVLD
  998.       CALL    JMP$SETUPR
  999.       JMP    XPRT
  1000. ;
  1001. NOTVLD:      EQU    39A3H
  1002. ;
  1003. ;
  1004. ; Lets fix the byebye routine it calls GOODBYE: directly  and not
  1005. ; through the jump vectors at the begining
  1006. ;
  1007. ;
  1008.       ORG    39C6H
  1009. ;
  1010. ;
  1011. BYEBYE:      LDA    PMMIMODEM
  1012.       ORA    A
  1013.       CNZ    JMP$GOODBYE
  1014.       LDA    SMARTMODEM
  1015.       ORA    A
  1016.       CNZ    JMP$GOODBYE
  1017.       CALL    ILPRT
  1018.       DB    CR,LF,'<<Exit to CP/M>>',CR,LF,0
  1019.       JMP    EXIT
  1020. ;.....
  1021. ;
  1022. ;
  1023. ; Fix for ILPRT: when exits routine the stack dose not contain the cor-
  1024. ; rect location of the next instruction.  Shouldn't make any difference
  1025. ; as points to NOP, but?
  1026. ;
  1027. ;
  1028.       ORG    262EH
  1029. ;
  1030. ;
  1031. ILPRT:      XTHL
  1032. ;
  1033. ILPRT1:      MOV    A,M
  1034.       INX    H
  1035.       ORA    A
  1036.       JZ    ILPRT2
  1037.       CALL    CTYPE
  1038.       JMP    ILPRT1
  1039. ;
  1040. CTYPE:      EQU    257BH
  1041. ILPRT2      EQU    263BH
  1042. ;
  1043. ;
  1044. ; Fix for DONETCD: the routines GOODBYE: and DISCONNT: are the same so
  1045. ; no need to call twice.
  1046. ;
  1047. ;
  1048.       ORG    2511H
  1049. ;
  1050. ;
  1051. DONETCD:  CALL    ILPRT
  1052.       DB    CR,LF,'<< DISCONNECTED >>',BELL,CR,LF,0
  1053.       CALL    JMP$GOODBYE
  1054.       JMP    MENU0
  1055. ;
  1056. MENU0:      EQU    2CB6H
  1057. ;
  1058. ;
  1059. ; M712RACL.ASM uses these routines located in the main program
  1060. ;
  1061. TIMER:      EQU    0B80H        ;timer routine
  1062. INLNCOMP: EQU    2A2BH        ;compare routine
  1063. ILPRT:      EQU    262EH        ;print string routine
  1064. CRLF:      EQU    2588H        ;print crlf
  1065. CMDBUF:      EQU    42F8H        ;cmd buffer
  1066. RINGBKFL: EQU    42F4H        ;ring back flag
  1067. KEYIN:      EQU    25A0H        ;kbd input
  1068. STAT:      EQU    2595H        ;console status
  1069. SENDCHR:  EQU    26B7H        ;send character
  1070. RCVREADY: EQU    188DH        ;reciever ready
  1071. INMODEM:  EQU    1AD2H        ;in modem
  1072. KBDCHR:      EQU    25C1H        ;wait for keyboard input
  1073. CRFLAG:      EQU    42E5H        ;cr flag
  1074. ALTDIAL1: EQU    0BD0H        ;alt dial 1
  1075. ALTDIAL2: EQU    0BE8H        ;alt dial 2
  1076. TYPE:      EQU    25B4H        ;type
  1077. MENU:      EQU    2CFDH        ;menu
  1078. NUMBLIB:  EQU    0C00H        ;number library
  1079. BUFFER:      EQU    4700H
  1080. CLRTST:      EQU    41B7H        ;clear screen test
  1081. MOVER:      EQU    2AFAH        ;move routine
  1082. MOVE:      EQU    26AEH
  1083. SPACES:      EQU    415DH
  1084. INBUF:      EQU    2951H
  1085. DECOUT:      EQU    25D4H
  1086. INBUF:      EQU    2951H
  1087. NXTSCRN:  EQU    4187H
  1088. RETURN:      EQU    14CAH
  1089. SENDNOW:  EQU    189FH
  1090. DONETCD:  EQU    2511H
  1091. DIALCT:      EQU    42DAH
  1092. NEWLINE:  EQU    4154H
  1093. START:      EQU    0F75H        ;start
  1094. EXIT:      EQU    2671H
  1095. XPRT:      EQU    382FH
  1096. ;
  1097.       END
  1098.