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-SB180.Z < prev    next >
Text File  |  1989-09-08  |  6KB  |  282 lines

  1. ; QT-SB180.Z - 'QTERM Overlay for the SB180'
  2. ;
  3. ; Adapted from the Echelon source provided by:
  4. ;     Author: W. Gonnason  (U. of Calgary Electrical Engineering)
  5. ; (D. Goodenough - 8-8-89)
  6. ;
  7. ;     - Based on the MEX Overlay for the Micromint SB180, external modem.
  8. ;
  9. ;     Date: January 04, 1989
  10. ;
  11. ;
  12. ;             Original MEX Overlay Credits:
  13. ;
  14. ;             M7KP-1 overlay structure by Irv Hoff
  15. ;             Adapted for the SB180 by Ken Davidson
  16. ;
  17. .var    yes    0xff
  18. .var    no    0
  19. ;
  20. ; Since the SB-180 requires an external terminal, I can't do too much
  21. ; in the way of terminal configuration. What I've done is to create
  22. ; three .vars: tvi, vt52, and vt100. If you're on a Televideo
  23. ; compatible (clear with '^Z', 'ESC' '=' to move) set tvi to yes, and
  24. ; the others to no. Similarly for VT52 terminals (H19 etc.) set vt52 to
  25. ; yes - and set vt100 if you have an ansi compatible. Unfortunately
  26. ; I've assumed a worst case scenario, and disabled all the neat
  27. ; screen functions that QTERM can use - you may wish to add in your
  28. ; own if you know how to drive your screen. Check QTERM.PAT for
  29. ; an explanation of tcbits, and the strings that follow it.
  30. ;
  31. ; EXACTLY ONE of these three must be yes, otherwise strange things will
  32. ; happen
  33. ;
  34. .var    tvi    yes
  35. .var    vt52    no
  36. .var    vt100    no
  37. ;
  38. ; Since the SB-180 can have the CPU clocked at 6, 9, or 12 MHz, set your
  39. ; clock speed in clock. It MUST be 6, 9, or 12, otherwise strange things
  40. ; will happen
  41. ;
  42. .var    clock    6
  43. ;
  44. ; macros to fake out the HD64180 in0 and out0 instructions
  45. ;
  46. .macro    in0    port
  47.     dw    0x38ed
  48.     db    port
  49. .endm
  50. ;
  51. .macro    out0    port
  52.     dw    0x39ed
  53.     db    port
  54. .endm
  55. ;
  56. .var    extctl    0        ;external modem control port
  57. .var    exstat    4        ;external modem status port
  58. .var    exdato    6        ;external modem data out port
  59. .var    exdati    8        ;external modem data in port
  60. .var    baudrp    2        ;external modem baud rate port
  61.  
  62. .org    0x0110
  63. modist:                ; get modem input status
  64.     in0    exstat        ; return Z clear if character ready
  65.     bit    7,a
  66.     ret
  67.  
  68. .org    0x0120
  69. modin:                ; Read a modem character
  70.     in0    exdati
  71.     ret
  72.  
  73. .org    0x0130
  74. modost:                ; get modem output status
  75.     in0    exstat        ; return Z clear if OK to send character
  76.     bit    1,a
  77.     ret
  78.  
  79. .org    0x0140
  80. modout:                ; Write a character to modem
  81.     out0    exdato
  82.     ret
  83.  
  84. .org    0x0150
  85. sbreak:                ; Start a break condition
  86.     ret            ; not supported
  87.  
  88. .org    0x0160
  89. ebreak:                ; End a break condition
  90.     ret            ; not supported
  91.  
  92. .org    0x0170
  93. dtroff:                ; Drop the DTR line
  94.     in0    extctl        ;Get current setting
  95.     or    0x10        ;Turn off DTR/RTS
  96.     out0    extctl
  97.     ret
  98.  
  99. .org    0x0180
  100. dtron:                ; Raise the DTR line
  101.     in0    extctl
  102.     and    0xef        ;Turn 'em back on again
  103.     out0    extctl
  104.     ret
  105.  
  106. .org    0x0190
  107. setbd:                ; set serial port baud rate
  108.     push    af
  109.     ld    a,(baudstor)
  110.     and    0b11111000
  111.     pop    bc
  112.     or    b
  113.     out0    baudrp        ; set it...
  114.     ld    (baudstor),a
  115.     ret
  116.  
  117. .org    0x01a0
  118. baudtb:
  119. .if    clock == 12
  120.     db    1,yes        ; 38400
  121.     db    2,yes        ; 19200
  122.     db    3,yes        ; 9600
  123.     db    0,no        ; 4800 is probably 4,yes
  124.     db    5,yes        ; 2400
  125.     db    6,yes        ; 1200
  126.     db    0,no        ; 600
  127.     db    14,yes        ; 300
  128. .elif    clock == 9
  129.     db    0,no        ; No 38400 on 9 MHz system...
  130.     db    0x20,yes    ; 19200 baud
  131.     db    0x21,yes    ; 9600 baud
  132.     db    0x22,yes    ; 4800 baud
  133.     db    0x23,yes    ; 2400 baud
  134.     db    0x24,yes    ; 1200 baud
  135.     db    0x25,yes    ; 600 baud
  136.     db    0x26,yes    ; 300 baud
  137. .else
  138.     db    0,no        ; No 38400
  139.     db    1,yes        ; 19200
  140.     db    2,yes        ; 9600
  141.     db    0,no        ; 4800 is probably 3,yes
  142.     db    4,yes        ; 2400
  143.     db    5,yes        ; 1200
  144.     db    0,no        ; 600
  145.     db    13,yes        ; 300
  146. .endif
  147.  
  148. .org    0x01b0
  149. setmod:                ; set communication mode
  150.     jp    dosetmod    ; not enough room here...
  151.  
  152. .org    0x01c0            ; communication mode table
  153. modtab:
  154.     db    0x60        ; 7 N 1
  155.     db    0x64        ; 8 N 1
  156.     db    0x61        ; 7 N 2
  157.     db    0x65        ; 8 N 2
  158.     db    0x62        ; 7 E 1
  159.     db    0x66        ; 8 E 1
  160.     db    0x63        ; 7 E 2
  161.     db    0x67        ; 8 E 2
  162.     db    0x72        ; 7 O 1
  163.     db    0x76        ; 8 O 1
  164.     db    0x73        ; 7 O 2
  165.     db    0x77        ; 8 O 2
  166.  
  167. resrvd:    db    0        ; reserved for future use
  168.  
  169. xfersz:    db    8        ; size of data transfers to/from disk
  170.                 ; during protocol transfer. Leave as 8
  171.                 ; unless your disk is very slow
  172.  
  173. speed:    db    clock
  174.  
  175. escchr:    db    '\\' & 0x1f
  176.  
  177. ;.org    0x01d0
  178. signon:    db    'Micromint SB-180\0'
  179.  
  180. .org    0x01f0            ; clear screen sequence
  181. clrs:
  182. .if    tvi
  183.     db    'z' & 0x1f, 0
  184. .elif    vt52
  185.     db    '\eE\0'
  186. .else
  187.     db    '\e[H\e[2J\0'
  188. .endif
  189.  
  190. .var    scrout    0x0109
  191. .var    decout    0x010c
  192.  
  193. .org    0x0200            ; move cursor to X,Y
  194. moveto:
  195.     push    hl
  196.     ld    c,'\e'
  197.     call    scrout
  198.     ld    c,[tvi ? '=' : [vt52 ? 'Y' : '[']]
  199.     call    scrout
  200. .if    vt100
  201.     pop    hl
  202.     push    hl
  203.     ld    h,0
  204.     inc    l
  205.     call    decout
  206.     ld    c,';'
  207.     call    scrout
  208.     pop    hl
  209.     ld    l,h
  210.     inc    l
  211.     ld    h,0
  212.     call    decout
  213.     ld    c,'H'
  214.     jp    scrout
  215. .else
  216.     pop    hl
  217.     push    hl
  218.     ld    a,h
  219.     call    poff
  220.     pop    hl
  221.     ld    a,l
  222. poff:    add    a,' '
  223.     ld    c,a
  224.     jp    scrout
  225. .endif
  226.  
  227. .org    0x022f
  228. tcbits:
  229.     db    0
  230.  
  231. ;.org    0x0230
  232. brites:    db    0        ;bright string
  233.  
  234. .org    0x0238
  235. dims:    db    0        ;dim string
  236.  
  237. .org    0x0240
  238. dlstr:    db    0        ;delete line
  239.  
  240. .org    0x0248
  241. ilstr:    db    0        ;insert line
  242.  
  243. .org    0x0250
  244. dcstr:    db    0        ;delete character
  245.  
  246. .org    0x0258
  247. icstr:    db    0        ;insert character
  248.  
  249. .org    0x0260
  250. ceol:    db    0        ;clear to end of line
  251.  
  252. .org    0x0268
  253. ceos:    db    0        ;clear to end-of-screen
  254.  
  255. .org    0x0270
  256. entry:                ; entry hook
  257.     ret
  258.  
  259. .org    0x0273
  260. exit:                ; exit hook
  261.     ret
  262.  
  263. .org    0x0276            ; Extra Patch Area
  264. dosetmod:
  265.     push    af
  266.     ld    a,(baudstor)
  267.     pop    bc
  268.     push    bc
  269.     bit    4,b
  270.     set    4,a
  271.     jr    nz,norst
  272.     res    4,a
  273. norst:    out0    baudrp        ;set even/odd
  274.     ld    (baudstor),a
  275.     pop    af
  276.     res    4,a        ;bring up DTR
  277.     out0    extctl        ;set parity/noparity
  278.     ret
  279.  
  280. baudstor:
  281.     db    0        ; storage for current baud rate.
  282.