home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / bye3 / b3cc-2.ins < prev    next >
Encoding:
Text File  |  1994-07-13  |  4.8 KB  |  178 lines

  1.  
  2. ; B3CC-2.INS - BYE3 insert for CCS-2719 and SDS Z80-SIO - 07/30/85
  3. ;
  4. ;          Z80-SIO and 8430 CTC timer
  5. ;
  6. ; This version is for both the CCS-2719 and Sierra Data Science S-100
  7. ; serial I/O boards.  Note:  This is an insert, not an overlay.
  8. ;
  9. ;    In order to use the CCS-2719 with the Smartmodem,  we must
  10. ;    change the hardware somewhat.  The header block on the 2719
  11. ;    must be turned over so the port configuration is for DTE
  12. ;    (DATA TERMINAL EQUIPMENT).  Further, the standard CCS-2719
  13. ;    presents DSR from the DB25 to DCD of the SIO. Bye3 requires
  14. ;    the actual DCD from pin 8 of the DB25, Therefore we must
  15. ;    remove the jumper in the header block from pins 1 and 15 and add
  16. ;    a wire from pin 15 of the flat cable header.  (Pin 8 of the DB25)
  17. ;    to pin 1 of the header block.  This will put the modem's DCD signal
  18. ;    to the SIO's DCD input. Refer to the CCS-2719 schematic in your user's
  19. ;    manual.                - Joe Wright
  20. ;
  21. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  22. ;
  23. ; Select one of the following with YES or NO
  24. ;
  25. CCS    EQU    YES        ; CCS2719 at 3.6864 MHz for Counter mode
  26. SIERRA    EQU    NO        ; Sierra Data Science at 4.000 MHz
  27. ;
  28. ; Set base port for SIO & CTC chips
  29. ;
  30.      IF    CCS
  31. DPORT    EQU    54H        ; Data port
  32. SPORT    EQU    DPORT+1        ; Modem satus port
  33. BRPORT    EQU    50H        ; Baud rate generator port (CTC)
  34.      ENDIF            ; CCS
  35. ;
  36.      IF    SIERRA
  37. DPORT    EQU    82H        ; Data port
  38. SPORT    EQU    DPORT+1        ; Modem status port
  39. BRPORT    EQU    89H        ; Baud rate generator port (CTC)
  40.      ENDIF            ; SIERRA
  41. ;
  42. DAV    EQU    00000001B    ; Data available
  43. TBMT    EQU    00000100B    ; Transmit buffer empty
  44. DCD    EQU    00001000B    ; Data carrier detect
  45.                 ; [If you have problems, change to 00100000B]
  46. ;
  47. ; To access CTC baud rate command - Note, the CCS 2719 uses the 3.6864
  48. ; MHz xtal for the counter mode and the 4.000 MHz xtal for the timer
  49. ; mode.  The SDS board uses the 4.000 MHz master clock for both.
  50. ;
  51. ; The following assume CCS2719 oscillator at 1.8432 MHz.
  52. ;
  53.      IF    CCS
  54. BD300    EQU    0734H        ; 300 baud  (4.000 xtal, rest 1.8432)
  55. BD1200    EQU    4760H        ; 1200 baud
  56. BD2400    EQU    4730H        ; 2400 baud
  57.      ENDIF
  58. ;
  59. ; The following assume    SIERRA DATA SCIENCE oscillator at 4.000 MHz.
  60. ;
  61.      IF    SIERRA
  62. BD300    EQU    0734H        ; 300 baud
  63. BD1200    EQU    4768H        ; 1200 baud
  64. BD2400    EQU    4734H        ; 2400 baud
  65.      ENDIF
  66. ;
  67. ;-----------------------------------------------------------------------
  68. ;
  69. ; See if we still have a carrier - if not, return with the zero flag set
  70. ;
  71. MDCARCK:MVI    A,10H        ; Reset status
  72.     OUT    SPORT
  73.     IN    SPORT        ; Get status
  74.     ANI    DCD        ; Check for carrier
  75.     RZ
  76.     ORI    255
  77.     RET
  78. ;
  79. ; Disconnect and wait for an incoming call
  80. ;
  81. MDINIT:    MVI    A,0        ; Setup to write register 0
  82.     OUT    SPORT
  83.     MVI    A,18H        ; Reset channel
  84.     OUT    SPORT
  85.     MVI    A,4        ; Setup to write register 4
  86.     OUT    SPORT
  87.     MVI    A,44H        ; Set 16x, 1 stop bit, no parity
  88.     OUT    SPORT
  89.     MVI    A,3        ; Setup to write register 3
  90.     OUT    SPORT
  91.     MVI    A,0C1H        ; 8 bits, Rx enable
  92.     OUT    SPORT
  93.     MVI    A,5        ; Setup to write register 5
  94.     OUT    SPORT
  95.     MVI    A,68H        ; DTR off
  96.     OUT    SPORT
  97. ;
  98.     PUSH    B        ; Save in case it's being used elsewhere
  99.     MVI    B,20        ; 2 second delay to drop any carrier
  100. OFFTI:    CALL    DELAY        ; 1 second delay
  101.     DCR    B
  102.     JNZ    OFFTI        ; Keep looping until finished
  103.     POP    B        ; Restore 'BC'
  104. ;
  105.     MVI    A,5        ; Setup to write register 5
  106.     OUT    SPORT
  107.     MVI    A,0E8H        ; Turn DTR back on
  108.     OUT    SPORT
  109. ;
  110.      IF    IMODEM        ; If using an intellegent modem
  111.     CALL    IMINIT        ; Go initialize it now
  112.      ENDIF            ; IMODEM
  113. ;
  114.     RET
  115. ;
  116. ; Input a character from the modem port
  117. ;
  118. MDINP:    IN    DPORT        ; Get character
  119.     RET
  120. ;
  121. ; Check the status to see if a character is available. If not, return
  122. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  123. ;
  124. MDINST:    IN    SPORT        ; Get status
  125.     ANI    DAV        ; Got a character
  126.     RZ            ; Return if none
  127.     ORI    255        ; Otherwise set the proper flag
  128.     RET
  129. ;
  130. ; Send a character to the modem
  131. ;
  132. MDOUTP:    OUT    DPORT        ; Send it
  133.     RET
  134. ;
  135. ; See if the output is ready for another character
  136. ;
  137. MDOUTST:IN    SPORT        ; Get status
  138.     ANI    TBMT        ; Ready for a character?
  139.     RZ
  140.     ORI    255
  141.     RET
  142. ;
  143. ; Reinitialize the modem and hang up the phone by dropping DTR and
  144. ; leaving it inactive.
  145. ;
  146. MDQUIT:     IF    IMODEM
  147.     CALL    IMQUIT
  148.      ENDIF            ; IMODEM
  149. ;
  150. ;
  151. ; Called by the main program after caller types BYE
  152. ;
  153. MDSTOP:    MVI    A,5        ; Setup to write register 5
  154.     OUT    SPORT
  155.     MVI    A,68H        ; Turn off DTR until next time
  156.     OUT    SPORT
  157.     RET
  158. ;
  159. ; The following routine sets the baudrate.  BYE3 asks for the maximum
  160. ; speed you have available.
  161. ;
  162. SET300:    LXI    H,BD300        ; Set for 300 baud
  163.     JMP    SETBAUD
  164. ;
  165. SET1200:LXI    H,BD1200    ; Set for 1200 baud
  166.     JMP    SETBAUD
  167. ;
  168. SET2400:LXI    H,BD2400    ; Set for 2400 baud
  169. ;
  170. SETBAUD:MOV    A,H
  171.     OUT    BRPORT        ; Set CTC mode
  172.     MOV    A,L
  173.     OUT    BRPORT        ; Set actual speed
  174.     XRA    A        ; Say rate is ok
  175.     RET
  176. ;                   end
  177. ;-----------------------------------------------------------------------
  178.