home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / bye3 / b3cp-2.ins < prev    next >
Text File  |  1994-07-13  |  6KB  |  238 lines

  1. ; B3CP-2.INS -    Interfacer 3/4 insert for BYE3 - 07/24/85
  2. ;
  3. ;       2651 I/O with internal baudrage generator
  4. ;
  5. ;         For: CompuPro Interfacer 3
  6. ;              CompuPro Interfacer 4
  7. ;              CompuPro System Support 1
  8. ;
  9. ; Note:  This is an insert, not an overlay.
  10. ;
  11. ;
  12. ; The Interfacer board uses the 2651 I/O.  This has a peculiarity that
  13. ; prevents its proper use if you hook pin 8 (DCD) of the modem to pin 8
  14. ; (DCD) of the Interfacer board.  You should instead hook pin 8 of the
  15. ; modem (DCD) to (DSR) on the Interfacer board.
  16. ;
  17. ; Note for inteligent modem users:
  18. ; -------------------------------
  19. ;    In the past  people  using the intelligent  modems and the
  20. ;    Interfacer board have complained they had to put SW6 up to
  21. ;    use with BYE3 but then had to put it down to use with MEX,
  22. ;    MDM7 or other autodial modem programs.    With the configur-
  23. ;    ation below, SW6 can be left in whatever position the user
  24. ;    prefers (up, for BYE3) and this will have no effect on the
  25. ;    normal use of MEX or MDM7.
  26. ;
  27. ;    Using factory settings, a cable should be made like this:
  28. ;
  29. ;    TXD    2  -->    3    RXD    received data    
  30. ;    RXD    3  <--    2    TXD    tranmitted data
  31. ;    SG    7  ---    7    SG    signal ground
  32. ;    DCD    8  -->    20      DSR    data set ready (carrier)
  33. ;    DTR    20 <--    6       DTR    data terminal ready
  34. ;
  35. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  36. ;
  37. ; 07/25/85  Updated for BYE337 - removed ANI 127's    - Paul Traina
  38. ; 10/04/82  Original version                - Paul Traina
  39. ;
  40. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  41. ;
  42. INTER4    EQU    YES        ; Yes for Compupro Interfacer 3 or 4
  43.                 ; No  for Compupro System Support 1
  44. ;
  45. ; The following define the port address and usart number to use.
  46. ;
  47.      IF    INTER4
  48. BASEP    EQU    010H        ; Base port for Interfacer 3/4 boards
  49. CHIP    EQU    6        ; Chip number to use
  50.      ENDIF            ; INTER4
  51. ;
  52.      IF    NOT INTER4
  53. BASEP    EQU    05CH        ; Base port for System Support 1
  54.      ENDIF            ; NOT INTER4
  55. ;
  56. ;-----------------------------------------------------------------------
  57. ;
  58. ; Modem port equates
  59. ;
  60. DPORT    EQU    BASEP        ; Modem data port
  61. SPORT    EQU    BASEP+1        ; Modem status port
  62. MPORT    EQU    BASEP+2        ; Modem mode select port
  63. CPORT    EQU    BASEP+3        ; Modem control port
  64. ;
  65.      IF    INTER4
  66. UPORT    EQU    BASEP+7        ; Modem chip select port
  67.      ENDIF            ; INTER4
  68. ;
  69. ;    Status port equates
  70. ;
  71. TBMT    EQU    00000001B    ; Transmit buffer empty
  72. DAV    EQU    00000010B    ; Data available
  73. DSCHG    EQU    00000100B    ; Change in DSR or DCD or shift reg empty
  74. PE    EQU    00001000B    ; Parity error
  75. OE    EQU    00010000B    ; Overrun error
  76. FE    EQU    00100000B    ; Framing error
  77. DCD    EQU    01000000B    ; Data carrier detect line (not used)
  78. DSR    EQU    10000000B    ; Data carrier detect (this is really DSR)
  79. ;
  80. ;    Mode port equates
  81. ;
  82. B8NO1    EQU    01001110B    ; 8 data bits, no parity, 1 stop bit
  83. BBASE    EQU    00110000B    ; Transmit & Receive clocks internal
  84. BX300    EQU    BBASE+5        ; 300 baud
  85. BX1200    EQU    BBASE+7        ; 1200 baud
  86. BX2400    EQU    BBASE+10    ; 2400 baud
  87. ;
  88. ;    Control port equates
  89. ;
  90. CBASE    EQU    00000101B    ; Normal mode, no error reset, xmit&rcv on
  91. DTR    EQU    00000010B    ; Data terminal ready
  92. RTS    EQU    00100000B    ; Request to send line
  93. ;
  94. ;-----------------------------------------------------------------------
  95. ;
  96. ; See if we still have a carrier - if not, return with the zero flag set
  97. ;
  98. MDCARCK: IF    INTER4
  99.     MVI    A,CHIP        ; Select proper chip
  100.     OUT    UPORT
  101.      ENDIF
  102. ;
  103.     IN    SPORT        ; Get status
  104.     ANI    DSR        ; Check DSR pin for carrier
  105.     RZ
  106.     ORI    255
  107.     RET
  108. ;
  109. ; Disconnect and wait for an incoming call
  110. ;
  111. MDINIT:     IF    INTER4
  112.     MVI    A,CHIP        ; Select proper chip
  113.     OUT    UPORT
  114.      ENDIF
  115. ;
  116.     MVI    A,CBASE        ; DTR, RTS off to disconnect phone
  117.     OUT    CPORT
  118. ;
  119.     PUSH    B
  120.     MVI    B,20        ; Wait 2 seconds
  121. OFFTI:    CALL    DELAY
  122.     DCR    B
  123.     JNZ    OFFTI
  124.     POP    B
  125. ;
  126.     MVI    A,CBASE+DTR+RTS    ; Turn DTR & RTS back on
  127.     OUT    CPORT
  128. ;
  129.      IF    IMODEM
  130.     CALL    IMINIT        ; Initialize intelligent modem
  131.      ENDIF            ; IMODEM
  132. ;
  133.     RET
  134. ;
  135. ; Input a character from the modem port
  136. ;
  137. MDINP:     IF    INTER4
  138.     MVI    A,CHIP        ; Select proper chip
  139.     OUT    UPORT
  140.      ENDIF            ; INTER4
  141. ;
  142.     IN    DPORT        ; Get character (do not strip 8th bit)
  143.     RET
  144. ;
  145. ; Check the status to see if a character is available.    If not, return
  146. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  147. ;
  148. MDINST:     IF    INTER4
  149.     MVI    A,CHIP        ; Select proper chip
  150.     OUT    UPORT
  151.      ENDIF
  152. ;
  153.     IN    SPORT        ; Get status
  154.     ANI    DAV        ; Check data available bit
  155.     RZ
  156.     ORI    255        ; We got something
  157.     RET
  158. ;
  159. ; Send a character to the modem
  160. ;
  161. MDOUTP:     IF    INTER4
  162.     PUSH    PSW
  163.     MVI    A,CHIP        ; Select proper chip
  164.     OUT    UPORT
  165.     POP    PSW
  166.      ENDIF
  167. ;
  168.     OUT    DPORT        ; Send it
  169.     RET
  170. ;
  171. ; See if the output is ready for another character
  172. ;
  173. MDOUTST: IF    INTER4
  174.     MVI    A,CHIP        ; Select proper chip
  175.     OUT    UPORT
  176.      ENDIF
  177. ;
  178.     IN    SPORT        ; Get status
  179.     ANI    TBMT        ; Check transmit ready bit
  180.     RZ
  181.     ORI    255        ; Make sure we know it's ok
  182.     RET
  183. ;
  184. ; Reinitialize the modem and hang up the phone by dropping DTR and
  185. ; leaving it inactive.
  186. ;
  187. MDQUIT:     IF    INTER4
  188.     MVI    A,CHIP        ; Select proper chip
  189.     OUT    UPORT
  190.      ENDIF
  191. ;
  192.      IF    IMODEM
  193.     CALL    IMQUIT        ; Tell modem to shut down
  194.      ENDIF
  195. ;
  196. ; Called by the main program after caller types BYE
  197. ;
  198. MDSTOP:     IF    INTER4
  199.     MVI    A,CHIP
  200.     OUT    UPORT
  201.      ENDIF
  202. ;
  203.     MVI    A,CBASE        ; Turn off DTR & RTS, modem will quit
  204.     OUT    CPORT
  205.     RET
  206. ;
  207. ; The following routine sets the baudrate.  BYE3 asks for the maximum
  208. ; speed you have available.
  209. ;
  210. SET300:    CALL    BBAUD        ; Set word length
  211.     MVI    A,BX300        ; Set baud rate
  212.     JMP    EBAUD
  213. ;
  214. SET1200:CALL    BBAUD        ; Set word length
  215.     MVI    A,BX1200    ; Set baud rate
  216.     JMP    EBAUD
  217. ;
  218. SET2400:CALL    BBAUD        ; Set word length
  219.     MVI    A,BX2400    ; Set baud rate
  220.     JMP    EBAUD
  221. ;
  222. BBAUD:     IF    INTER4
  223.     MVI    A,CHIP        ; Select proper chip
  224.     OUT    UPORT
  225.      ENDIF
  226. ;
  227.     IN    CPORT        ; Make sure we've flip/flopped mode port
  228.     MVI    A,B8NO1        ; 1 stop, no parity 8 bits
  229.     OUT    MPORT
  230.     RET
  231. ;
  232. EBAUD:    OUT    MPORT        ; Send baud rate
  233.     XRA    A
  234.     RET
  235. ;
  236. ;    end
  237. ;----------------------------------------------------------------
  238.