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 / ENTERPRS / CPM / TERMS / QTPATCH.ARC / QT-TS802.Z < prev    next >
Text File  |  1989-09-08  |  6KB  |  283 lines

  1. ; QT802.Z - patch source for a televideo TS802
  2.  
  3. .var    siod    0x20
  4. .var    sioc    0x22
  5. .var    baud    0x08
  6.  
  7. .org    0x0110
  8. modist:    in    a,(sioc)
  9.     and    1
  10.     ret
  11.  
  12. .org    0x0120
  13. modin:    in    a,(siod)
  14.     ret
  15.  
  16. .org    0x0130
  17. modost:    in    a,(sioc)
  18.     and    4
  19.     ret
  20.  
  21. .org    0x0140
  22. modout:    out    (siod),a
  23.     ret
  24.  
  25. .org    0x0150
  26. sbreak:    ld    a,(setf)
  27.     or    a
  28.     ret    z
  29.     ld    hl,r5
  30.     set    4,(hl)
  31.     jp    sioout
  32.  
  33. .org    0x0160
  34. ebreak:    ld    a,(setf)
  35.     or    a
  36.     ret    z
  37.     ld    hl,r5
  38.     res    4,(hl)
  39.     jp    sioout
  40.  
  41. .org    0x0170
  42. dtroff:    ld    a,(setf)
  43.     or    a
  44.     ret    z
  45.     ld    hl,r5
  46.     res    7,(hl)
  47.     jp    sioout
  48.  
  49. .org    0x0180
  50. dtron:    ld    a,(setf)
  51.     or    a
  52.     ret    z
  53.     ld    hl,r5
  54.     set    7,(hl)
  55.     jp    sioout
  56.  
  57. .org    0x0190
  58. .extern    setbd
  59. setbd:
  60.     push    af
  61.     ld    a,0x47
  62.     out    (baud),a
  63.     pop    af
  64.     out    (baud),a
  65.     ret
  66.  
  67. ; these next eight are byte pairs - the first byte is used by setbd above.
  68. ; the second is a yes for an active baud rate entry, and a no for inactive
  69.  
  70. ; the 802 is rated up to 38400 baud, but it is doubtful that QTERM
  71. ; will bw able to keep up at that speed. Caveat Emptor
  72.  
  73. .org    0x01a0
  74. .extern    b38400
  75. b38400:    db    1,yes
  76. .extern    b19200
  77. b19200:    db    2,yes
  78. .extern    b9600
  79. b9600:    db    4,yes
  80. .extern    b4800
  81. b4800:    db    8,yes
  82. .extern    b2400
  83. b2400:    db    16,yes
  84. .extern    b1200
  85. b1200:    db    32,yes
  86. .extern    b600
  87. b600:    db    64,yes
  88. .extern    b300
  89. b300:    db    128,yes
  90.  
  91. ;.org    0x01b0
  92. setmod:    ld    (setf),a
  93.     jp    domod
  94.  
  95. .org    0x1c0
  96. modetb:
  97. n17:    db    0b10000000    ;0x80, 7n1
  98. n18:    db    0b11000000    ;0xc0, 8n1
  99. n27:    db    0b10001000    ;0x88, 7n2
  100. n28:    db    0b11001000    ;0xc8, 8n2
  101. e17:    db    0b10000011    ;0x83, 7e1
  102. e18:    db    0b11000011    ;0xc3, 8e1
  103. e27:    db    0b10001011    ;0x8b, 7e2
  104. e28:    db    0b11001011    ;0xcb, 8e2
  105. o17:    db    0b10000001    ;0x81, 7o1
  106. o18:    db    0b11000001    ;0xc8, 8o1
  107. o27:    db    0b10001001    ;0x89, 7o2
  108. o28:    db    0b11001001    ;0xc9, 8o2
  109.  
  110. ;.org    0x01cc
  111.  
  112. .extern    resrvd
  113. resrvd:
  114.     db    0
  115.  
  116. ; xfersz - number of K to read / write to disk during protocol transfers:
  117. ; must be 1 / 2 / 4 / 8. Generally this is best left at 8 unless you have
  118. ; a REALLY slow disk (C128 maybe) when writing / reading 8K at a time
  119. ; causes timeouts. Drop this to 4 or 2 to do disk access in smaller chunks
  120. ; to help avoid the timeout problem
  121.  
  122. .extern    xfersz
  123. xfersz:    db    8
  124.  
  125. ; speed - simply the cpu speed for a z80 in mhz.
  126.  
  127. .extern    speed
  128. speed:    db    4
  129.  
  130. ; escape - this is the character used as the escape char: since the addresses
  131. ; in the table tend to move, we just put the byte here, and then transfer
  132. ; to the table later
  133.  
  134. escape:    db    '\\' & 0x1f
  135.  
  136. ; the signon message - change this to be appropriate for your system
  137.  
  138. ;.org    0x01d0            ; don't need this: the bytes above do it
  139. signon:    db    'Televideo TS802\0'
  140.  
  141. ; now the string for clear screen
  142.  
  143. .org    0x01f0
  144. .extern    clrs
  145. clrs:    db    'z' & 0x1f, 0
  146.  
  147. ; moveto - **** - this routine is called with a word in hl - h = row &
  148. ; l = column to move to, at 109 is a routine to print a char in c,
  149. ; at 10c is a routine to print a decimal number in hl (for ansi tubes)
  150.  
  151. .var    scrout    0x0109
  152.  
  153. .org    0x0200
  154. .extern    moveto
  155. moveto:    push    hl        ; save coords
  156.     ld    c,'\e'
  157.     call    scrout        ; lead in escape
  158.     ld    c,'='
  159.     call    scrout        ; leadin '='
  160.     pop    hl
  161.     push    hl
  162.     ld    a,h        ; row to a
  163.     call    poff        ; out it goes w/ offset
  164.     pop    hl
  165.     ld    a,l        ; col to a
  166. poff:    add    a,' '        ; add offset
  167.     ld    c,a
  168.     jp    scrout        ; & print it
  169.  
  170. ; these next strings are used to do various screen functions. There are
  171. ; eight of them, and immediately preceding them is a flag byte. Each string
  172. ; has a bit in the byte, and if a capability is present, its bit should
  173. ; be set. This byte is an absolute necessity, as various programs use it
  174. ; to tell if various things are present.
  175.  
  176. .org    0x022f
  177. .extern    tcbits
  178. tcbits:    db    0b11111111    ; bits are:
  179.                 ; 0: bright        b_brite    1
  180.                 ; 1: dim        b_dim    2
  181.                 ; 2: delete line    b_delln    4
  182.                 ; 3: insert line    b_insln    8
  183.                 ; 4: delete character    b_delch    16
  184.                 ; 5: insert character    b_insch    32
  185.                 ; 6: clear end line    b_cleol    64
  186.                 ; 7: clear end screen    b_cleos    128
  187.  
  188.  
  189. ;.org    0x0230            ; don't need this: the byte above does it
  190. .extern    brites
  191. brites:    db    '\e(\0'        ; ****
  192.  
  193. .org    0x0238
  194. .extern    dims
  195. dims:    db    '\e)\0'        ; ****
  196.  
  197. .org    0x0240
  198. .extern    dlstr
  199. dlstr:    db    '\eR\0'        ; ****
  200.  
  201. .org    0x0248
  202. .extern    ilstr
  203. ilstr:    db    '\eE\0'        ; ****
  204.  
  205. .org    0x0250
  206. .extern    dcstr
  207. dcstr:    db    '\eW\0'        ; ****
  208.  
  209. .org    0x0258
  210. .extern    icstr
  211. icstr:    db    '\eQ\0'        ; ****
  212.  
  213. .org    0x0260
  214. .extern    ceol
  215. ceol:    db    '\eT\0'        ; ****
  216.  
  217. .org    0x0268
  218. .extern    ceos
  219. ceos:    db    '\eY\0'        ; ****
  220.  
  221. ; Entry and exit hooks. These are provided to perform custom initialisation
  222. ; on startup, and also to perform custom code on exit.
  223.  
  224. .org    0x0270
  225. .extern    entry
  226. entry:    jp    doent
  227.  
  228. ;.org    0x0273
  229. .extern    exit
  230. exit:    ret            ; ****
  231.  
  232. ; finally a patch area that is provided for patching odd systems that need
  233. ; a lot of space. This also doubles as a crafty method for making the overlay
  234. ; exactly 512 bytes - so a 'SAVE 2 QTERM.XXX' saves the patch area for use
  235. ; on later releases.
  236.  
  237. .org    0x0276
  238. doent:
  239.     ld    a,(b1200)
  240.     call    setbd
  241.     ld    a,(n18)
  242.     call    setmod
  243.     ret
  244.  
  245. sioout:    ld    hl,siodat
  246.     ld    bc,6 * 256 + sioc
  247.     otir
  248.     ret
  249.  
  250. domod:    ld    c,a        ; save byte in c
  251.     ld    hl,r3        ; look at byte for wr3
  252.     res    7,(hl)        ; turn off ms bit (Rx # bits / char)
  253.     add    a,a        ; move bit from 6 to 7 in a
  254.     and    0x80        ; mask off the rest
  255.     or    (hl)        ; or in the remainder
  256.     ld    (hl),a        ; and save it back
  257.     inc    hl
  258.     inc    hl        ; point hl at r4
  259.     ld    a,(hl)
  260.     and    0xf4        ; mask out bits we don't want
  261.     ld    b,a        ; save in b
  262.     ld    a,c        ; get set byte back
  263.     and    0x0b        ; get bits out of set byte that we want
  264.     or    b        ; or in the other bits
  265.     ld    (hl),a        ; and save it back
  266.     inc    hl
  267.     inc    hl        ; point hl at r5
  268.     ld    a,c
  269.     and    0x40        ; get the bit we want from c
  270.     res    6,(hl)        ; clear the bit in r5
  271.     or    (hl)
  272.     ld    (hl),a        ; put new composite value back
  273.     jp    sioout        ; go send the values
  274.  
  275. siodat:    db    3
  276. r3:    db    0b11000001    ; value for wr3 (0xc1)
  277.     db    4
  278. r4:    db    0b01000100    ; value for wr4 (0x44)
  279.     db    5
  280. r5:    db    0b11101010    ; value for wr5 (0xe5)
  281.  
  282. setf:    db    0        ; flag if we've done a set mode command
  283.