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 / MBLO-10.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  8KB  |  249 lines

  1. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. ;
  3. ;             MBYE (Modular 'BYE')
  4. ;           Lobo Max-80 serial I/O routines
  5. ;        version 1.0 (06/16/84) by Peter N. Glaskowsky
  6. ;      adapted from MBZSIO v2.1 (02/21/84) by Kim Levitt
  7. ;
  8. ; This overlay adapts MBYE v3.3 to the Lobo Max-80 computer, using
  9. ; serial port A for the modem.
  10. ;
  11. ; NOTE: set NORING EQU YES in the main MBYE program.
  12. ;
  13. ;-----------------------------------------------------------------------
  14. ;
  15. ; 06/16/84  Adapted for use with the Lobo Max-80;
  16. ;        extraneous routines deleted            - Peter N. Glaskowsky
  17. ; 02/21/84  Removed exclaimation mark from comment      - Kim Levitt oops!
  18. ; 02/20/84  Added comments for XEROX 820-II & BigBoards,
  19. ;        code for DARTs and modified SIOs to read RI - Kim Levitt
  20. ; 02/02/84  Fixed and renamed to work with MBYE 3.0    - Kim Levitt
  21. ;        (Also added conditional equates 8116, CTC and KAYPRO.)
  22. ; 11/27/83  Altered and renamed to work with BYE3    - Irv Hoff
  23. ; 08/04/83  Updated for use with ByeII version 1.6    - Paul Traina
  24. ; 07/19/83  Improved operation of modem initialization.    - Paul Traina
  25. ; 04/18/83  Added option to use 300/1200 Smartmodem.    - Don Brown
  26. ; 04/14/83  Added option for alt. CTC baud set format.    - Paul Traina
  27. ; 02/21/83  Initial version.                - Steve Fox
  28. ;
  29. ;-----------------------------------------------------------------------
  30. ;
  31. ; Set memory-mapped addresses for SIO and 8116 baud-rate chip
  32. ;
  33. BASEP:    EQU    0F7E4H        ;Base port for SIO (0F7E6H for port B)
  34. BASEC:    EQU    0F7D0H        ;Base port for 8116 (0F7D4H for port B)
  35. ;
  36. ; The following define the memory-mapped addresses to use.
  37. ;
  38. DPORT:    EQU    BASEP        ;Data port
  39. SPORT:    EQU    BASEP+1        ;Status/Control port
  40. BPORT:    EQU    BASEC        ;Baud rate port
  41. ;
  42. ;
  43. ; The following are SPORT commands (output these to SPORT)
  44. ;
  45. ; WR0:
  46. RESCHN:    EQU    00011000B    ;Reset channel
  47. RESSTA:    EQU    00010000B    ;Reset ext/status
  48. RESERR:    EQU    00110000B    ;Error reset
  49. ;
  50. WRREG1:    EQU    00000000B    ;WR1 - No interrupts
  51. WRREG3:    EQU    11000001B    ;WR3 - Rx 8 bits/char, Rx enable
  52. WRREG4:    EQU    01000100B    ;WR4 - 16x, 1 stop bit, no parity
  53. ;
  54. ; WR5:
  55. DTROFF:    EQU    01101000B    ;DTR off, Tx 8 bits, Tx enable, RTS off
  56. DTRON:    EQU    11101010B    ;DTR on, Tx 8 bits, Tx enable, RTS on
  57. ;
  58. ;
  59. ; The following are SPORT status masks
  60. ;
  61. ; RR0:
  62. DAV:    EQU    00000001B    ;Data available
  63. TBMT:    EQU    00000100B    ;Transmit buffer empty
  64. DCD:    EQU    00001000B    ;Data carrier detect
  65. RI:    EQU    00010000B    ;Ring Indicator (DARTs only)
  66. ;
  67. ;(Normally, only DARTs can detect Ring Indicator...... HOWEVER,
  68. ; with special wiring to SYNC pin, SIOs can detect RI on this bit
  69. ; in asynchronous receive mode, wheras it is normally used only
  70. ; in synchronous mode. If you have this hardware mod done, your
  71. ; SIO will in effect function as a DART and this "SYNC/HUNT" bit
  72. ; in read reg. 0 will function as a RI status bit.) (Connect
  73. ; SYNCA pin 11 of SIO to pin 22 of RS-232C connector, not sure if
  74. ; any intermediate circut is necessary, though, so DON'T TRY IT
  75. ; UNLESS YOU KNOW WHAT YOU'RE DOING and really NEED ring detect,
  76. ; also realize you will lose synchronous capabilities...)
  77. ;
  78. ; RR1:
  79. OE:    EQU    00100000B    ;Overrun error
  80. FE:    EQU    01000000B    ;Framing error
  81. ERR:    EQU    OE+FE        ;Overrun and framing errors
  82. ;
  83. ;
  84. ; 8116 is initialized by system on cold boot, so you only
  85. ; need to set baud rate as single command to baud rate port.
  86. ;
  87. BD110:    EQU    02H
  88. BD300:    EQU    05H
  89. BD600:    EQU    06H
  90. BD1200:    EQU    07H
  91. BD2400:    EQU    0AH    ;2400 - 19.2 K baud values
  92. BD4800:    EQU    0CH    ;not currently supported, but could be
  93. BD9600:    EQU    0EH    ;used on a high speed link so are
  94. BD19K:    EQU    0FH    ;included for informational purposes
  95. ;
  96. ;
  97. ;***********************************************************************
  98. ;
  99. ; If any of your routines zap anything other than the Accumulator, then
  100. ; you must preserve all other registers.
  101. ;
  102. ;***********************************************************************
  103. ;
  104. ; This routine should turn off everything on the modem, hang it up, and
  105. ; get it ready to wait for a ring. (DTR off)
  106. ;
  107. MDINIT:
  108.     MVI    A,RESCHN    ;Reset channel (DTR, RTS off)
  109.     STA    SPORT
  110.     MVI    A,4        ;Setup to write register 4
  111.     STA    SPORT
  112.     MVI    A,WRREG4    ;set 16x clock, 1 stop bit, no parity
  113.     STA    SPORT
  114.     MVI    A,1        ;Setup to write register 1
  115.     STA    SPORT
  116.     MVI    A,WRREG1    ;set no interrupts
  117.     STA    SPORT
  118.     MVI    A,3        ;Setup to write register 3
  119.     STA    SPORT
  120.     MVI    A,WRREG3    ;set Rx 8 bits, enable recv
  121.     STA    SPORT
  122.     MVI    A,5        ;Setup to write register 5
  123.     STA    SPORT
  124.     MVI    A,DTROFF    ;leave DTR OFF initially
  125.     STA    SPORT
  126.     RET            ;Return
  127. ;.....
  128. ;
  129. ; The following routine will raise DTR. (and RTS)
  130. ;
  131. MDANSW:
  132.     MVI    A,5        ;address WR5
  133.     STA    SPORT
  134.     MVI    A,DTRON        ;raise DTR, RTS
  135.     STA    SPORT
  136.     RET            ;Return
  137. ;
  138. ;
  139. ; The following routine checks to make sure we still have carrier.  If
  140. ; there is no carrier, it will return with the Zero flag set.
  141. ;
  142. MDCARCK:
  143.     MVI    A,RESSTA    ;Reset status
  144.     STA    SPORT
  145.     LDA    SPORT        ;Get status
  146.     ANI    DCD        ;Check for data carrier
  147.     RET            ;Return
  148. ;
  149. ;
  150. ; The following routine determines if there is a character waiting to
  151. ; be received.  If no character is waiting, the Zero flag will be set,
  152. ; otherwise, 255 will be returned in register A. (Error conditions are
  153. ; checked, and, if present, the character is ignored.)
  154. ;
  155. MDINST:
  156.     LDA    SPORT        ;Get status
  157.     ANI    DAV        ;Got a character?
  158.     RZ            ;Return if none
  159.     MVI    A,1        ;else, check error bits
  160.     STA    SPORT        ;(address RR1)
  161.     LDA    SPORT        ;read RR1
  162.     ANI    ERR        ;mask error bits
  163.     JZ    MDINST1        ;no error, ok
  164.     MVI    A,RESERR    ;else, reset error bits
  165.     STA    SPORT
  166.     LDA    DPORT        ;clear out garbage
  167.     XRA    A        ;say no data
  168.     RET            ;and return
  169. MDINST1:
  170.     ORI    0FFH        ;say we got one
  171.     RET            ;...and return
  172. ;.....
  173. ;
  174. ;
  175. ; The following is a routine that will input one character from the
  176. ; modem port.  If there is nothing there, it will return garbage... so
  177. ; use the MDINST routine first.
  178. ;
  179. MDINP:
  180.     LDA    DPORT        ;Get character
  181.     ANI    7FH        ;Strip parity
  182.     RET            ;Return
  183. ;.....
  184. ;
  185. ;
  186. ; The following is a routine to determine if the transmit buffer is
  187. ; empty.  If it is empty, it will return with the Zero flag clear.  If
  188. ; the transmitter is busy, then it will return with the Zero flag set.
  189. ;
  190. MDOUTST:
  191.     LDA    SPORT
  192.     ANI    TBMT        ;Mask it
  193.     RET            ;Return
  194. ;.....
  195. ;
  196. ;
  197. ; The following is a routine that will output one character in register
  198. ; A to the modem.  REMEMBER, that is register A, not register C.
  199. ;
  200. ; **** Use MDOUTST first to see if buffer is empty ****
  201. ;
  202. MDOUTP:
  203.     STA    DPORT        ;Send it
  204.     RET            ;Return
  205. ;.....
  206. ;
  207. ;
  208. ; These next routines set the proper baud rates for the modem.  If you
  209. ; do not support the particular rate, then simply put the label in front
  210. ; of the ORI 0FFH / RET. If the baud rate change was successful, make
  211. ; SURE the Zero flag is set (XRA A).
  212. ;
  213. ;
  214. SET110:
  215.     MVI    A,BD110
  216.     JMP    SETBAUD
  217. ;
  218. SET300:
  219.     MVI    A,BD300
  220.     JMP    SETBAUD
  221. ;
  222. SET600:
  223.     MVI    A,BD600
  224.     JMP    SETBAUD
  225. ;
  226. SET1200:
  227.     MVI    A,BD1200
  228. ;
  229. SETBAUD:
  230.     STA    BPORT        ;set baud rate
  231.     XRA    A        ;say rate ok
  232.     RET            ;and return
  233. ;
  234. ; The following rates, (450 & 710), are not supported for the 8116/SIO
  235. ;
  236. SET450:
  237. SET710:
  238.     ORI    0FFH        ;say rate ng
  239.     RET
  240. ;
  241. ;.....
  242. ;
  243. ; Ok, that's all of the modem dependent routines that MBYE uses, so if
  244. ; you patch this file into your copy of MBYE, then it should work out
  245. ; well. (Be sure to set the SMODEM and SM1200 equates in the main program
  246. ; section to indicate if you are using a Hayes Smartmodem or compatible
  247. ; or not.)
  248. ;
  249.