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 / MBOTR-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  9KB  |  295 lines

  1. ;***********************************************************************
  2. ;
  3. ;
  4. ;
  5. ;                     MBYE (Modular 'BYE')
  6. ;              Otrona Attache Specialized Routines
  7. ;               v1.1 (04/08/84) by Donald Larson
  8. ;                      Modified from.....
  9. ;
  10. ;             MBYE (Modular 'BYE')
  11. ;        Zilog Z80-SIO/DART USART/UART routines
  12. ;            v2.1 (02/21/84) by Kim Levitt
  13. ;
  14. ;
  15. ;
  16. ;----------------------------------------------------------------------
  17. ;
  18. ; This particular version was skeletonized and reworked for the Otrona
  19. ; Attache.  The program will utilize escape codes to the display driver
  20. ; instead of direct hardware sets to prevent difficulties with Valet.
  21. ; Also note that this will require a rework on the Otrona standard modem
  22. ; ("Communications") cable.  The pin for CTS must be moved to pin 8
  23. ; from pin 5 on the DB-25 (25 pin) connector.  This will allow the
  24. ; BYE to monitor the DSR (data set ready) lead (which tracks with
  25. ; carrier detect).  Therefore the correct cable would be:
  26. ;
  27. ;         Attache'                                   Modem
  28. ;          15 pin                                    25 pin
  29. ;
  30. ;            1 --------- Protective Ground ----------- 1
  31. ;            2 --------- Transmitted Data ------------ 2
  32. ;            4 --------- Received Data --------------- 3
  33. ; NOTE ===>  5 --------- Clear to Send --------------- 8
  34. ;            8 --------- Signal Ground --------------- 7 <---+-+
  35. ;            9 --------- Data Terminal Ready --------- 20    | |
  36. ;           10 --------- Request to Send ------------- 4     | |
  37. ;           11 --------- Received Data Return ---------------+ |
  38. ;           12 --------- Clear to Send Return -----------------+
  39. ;
  40. ; NOTE: this is where you change the standard lead from pin 5 in the
  41. ; standard cable to pin 8 as shown.
  42. ;
  43. ; This version was tested with a Hayes Smartmodem 1200 and an 8:16
  44. ; using CP/M 2.2.5.  If there are any bugs, please call by voice
  45. ; days at (312) 867-6400 X 451.
  46. ;
  47. ; I have still been unable to use the Attache's (R)eal (T)ime
  48. ; (C)lock for forced logoff, etc.  I'd like to talk to anyone 
  49. ; coming up with a method of doing so.  Please give me a call.
  50. ;
  51. ;                                 - Donald Larson
  52. ;
  53. ;-----------------------------------------------------------------------
  54. ;
  55. ; 04/08/84  Editted, skeletonized  and reformatted for
  56. ;           specific use with the Otrona Attache. Used
  57. ;           with MBYE v 3.2.                            - Donald Larson
  58. ; 02/21/84  Removed exclaimation mark from comment      - Kim Levitt oops!
  59. ; 02/20/84  Added comments for XEROX 820-II & BigBoards,
  60. ;        code for DARTs and modified SIOs to read RI - Kim Levitt
  61. ; 02/02/84  Fixed and renamed to work with MBYE 3.0    - Kim Levitt
  62. ;        (Also added conditional equates 8116, CTC and KAYPRO.)
  63. ; 11/27/83  Altered and renamed to work with BYE3    - Irv Hoff
  64. ; 08/04/83  Updated for use with ByeII version 1.6    - Paul Traina
  65. ; 07/19/83  Improved operation of modem initialization.    - Paul Traina
  66. ; 04/18/83  Added option to use 300/1200 Smartmodem.    - Don Brown
  67. ; 04/14/83  Added option for alt. CTC baud set format.    - Paul Traina
  68. ; 02/21/83  Initial version.                - Steve Fox
  69. ;
  70. ;-----------------------------------------------------------------------
  71. ;
  72. BASEP:    EQU    0F0H        ;Set Base port for SIO (data port)
  73. ;
  74. ; The following define the port addresses to use.
  75. ;
  76. DPORT:    EQU    BASEP        ;Data port
  77. SPORT:    EQU    BASEP+1        ;Status/Control port
  78. ;
  79. ;
  80. ; The following are SPORT commands (output these to SPORT)
  81. ;
  82. ; WR0:
  83. RESCHN:    EQU    00011000B    ;Reset channel
  84. RESSTA:    EQU    00010000B    ;Reset ext/status
  85. RESERR:    EQU    00110000B    ;Error reset
  86. ;
  87. WRREG1:    EQU    00000000B    ;WR1 - No interrupts
  88. WRREG3:    EQU    11000001B    ;WR3 - Rx 8 bits/char, Rx enable
  89. WRREG4:    EQU    01000100B    ;WR4 - 16x, 1 stop bit, no parity
  90. ;
  91. ; WR5:
  92. DTROFF:    EQU    01101000B    ;DTR off, Tx 8 bits, Tx enable, RTS off
  93. DTRON:    EQU    11101010B    ;DTR on, Tx 8 bits, Tx enable, RTS on
  94. ;
  95. ;
  96. ; The following are SPORT status masks
  97. ;
  98. DAV:    EQU    00000001B    ;Data available
  99. TBMT:    EQU    00000100B    ;Transmit buffer empty
  100. DCD:    EQU    00100000B    ;Data carrier detect (using modifed cts)
  101. OE:    EQU    00100000B    ;Overrun error
  102. FE:    EQU    01000000B    ;Framing error
  103. ERR:    EQU    OE+FE        ;Overrun and framing errors
  104. ;
  105. ; This routine should turn off everything on the modem, hang it up, and
  106. ; get it ready to wait for a ring. (DTR off)
  107. ;
  108. MDINIT:
  109.     MVI    A,RESCHN    ;Reset channel (DTR, RTS off)
  110.     OUT    SPORT
  111.     MVI    A,4        ;Setup to write register 4
  112.     OUT    SPORT
  113.     MVI    A,WRREG4    ;set 16x clock, 1 stop bit, no parity
  114.     OUT    SPORT
  115.     MVI    A,1        ;Setup to write register 1
  116.     OUT    SPORT
  117.     MVI    A,WRREG1    ;set no interrupts
  118.     OUT    SPORT
  119.     MVI    A,3        ;Setup to write register 3
  120.     OUT    SPORT
  121.     MVI    A,WRREG3    ;set Rx 8 bits, enable recv
  122.     OUT    SPORT
  123.     MVI    A,5        ;Setup to write register 5
  124.     OUT    SPORT
  125.     MVI    A,DTROFF    ;leave DTR OFF initially
  126.     OUT    SPORT
  127.     RET            ;Return
  128. ;.....
  129. ;
  130. ;
  131. ; The following routine will raise DTR. (and RTS)
  132. ;
  133. MDANSW:
  134.     MVI    A,5        ;address WR5
  135.     OUT    SPORT
  136.     MVI    A,DTRON        ;raise DTR, RTS
  137.     OUT    SPORT
  138.     RET            ;Return
  139. ;
  140. ;
  141. ; The following routine checks to make sure we still have carrier.  If
  142. ; there is no carrier, it will return with the Zero flag set.
  143. ;
  144. MDCARCK:
  145.     MVI    A,RESSTA    ;Reset status
  146.     OUT    SPORT
  147.     IN    SPORT        ;Get status
  148.     ANI    DCD        ;Check for data carrier
  149.     RET            ;Return
  150. ;
  151. ;
  152. ; The following routine determines if there is a character waiting to
  153. ; be received.  If no character is waiting, the Zero flag will be set,
  154. ; otherwise, 255 will be returned in register A. (Error conditions are
  155. ; checked, and, if present, the character is ignored.)
  156. ;
  157. MDINST:
  158.     IN    SPORT        ;Get status
  159.     ANI    DAV        ;Got a character?
  160.     RZ            ;Return if none
  161.     MVI    A,1        ;else, check error bits
  162.     OUT    SPORT        ;(address RR1)
  163.     IN    SPORT        ;read RR1
  164.     ANI    ERR        ;mask error bits
  165.     JZ    MDINST1        ;no error, ok
  166.     MVI    A,RESERR    ;else, reset error bits
  167.     OUT    SPORT
  168.     IN    DPORT        ;clear out garbage
  169.     XRA    A        ;say no data
  170.     RET            ;and return
  171. MDINST1:
  172.     ORI    0FFH        ;say we got one
  173.     RET            ;...and return
  174. ;.....
  175. ;
  176. ;
  177. ; The following is a routine that will input one character from the
  178. ; modem port.  If there is nothing there, it will return garbage... so
  179. ; use the MDINST routine first.
  180. ;
  181. MDINP:
  182.     IN    DPORT        ;Get character
  183.     ANI    7FH        ;Strip parity
  184.     RET            ;Return
  185. ;.....
  186. ;
  187. ;
  188. ; The following is a routine to determine if the transmit buffer is
  189. ; empty.  If it is empty, it will return with the Zero flag clear.  If
  190. ; the transmitter is busy, then it will return with the Zero flag set.
  191. ;
  192. MDOUTST:
  193.     IN    SPORT
  194.     ANI    TBMT        ;Mask it
  195.     RET            ;Return
  196. ;.....
  197. ;
  198. ;
  199. ; The following is a routine that will output one character in register
  200. ; A to the modem.  REMEMBER, that is register A, not register C.
  201. ;
  202. ; **** Use MDOUTST first to see if buffer is empty ****
  203. ;
  204. MDOUTP:
  205.     OUT    DPORT        ;Send it
  206.     RET            ;Return
  207. ;.....
  208. ;
  209. ;
  210. ; These next routines set the proper baud rates for the modem.  If you
  211. ; do not support the particular rate, then simply put the label in front
  212. ; of the ORI 0FFH / RET. If the baud rate change was successful, make
  213. ; SURE the Zero flag is set (XRA A).
  214. ;
  215. ;
  216. SET110:
  217.     MVI    A,01        ;Send code for 110 baud
  218.     JMP    SETBAUD
  219. ;
  220. SET300:
  221.     MVI    A,04        ;Send code for 300 baud
  222.     JMP    SETBAUD
  223. ;
  224. SET600:
  225.     MVI    A,05        ;Send code for 600 baud
  226.     JMP    SETBAUD
  227. ;
  228. SET1200:
  229.     MVI    A,06        ;Send code for 1200 baud
  230.     JMP    SETBAUD
  231. ;
  232. SET2400:
  233.     MVI    A,07        ;Send code for 2400 baud
  234.     JMP    SETBAUD
  235. ;
  236. SET4800:
  237.     MVI    A,08        ;Send code for 4800 baud
  238.     JMP    SETBAUD
  239. ;
  240. SET9600:
  241.     MVI    A,09        ;Send code for 9600 baud
  242.     JMP    SETBAUD
  243. ;
  244. SET19200:
  245.     MVI    A,0AH        ;Send code for 19,200 baud
  246. ;    
  247. SETBAUD:
  248.     PUSH    PSW        ;Preserve baud code (just in case)
  249.     MVI    E,ESC        ;First, send escape
  250.     CALL     SCONOUT
  251.     MVI    E,'@'        ;Next set for write to CMOS ram
  252.     CALL    SCONOUT
  253.     MVI    E,8        ;Communications address
  254.     CALL     SCONOUT
  255.     POP    PSW        ;Get back baud code
  256.     PUSH    PSW        ;Again, just in case
  257.     MOV    E,A
  258.     CALL    SCONOUT        ;Write it
  259.     MVI    E,ESC        ;Send escape (again)
  260.     CALL     SCONOUT
  261.     MVI    E,'<'        ;Tell machine to reset to CMOS speed
  262.     CALL    SCONOUT
  263.     POP    PSW
  264.     XRA    A    
  265.     RET            ;Return
  266. ;
  267. ;.....
  268. ;
  269. ; This routine uses a BDOS call for direct console I/O.
  270. ;
  271. SCONOUT:
  272.     MVI    C,6        ;BDOS direct console i/o function
  273.     CALL    BDOS
  274.     RET
  275. ;
  276. ;....
  277. ;
  278. ; The following routine returns a 255 because we were not able to set to
  279. ; the proper baud rate because the serial port can't handle it.
  280. ;
  281. SET450:
  282. SET710:
  283.     ORI    0FFH        ;Make sure zero flag is not set
  284.     RET            ;Return
  285. ;
  286. ;.....
  287. ;
  288. ; Ok, that's all of the modem dependent routines that MBYE uses, so if
  289. ; you patch this file into your copy of MBYE, (using Wordstar's ^KR
  290. ; function) then it should work out well. (Be sure to set the SMODEM and 
  291. ; SM1200 equates in the main program section to indicate if you are 
  292. ; using a Hayes Smartmodem or compatible or not.)
  293. ;
  294. ;***********************************************************************
  295.