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 / 22RSX / BYERSX.ARK / BRTV3-1.BYE < prev    next >
Text File  |  1986-02-17  |  8KB  |  273 lines

  1. ; BRTV3-1.INC - Televideo 803 insert for BYERSX (85/12/6)
  2. ;
  3. ; Name this file RSXIO.INC for use with the BYERSX system
  4. ;
  5. ; This is an adaptation of BRGP-1 to adapt the Televideo 803 to
  6. ; BYERSX.
  7. ;
  8. ; Such an insert may be used with any auto-answer modem such as the
  9. ; Hayes Smartmodem 300 or 1200, the Cermetek Infomate 212A, etc.
  10. ; Other modems may be used with suitable auxiliary programs.
  11. ;
  12. ; This may have an anomalous connection to DODELAY in the main system
  13. ; which delays (de) millisecs, preserving bc and hl.  The RSX delay
  14. ; mechanism cannot be used because these routines may be called by
  15. ; the RSX, and the switched stack would then be overwritten.
  16. ;
  17. ;    Note:  This is an insert, not an overlay.  It is normally
  18. ;    included automatically by "include" statements in the main
  19. ;    program.  If your assembler cannot handle this you will have
  20. ;    have to concatenate files, starting with RSXMAST.MAC.  Regs
  21. ;    that may be altered by the routines are shown as "a,f" etc.
  22. ;
  23. ; ------------------------------------------------------------------
  24. ;
  25. ; 85/11/16    Created, for general referance.  C.B. Falconer
  26. ;        The resemblence to BYE inserts is not accidental.
  27. ;
  28. ; ------------------------------------------------------------------
  29. ;
  30. ; Televideo 803 port equates, using MOSTEK 3801
  31. data        equ    02fh;        in/out
  32. ;
  33. outstat        equ    02eh;        output ready/output control
  34. outrdybit    equ    080h;        output port clear
  35. txenbl        equ    05h;        enable transmission
  36. ;
  37. instat        equ    02dh;        input ready/input control
  38. rxenbl        equ    001h;        enable reception
  39. inrdybit    equ    080h;        input data ready
  40. ;
  41. uartcmd        equ    02ch;        command to uart
  42. paroff81    equ    088h;        parity off, 8 bits, 1 stop
  43. ;
  44. bdratep        equ    02bh;        baud rate control
  45. b9600        equ    9600/9600;    baud rate values
  46. b4800        equ    9600/4800
  47. b2400        equ    9600/2400
  48. b1200        equ    9600/1200
  49. b600        equ    9600/600
  50. b300        equ    9600/300
  51. ;
  52. uartimer    equ    029h;        uart timer port? in/out
  53. ;
  54. uartint        equ    027h;        uart interrupt control
  55. dsint        equ    0fh;        disable interrupts
  56.  
  57. ;
  58. ; Do a complete reset of the port.
  59. ; Hang up in case carrier present. Wait, and then assert DTR.
  60. ; This may initialize an interrupt driven system.  Some programs
  61. ; may call this more than once, so if the system should not be
  62. ; re-initialized this must take care of the situation.
  63. ; mdquit should reverse the operation of this routine.
  64. ; Return 0ffh for success, 0 for failure, with flags set
  65. ; a,f
  66. mdinit:    in    uartimer
  67.     push    psw;        save timer value
  68.     mvi    a,dsint
  69.     out    uartint;    disable interrupts
  70.     pop    psw
  71.     out    uartimer;    restart timer
  72.     mvi    a,paroff81
  73.     out    uartcmd;    set configuration
  74.     mvi    a,rxenbl
  75.     out    instat;        enable input
  76.     mvi    a,txenbl
  77.     out    outstat;    enable output
  78.     ori    0ffh;        signal success
  79.     ret
  80. ;
  81. ; Deinitialize the Modem and hang up the phone by dropping DTR and
  82. ; leaving it inactive.  Usually just falls into MDSTOP.  This may
  83. ; inactivate any interrupt driven systems, so that the whole system
  84. ; can be removed.  Inverse of mdinit.
  85. ; a,f (allowed)
  86. mdquit:
  87. ;    "    "
  88. ; Drop DTR to the modem and hang up. An interrupt system remains up.
  89. ; This is the inverse of mdgo.
  90. ; a,f (allowed)
  91. mdstop:
  92.     ret
  93. ;
  94. ; Re-enable the line.  This is the inverse operation to mdstop
  95. ; return 0ffh for success, 0 for failure, with flags set
  96. ; a,f
  97. mdgo:    ori    0ffh;        Success
  98.     ret
  99. ;
  100. ; -----------------------------------
  101. ;
  102. ; Check for carrier.  If there is no carrier,  return 0 with the
  103. ; Z flag set, else 0ffh with the NZ flag.
  104. ; a,f
  105. mdcarck:
  106.     nop;            allow patch to ori 0ffh.
  107.     xra    a;        No carrier
  108.     ret
  109. ;
  110. ; Input one character from the modem port.
  111. ; If no char. is ready this will return garbage... so use the
  112. ; MDINST routine first.  Do not strip parity for BYERSX
  113. ; a,f
  114. mdinp:    in    data
  115.     ret
  116. ;
  117. ; Determines if there is a character waiting to be received.
  118. ; If no character is waiting the Zero flag will be
  119. ; set and 0 returned, else 0FFH will be returned in register 'A'.
  120. ; a,f
  121. mdinst:    in    instat
  122.     ani    inrdybit
  123.     rz;            nothing ready
  124.     ori    0ffh;        something ready
  125.     ret
  126. ;
  127. ; Output one character from register 'A' to the modem.  Disturb no
  128. ; registers. Application should check MDOUTST first for empty buffer.
  129. ; f (allowed)
  130. mdoutp:    out    data
  131.     ret;            discard it for the outline
  132. ;
  133. ; Determine if the transmit buffer is empty.  If empty, return 0ffh and
  134. ; the NZ flag.  If the transmitter is busy, return 0 with Z flag.
  135. ; a,f
  136. mdoutst:
  137.     in    outstat
  138.     ani    outrdybit
  139.     rz;            not ready    
  140.     ori    0ffh;        ready for output
  141.     ret
  142. ;
  143. ; Send an (a) millisec break thru the modem.
  144. ; Return 0ffh and nz flag if capable, 0 and z flag if not capable
  145. ; a,f
  146. sendbk:    xra    a;        not capable
  147.     ret
  148. ;
  149. ; Generalized baud setting per (a).
  150. ; Return 0 and zero flag if good, else 0ffh and non-zero flag.
  151. ; input (a) 1..10 for 110,300,450,600,710,1200,2400,9600,19200 baud
  152. ; if input a = 0 do nothing (high order bits used for stops/parity)
  153. ; The high 2 bits set stop bits (0..3 for no change, 1, 1.5, 2 stops)
  154. ; and the next set parity (0..3 for no change, no, odd, even parity).
  155. ; Success flags are based on baud rate only.  Parity/stop settings
  156. ; may be ignored if desired.
  157. ; a,f
  158. setbaud:
  159.     call    sstops
  160.     ani    0fh
  161.     rz
  162.     push    h
  163.     lxi    h,btbl
  164.     add    l
  165.     mov    l,a
  166.     adc    h
  167.     sub    l
  168.     mov    h,a
  169.     mov    a,m
  170.     pop    h
  171.     ora    a
  172.     jnz    sb2;        valid input
  173. sb1:    ori    0ffh;        signal invalid
  174.     ret
  175. sb2:    out    bdratep
  176.     xra    a;        signal success
  177.     ret
  178. ;
  179. ; zero entries for invalid speeds
  180. btbl:    db    0,     0,     b300, 0;        0,110,300,450
  181.     db    b600,  0,     b1200,b2400;    600,710,1200,2400
  182.     db    b4800, b9600, 0,    0;        4800,9600,19200,0
  183.     db    0,     0,     0,    0;    zeroes for invalid values.
  184. ;
  185. ; set stop bits/parity on hi bits of (a). Preserve registers.
  186. sstops:    ret
  187. ;
  188. ; For non-intelligent modems.  Go off hook and connect.
  189. ; Return 0ffh if performed, 0 if not, with flags set
  190. ; a,f
  191. mdansw:
  192.     xra    a;        couldn't do it
  193.     ret
  194. ;
  195. ; For non intelligent modems.  Is the phone ringing
  196. ; 0 and z flag if not, 0ffh and nz flag if ringing
  197. mdring:    xra    a;        not ringing
  198.     ret
  199. ;
  200. ; For disk control, the following indicates that the application
  201. ; will not require disk access in the immediate future.  If possible
  202. ; drive motors should be stopped.  No harm if unable to perform
  203. ; a,f
  204. dskstp:    ret
  205. ; For disk control, the following indicates that the application
  206. ; will require disk access in the immediate future.  If possible
  207. ; drive motors should be started.  No harm if unable to perform
  208. ; a,f
  209. dskrun:    ret
  210. ;
  211. ; ----------------------- Timer interface --------------------------
  212. ;
  213. ; These two routines are called with either
  214. ;   de = 0ffffh for a query (return current value in hl) )
  215. ;   de = other  to set the appropriate value, and return in (hl)
  216. ; The returned value should be 0ffffh if no timer system installed.
  217. ;
  218. ; The date is kept in the following format (note 0ffffh is invalid)
  219. ;    MSbit    yyyyyyy mmmm ddddd   LSbit
  220. ; with y field (0..127) the offset from 1980 (dates to 2107)
  221. ;      m field (1..12)  the numerical month  (Jan to Dec)
  222. ;      d field (1..31)  the day of month
  223. ; (Identical to MSDOS format)
  224. ; a,f,h,l
  225. sgdate:    lxi    h,0ffffh;    Not implemented
  226.     ret
  227. ;
  228. ; The time is kept in the following format (note 0ffffh is invalid)
  229. ;   MSbit     hhhhh mmmmmm sssss  LS bit
  230. ; with h field (0..23)  hour of day (0 is midnight)
  231. ;      m field (0..59)  minute of hour
  232. ;      s field (0..29)  seconds DIV 2 (resolution 2 seconds)
  233. ; (Identical to MSDOS format)
  234. ; a,f,h,l
  235. sgtime:    lxi    h,0ffffh;    Not implemented
  236.     ret
  237. ;
  238. ; This is used only where the host system has no real-time clock.
  239. ; This allows simulation of that clock, with lousy accuracy.
  240. ; Adds 1 minute to the internally stored time value.  If a clock
  241. ; system exists this should simply return.
  242. ; a,f,h,l (allowed)
  243. add1min:
  244.     ret
  245. ;
  246. ; ------------ I/O Dependant Function Key actions -------------
  247. ;
  248. ; The following are called when the ATTN char is followed by one
  249. ; of the digits '0' thru '9'.  It is suggested that the digit '0'
  250. ; be reserved for performing screen dumps.  A simple "ret" 
  251. ; eliminates any key from the function repetoire.
  252. ; a,f,h,l (allowed)
  253. f0k:
  254. f1k:
  255. f2k:
  256. f3k:
  257. f4k:
  258. f5k:
  259. f6k:
  260. f7k:
  261. f8k:
  262. f9k:    ret;        eliminate all these
  263. ;
  264. ;               end of insert
  265. ; ------------------------------------------------------------------
  266. ;
  267. ; Following special mechanism for SLRMAC assembler.  For others omit
  268. ; and patch the initialization area
  269.     org    imsg
  270.  db    ' installing on Televideo 803$'
  271.     org
  272. ╒δ