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 / BBSING / MBBS / MBDCH1-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  6KB  |  206 lines

  1. ;***********************************************************************
  2. ;
  3. ;             MBYE (Modular BYE)
  4. ;         D. C. Hayes MicroModem 100 Interface routines
  5. ;              Version 1.6 by Paul Traina
  6. ;
  7. ; These routines will allow the easy patching of BYE3 for any type of
  8. ; modem/serial port combination.  Certain routines must return status
  9. ; flags, so please be careful to set the flags as directed.
  10. ;
  11. ; This version is for the D.C. Hayes MM100 and 80-103a modem cards.  It
  12. ; is an adaptation of the routines present in BYE version 8.0
  13. ;
  14. ;-----------------------------------------------------------------------
  15. ;
  16. ; 11/27/83  Altered and renamed to work with BYE3.    - Irv Hoff    
  17. ; 08/04/83  Updated to work with ByeII version 1.6    - Paul Traina
  18. ; 04/16/83  Housekeeping and some code optimization    - Paul Traina
  19. ; 11/04/82  Routines added, no fuss, mess, or frills.    - Paul Traina
  20. ;
  21. ;-----------------------------------------------------------------------
  22. ;
  23. ; The following define the port address and USART number to use.
  24. ;
  25. BASEP    EQU    80H        ;Base port for modem card
  26. ;
  27. ;***********************************************************************
  28. ;
  29. ; Port equates
  30. ;
  31. DPORT:    EQU    BASEP    ;Modem data port
  32. SPORT:    EQU    BASEP+1    ;Status port and control port #1
  33. CPORT2:    EQU    BASEP+2    ;Control port #2
  34. ;
  35. ;
  36. ; Bit functions
  37. ;
  38. DAV:    EQU    1    ;Receive register full/data available
  39. TBMT:    EQU    2    ;Transmitt buffer empty
  40. PE:    EQU    4    ;Parity error
  41. FE:    EQU    8    ;Framing error
  42. OE:    EQU    10H    ;Overrun error
  43. CD:    EQU    40H    ;Carrier detect
  44. RI:    EQU    80H    ;NOT ring indicator (low=true)
  45. ;
  46. NORM8:    EQU    17H    ;8 bits, no parity, 1 stop bit
  47. NORM110:EQU    1FH    ;8 bits, no parity, 2 stop bits (for 110 bps)
  48. ;
  49. BD300:    EQU    83H    ;answer mode, 300 bps, answer, turn on carrier
  50. BD110:    EQU    82H    ;same as above, but 110 bps
  51. ;
  52. ;
  53. ;***********************************************************************
  54. ;
  55. ; If any of your routines zaps anything other than the Accumulator, then
  56. ; you must preserve all other registers.
  57. ;
  58. ;***********************************************************************
  59. ;
  60. ; This routine should turn off everything on the modem, (no carrier,
  61. ; on-hook).
  62. ;
  63. MDINIT:
  64.     XRA    A        ;hangup phone
  65.     OUT    CPORT2        ;clear off-hook flag, turn off carrier
  66.     RET
  67. ;.....
  68. ;
  69. ;
  70. ; The following routine is used to completely shut-down the modem.  It
  71. ; is the same as MDINIT on the MM100.
  72. ;
  73. MDQUIT:
  74.     JMP    MDINIT        ;same as init
  75. ;.....
  76. ;
  77. ;
  78. ; The following is a routine to determine if there is a character wait-
  79. ; ing to be received, if none are there, the Zero flag will be set,
  80. ; otherwise, 255 will be returned in register A.  Remember that the
  81. ; system will like you a little more if you also mask out framing,
  82. ; parity, and overrun errors.
  83. ;
  84. MDINST:
  85.     IN    SPORT        ;get status
  86.     ANI    DAV        ;mask garbage out
  87.     RZ            ;no character found
  88.     ORI    0FFH        ;we got something...
  89.     RET
  90. ;.....
  91. ;
  92. ;
  93. ; The following is a routine to determine if the transmit buffer is
  94. ; empty.  If it is empty, it will return with the Zero flag clear.  If
  95. ; the transmitter is busy, then it will return with the Zero flag set.
  96. ;
  97. MDOUTST:
  98.     IN    SPORT        ;get status
  99.     ANI    TBMT        ;transmitter ready?
  100.     RET            ;return with proper status
  101. ;.....
  102. ;
  103. ;
  104. ; The following is a routine that will check to make sure we still have
  105. ; carrier.  If there is no carrier, it will return with the Zero flag set.
  106. ;
  107. MDCARCK:
  108.     IN    SPORT        ;read port
  109.     ANI    CD        ;carrier there?
  110.     RET
  111. ;.....
  112. ;
  113. ;
  114. ; The following routine will check to see if the phone is ringing, if it
  115. ; isn't, it will return with Zero set, otherwise Zero will be cleared.
  116. ;
  117. MDRING:
  118.     IN    SPORT        ;read status
  119.     CMA            ;invert flags - NOT-RING becomes ring
  120.     ANI    RI        ;not ringing?
  121.     RET
  122. ;.....
  123. ;
  124. ;
  125. ; The following is a routine that will input one character from the
  126. ; modem port.  If there is nothing there, it will return garbage... so
  127. ; use the MDINST routine first.
  128. ;
  129. MDINP:
  130.     IN    DPORT        ;get character
  131.     ANI    7FH        ;strip parity and other garbage
  132.     RET
  133. ;.....
  134. ;
  135. ;
  136. ; The following is a routine that will output one character in register
  137. ; A to the modem.  REMEMBER, that is register A, not register C.
  138. ;
  139. ; **** Use MDOUTST first to see if buffer is empty ****
  140. ;
  141. MDOUTP:
  142.     OUT    DPORT        ;send it
  143.     RET
  144. ;.....
  145. ;
  146. ;
  147. ; The following routine will make the modem answer the phone.
  148. ;
  149. MDANSW:
  150.     CALL    SET300        ;set modem for 300 baud & answer phone
  151.     RET
  152. ;.....
  153. ;
  154. ;
  155. ; These next routines set the proper baud rates for the modem.  If you
  156. ; do not support the particular rate, then simply put in a JMP to SETINV.
  157. ; If the baud rate change was successful, make SURE the Zero flag is set.
  158. ;
  159. ; The following routine returns a 255 because we were not able to set to
  160. ; the proper baud rate because either the serial port or the modem can't
  161. ; handle ;it.
  162. ;
  163. SET450:                ;450  bps not supported
  164. SET600:                ;600  bps not supported
  165. SET710:                ;710  bps not supported
  166. SET1200:            ;1200 bps not supported
  167. ;
  168. SETINV:
  169.     ORI    0FFH        ;make sure the Zero flag isn't set
  170.     RET
  171. ;.....
  172. ;
  173. ;
  174. ; The follwing sets us for 110 bps. You may wish to remove this and re-
  175. ; place it with a JMP to SETINV because you hate creeps that call in at
  176. ; 110 bps and want to download a 200k long files (arrrrgh)
  177. ;
  178. SET110:
  179.     MVI    A,NORM110    ;set 8 bits, no parity, 2 stop bits
  180.     OUT    SPORT
  181.     MVI    A,BD110        ;set 110 baud and answer phone
  182.     OUT    CPORT2
  183.     XRA    A        ;make sure Z flag is set
  184.     RET
  185. ;.....
  186. ;
  187. ;
  188. ; Set up for 300 bps
  189. ;
  190. SET300:
  191.     MVI    A,NORM8        ;8 bits, no parity, 1 stop bit
  192.     OUT    SPORT
  193.     MVI    A,BD300        ;300 baud and answer phone
  194.     OUT    CPORT2
  195.     XRA    A        ;make sure Z is set
  196.     RET
  197. ;.....
  198. ;
  199. ;
  200. ; Ok, that's all of the modem dependant routines that BYE3 uses, so if
  201. ; you patch this file into your copy of BYE3, then it should work out
  202. ; well.
  203. ;
  204. ;************************************************************************
  205. ;
  206.