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 / QTERM / QT6-SB18.ZZ0 / QT6-SB18.Z80
Text File  |  2000-06-30  |  9KB  |  411 lines

  1. ;
  2. ; QT-SB18.Z80 - Micromint SB180 overlay for QTERM 4.0a
  3. ;        by Steven Gold
  4. ;
  5. ; This overlay file was modeled after the Micromint SB180 overlay
  6. ; for use with Term3. (See T3M-HI3.Z80 or T3M-HI2.Z80)
  7. ;
  8. ; I have also used structures from other modem overlays. 
  9. ;
  10. ;
  11. ; The patch points indicated by the QTERM documentation have been 
  12. ; worked into the overlay, some routines have been moved around to fit
  13. ; the QTERM architecture, and others have been deleted since they do
  14. ; not apply to the QTERM program.
  15. ;
  16. ; TO USE: First edit this file with your favorite ASCII editor, changing
  17. ;        routines to conform to your hardware and changing
  18. ;        equates to conform to your implementation selections.
  19. ;        Then assemble with the SLR Systems SLR180 assembler and 
  20. ;        apply the overlay using MLOAD to the original .COM file 
  21. ;        to produce the patched .COM file.
  22. ;
  23. ; Note: While I admire David Goodenough's intentions with this software,
  24. ;    expecting most users to make their own patches with DDT, SID, or
  25. ;    whatever isn't exactly realistic. Hopefully, this overlay can be
  26. ;    used as the basis for more and better overlays to QTERM. Feel free
  27. ;    to fix and enhance as you wish!
  28. ;
  29. ;
  30. ; History:
  31. ;
  32. ;    03/22/89 - QT6-SB18 - David Goodenough supplied me with an other 
  33. ;    Steven Gold  overlay that was done for the SB-180 by Willy Gonnason of 
  34. ;                 the U. of Calgary Electrical Engineering Dept. I've used 
  35. ;                    his code for the BAUDSET and MODSET routines.
  36. ;
  37. ;    03/20/89 - QT5-SB18 - I couldn't get the Baud Rates to change properly,
  38. ;     Steven Gold  they still need alittle work. When you enter a baud
  39. ;                   rate with code I have it messes-up the baudrate port.
  40. ;             Still no support for 7E1 etc. Also I 
  41. ;                 found out I was overwriting other code in certain places,
  42. ;                    the program was working so I hadn't thought to check 
  43. ;             before.
  44. ;
  45. ;    03/18/89 - QT4-SB18 - release version
  46. ;
  47. ; Note2: The changing of baud rates still does not seem to work properly
  48. ;        and I still have not tried to set the port definitions for 7E1 etc.
  49. ;
  50. ; Note3: I use a terminal that emulates the Televideo 910 so I left the terminal
  51. ;        portion alone. 
  52. ;               
  53. ; *************************************************************************
  54. ;
  55. BELL:    EQU    07h    ;bell
  56. CR:    EQU    0Dh    ;carriage return
  57. ESC:    EQU    1Bh    ;escape
  58. LF:    EQU    0Ah    ;line feed
  59. BDOS:    EQU    05H
  60. ;
  61. YES:    EQU    0FFh
  62. NO:    EQU    0
  63. ;
  64. ;
  65. ; Select one of the following for your computer board
  66. ;
  67. CLK6    EQU    NO        ; Yes if using 6 MHz clock
  68. CLK9    EQU    YES        ; Yes if using 9 MHz clock
  69. Clk12    EQU    NO        ; Yes if using 12 MHz clock
  70. ;
  71. ;
  72. ;
  73. ; Values shown are for a HD64180
  74. ;
  75. ;
  76. PRINTC: EQU    0109h        ;QTERM print char routine address
  77. ;
  78. cntla    EQU    0        ; ASCI Control Register A Channel 0
  79. cntlb    EQU    2        ; ASCI Control Register B Channel 0
  80. stat    EQU    4        ; ASCI Status Register Channel 0
  81. tdr    EQU    6        ; ASCI Transmit Data Register Channel 0
  82. rdr    EQU    8        ; ASCI Receive Data Register Channel 0
  83. CTS    EQU    00100000B    ; Clear-to-send input (pin 5)
  84. DCD    EQU    00000100B    ; Data Carrier detect bit (pin 8)
  85. RDRF    EQU    10000000B    ; RECEIVE DATA REGISTER FULL
  86. TDRE    EQU    00000010B    ; TRANSMIT DATA REGISTER EMPTY
  87. ;
  88. ;
  89. ;
  90. ;    Code begins here...
  91. ;
  92. ; Modem input status routine:
  93. ;
  94.     ORG    0110h
  95. ; Input status.  Returns Z and A=0 if nothing waiting.
  96. ;
  97. ISTAT:    CALL    IISTAT
  98.     AND    RDRF
  99.     RET    Z
  100.     LD    A,0FFH
  101.     RET
  102. ;
  103. ;
  104. ; Read Modem character routine:
  105. ;
  106.     ORG    0120h
  107. ;
  108. ; Recieve a character
  109. ;
  110. INP:    CALL    ISTAT
  111.     JR    Z,INP
  112.     IN0    A,(rdr)
  113.     RET
  114. ;
  115. ; Modem output status routine:
  116. ;
  117.     ORG    0130h
  118. ; Output status.  Returns Z and A=0 if not ready to send.
  119. ;
  120. OSTAT:    CALL    IISTAT        ; GET STATUS REG
  121.     AND    TDRE
  122. OST1:    LD    A,0FFH
  123.     OR    A
  124.     RET
  125. ;
  126. ; Write Modem character routine:
  127. ;
  128.     ORG    0140h
  129. ;
  130. OUTP:    PUSH    AF
  131.     CALL    CKCTS        ; check CTS
  132. OUTP1:    CALL    OSTAT
  133.     JR    Z,OUTP1
  134. OUTP2:    POP    AF        ; return point from "CTS false" delay
  135.     OUT0    (tdr),A
  136.     RET
  137. ;
  138.  
  139. ;
  140. ; Start break routine:
  141. ;
  142.     ORG    0150h
  143. STRBRK:
  144.     RET
  145. ;
  146. ; End Break routine:
  147. ;
  148.     ORG    0160h
  149. ENDBRK:
  150.     RET
  151. ;
  152. ; Drop DTR routine:
  153. ;
  154.     ORG    0170h
  155. ;Turn DTR (and RTS) OFF. (set)
  156. dtroff:
  157.     in0    a,(cntla)
  158.     or    10h        ; RTS off
  159.     out0    (cntla),a
  160.     ret
  161.  
  162. ;
  163. ; Restore DTR routine:
  164. ;
  165.     ORG    0180h
  166. ;Turn DTR (and RTS) ON. (reset)
  167. dtron:
  168.     in0    a,(cntla)
  169.     and    0efh        ; RTS on
  170.     out0    (cntla),a
  171.     ret
  172. ;
  173. ; Set Baud Rate routine:
  174. ;
  175. ;
  176.     ORG    190H        ; set serial port baud rate
  177. BAUDSET:
  178.     PUSH    AF
  179.     LD    A,(BAUDSTOR)
  180.     AND    11111000B
  181.     POP    BC
  182.     OR    A,B
  183.     OUT0    (cntlb),A    ; set it...
  184.     LD    (BAUDSTOR),A
  185.     RET
  186.  
  187.  
  188.  
  189. ;
  190. ; Baud rate table:
  191. ;
  192.     ORG    01A0h
  193. ; Baud Rate Tables
  194. ;
  195.      if    clk6
  196. ;
  197. ; HD64180 commands to set baud rates @ 6.144 MHz clock
  198. ;
  199. BAUDTB:
  200.     DB    00,NO        ;38,400 bps disabled
  201.     DB    01h,NO        ;19,200 bps disabled
  202.     DB    02h,No        ; 9,600 bps enabled
  203.     DB    03h,No        ; 4,800 bps enabled
  204.     DB    04h,YES        ; 2,400 bps enabled
  205.     DB    05h,YES        ; 1,200 bps enabled
  206.     DB    06h,NO        ;   600 bps enabled
  207.     DB    0dh,Yes        ;   300 bps enabled
  208.      endif
  209.      if    clk9
  210. ;
  211. ; HD64180 commands to set baud rates @ 9.216 MHz clock
  212. ;
  213. BAUDTB:
  214.     DB    00,NO        ;38,400 bps disabled
  215.     DB    20h,NO        ;19,200 bps disabled
  216.     DB    21h,NO         ; 9,600 bps enabled
  217.     DB    22h,NO         ; 4,800 bps enabled
  218.     DB    23h,YES        ; 2,400 bps enabled
  219.     DB    24h,YES        ; 1,200 bps enabled
  220.     DB    25h,NO        ;   600 bps enabled
  221.     DB    26h,YES        ;   300 bps enabled
  222.      endif
  223.      if    clk12
  224. ;
  225. ; HD64180 commands to set baud rates @ 12.288 MHz clock
  226. ;
  227. BAUDTB:
  228.     DB    00,NO        ;38,400 bps disabled
  229.     DB    02H,NO        ;19,200 bps disabled
  230.     DB    03h,NO         ; 9,600 bps enabled
  231.     DB    04h,NO         ; 4,800 bps enabled
  232.     DB    05h,YES        ; 2,400 bps enabled
  233.     DB    06h,YES        ; 1,200 bps enabled
  234.     DB    0Dh,NO        ;   600 bps enabled
  235.     DB    0Eh,YES        ;   300 bps enabled
  236.      endif
  237. ;
  238. ; Communications mode setting routine:
  239. ;
  240. ;
  241.     ORG    1B0H
  242. SETMOD:                          ; set communication mode
  243.     JP    SETBAUDS      ; not enough room here...
  244. ;
  245. ;
  246.     ORG    1C0H              ; communication mode table
  247. MODTBL:
  248.     DB    60H        ; 7 N 1
  249.     DB    64H        ; 8 N 1
  250.     DB    61H        ; 7 N 2
  251.     DB    65H        ; 8 N 2
  252.     DB    62H        ; 7 E 1
  253.     DB    66H        ; 8 E 1
  254.     DB    63H        ; 7 E 2
  255.     DB    67H        ; 8 E 2
  256.     DB    72H        ; 7 O 1
  257.     DB    76H        ; 8 O 1
  258.     DB    73H        ; 7 O 2
  259.     DB    77H        ; 8 O 2
  260.  
  261.  
  262. ; Protocal Transfer Size
  263. ;
  264.     ORG     01CDH
  265.     RET
  266. ;
  267. ; Processor speed
  268. ;
  269.     ORG    01CEh
  270. ;
  271.      IF    CLK6
  272. CPUSPD:    DB    06H        ; Clock speed in MHz 
  273.      ENDIF            ; CLK6
  274.      IF    CLK9
  275. CPUSPD:    DB    09H        ; Clock speed in MHz 
  276.      ENDIF            ; CLK9
  277.      IF    CLK12
  278. CPUSPD:    DB    12H        ; Clock speed in MHz 
  279.      ENDIF            ; CLK12
  280.  
  281. ;
  282. ESCHAR:
  283.     DB    ESC        ; escape/meta char to enable QTERM functions
  284. ;
  285. ; Signon message (max of 15 bytes plus NULL terminator byte):
  286. ;
  287.     ORG    01D0h
  288. SIGNON:
  289.     DB    'Micromint SB180',0
  290. ;
  291. ; string to clear screen
  292. ;
  293.     ORG    01F0h
  294. CLSCRN:
  295.     DB    'Z'-'@',0    ; Control-Z on my Wyse-60 terminal
  296.  
  297. ;
  298. ; GOTOXY routine (to control cursor placement):
  299. ;
  300.     ORG    0200h
  301. GOTOXY:
  302. ;    RET
  303. ;
  304. ;
  305. ; Terminal capability bit map:
  306. ;    these bits are set (1) if the terminal capability is present and
  307. ;    reset (0) if it is not.
  308. ;
  309.     ORG    022Fh
  310. TCBMAP:
  311.     DB    11111111b
  312. ;        ||||||||
  313. ;        |||||||------- bright (end highlight)
  314. ;        ||||||-------- dim (start highlight)
  315. ;        |||||--------- delete line
  316. ;        ||||---------- insert line
  317. ;        |||----------- delete character
  318. ;        ||------------ insert character
  319. ;        |------------- clear to end of line
  320. ;        -------------- clear to end of screen
  321. ;
  322. ;
  323.  
  324. ;
  325. ; Term Cap strings:
  326. ;
  327.     ORG    0230h
  328. STHILT:    DB    ESC,'(',00h        ; 8 bytes to define start hilite...
  329. ;
  330.     ORG    0238h
  331. ENHILT:    DB    ESC,')',00h        ; 8 bytes to define end hilite...
  332. ;
  333.     ORG    0240h
  334. DELINE:    DB    ESC,'R',00h        ; delete line
  335. ;
  336.     ORG    0248h
  337. INSLIN: DB    ESC,'E',00h        ; insert line
  338. ;
  339.     ORG    0250h
  340. DELCHR:    DB    ESC,'W',00h        ; delete char
  341. ;
  342.     ORG    0258h
  343. INSCHR:    DB    ESC,'Q',00h        ; insert char
  344. ;
  345.     ORG    0260h
  346. CLREOL:    DB    ESC,'T',00h        ; clear to EOL
  347. ;
  348.     ORG    0268h
  349. CLREOS: DB    ESC,'Y',00h        ; clear to end of screen
  350. ;
  351. ;
  352. ; Entry subroutine
  353. ;
  354.     ORG     0270H
  355. ENTER:
  356.     RET
  357. ;
  358. ; Exit subroutine
  359. ;
  360.     ORG    0273H
  361. EXIT:
  362.     RET
  363. ;
  364. ;
  365. ; End of QTERM defined patches.
  366. ;
  367. ; begin custom patch area:
  368. ;
  369.     ORG    0276h
  370. ;
  371. ; Read stat twice, as per Hitachi manual
  372. ;
  373. IISTAT:    IN0    A,(stat)
  374.     IN0    A,(stat)
  375.     OR    A
  376.     RET
  377. ;
  378. ; Check state of CTS* and return A=0 and Z if CTS is true.
  379. ;
  380. CKCTS:    IN0    A,(cntlb)
  381.     AND    CTS
  382.     RET    Z
  383.     LD    A,0FFh
  384.     RET
  385. ;
  386. SETBAUDS:
  387.     PUSH    AF
  388.     LD    A,(BAUDSTOR)
  389.     POP    BC
  390.     PUSH    BC
  391.     BIT    4,B
  392.     SET    4,A
  393.     JR    NZ,NORST
  394.     RES    4,A
  395. NORST:
  396.     OUT0    (cntlb),A    ;set even/odd
  397.     LD    (BAUDSTOR),A
  398.     POP    AF
  399.     RES    4,A        ;bring up DTR
  400.     OUT0    (cntla),A    ;set parity/noparity
  401.     RET
  402.  
  403. BAUDSTOR:
  404.     DB    0        ; storage for current baud rate.
  405.     RET
  406.     
  407. ;
  408. ; Custom patch area must end *PRIOR* to 0300h!!!!!
  409. ;
  410.     END
  411.