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.Z80 < prev    next >
Text File  |  1989-09-08  |  4KB  |  210 lines

  1. ;     Title  'QTERM Overlay for the SB180'
  2. ;
  3. ;     Author: W. Gonnason  (U. of Calgary Electrical Engineering)
  4. ;
  5. ;     - Based on the MEX Overlay for the Micromint SB180, external modem.
  6. ;
  7. ;     Date: January 04, 1989
  8. ;
  9. ;     Assembler:  Echelon (R.I.P.) ZAS 2.0 or later
  10. ;
  11. ;             - assemble to a hex file, then use mload to lay the 
  12. ;               resulting hex file over qterm.com.
  13. ;
  14. ; >>>>> NOTE This overlay assumes a 9 MHZ clock - if you're running 6 MHZ or
  15. ; 12, you'll have to change the Baud rate table, and the cpu speed
  16. ;
  17.     .HD64                     ; needed for HD64180 op-codes
  18. ;
  19. ;
  20. ;             Original MEX Overlay Credits:
  21. ;
  22. ;             M7KP-1 overlay structure by Irv Hoff
  23. ;             Adapted for the SB180 by Ken Davidson
  24. ;
  25. ;----------------------------------------------------------------------
  26. ;
  27. PRTCHR    EQU    109H        ; print character in 'C'
  28. ;
  29. ;
  30. ; HD64180 port definitions
  31. ;
  32. EXPORT    EQU    00H        ;base external port
  33. EXTCTL    EQU    EXPORT        ;external modem control port
  34. EXSTAT    EQU    EXPORT+4    ;external modem status port
  35. EXDATO    EQU    EXPORT+6    ;external modem data out port
  36. EXDATI    EQU    EXPORT+8    ;external modem data in port
  37. BAUDRP    EQU    EXPORT+2    ;external modem baud rate port
  38. ;
  39. ;
  40.     ORG    110H
  41. MDMINST:            ; get modem input status
  42.     IN0    A,(EXSTAT)      ; return Z clear if character ready
  43.     BIT    7,A
  44.     RET
  45.  
  46.     ORG    120H
  47. RDMODEM:            ; Read a modem character
  48.     IN0    A,(EXDATI)
  49.     RET
  50.  
  51.     ORG    130H
  52. MDMOTST:            ; get modem output status
  53.     IN0    A,(EXSTAT)      ; return Z clear if OK to send character
  54.     BIT    1,A
  55.     RET
  56.  
  57.     ORG    140H
  58. WRMODEM:            ; Write a character to modem
  59.     OUT0    (EXDATO),A
  60.     RET
  61.  
  62.     ORG    150H        ; Start a break condition
  63. STRTBK:                ; not supported...
  64.     RET
  65.  
  66.     ORG    160H        ; End a break condition
  67. ENDBRK:                         ; nor supported...
  68.     RET
  69.  
  70.     ORG    170H        ; Drop the DTR line
  71. DROPDTR:
  72.     IN0    A,(EXTCTL)    ;Get current setting
  73.     OR    10H        ;Turn off DTR/RTS
  74.     OUT0    (EXTCTL),A
  75.     RET
  76.  
  77.     ORG    180H        ; Raise the DTR line
  78. RASEDTR:
  79.     IN0    A,(EXTCTL)
  80.     AND    0EFH        ;Turn 'em back on again
  81.     OUT0    (EXTCTL),A
  82.     RET
  83.  
  84.     ORG    190H        ; set serial port baud rate
  85. BAUDSET:
  86.     PUSH    AF
  87.     LD    A,(BAUDSTOR)
  88.     AND    11111000B
  89.     POP    BC
  90.     OR    A,B
  91.     OUT0    (BAUDRP),A    ; set it...
  92.     LD    (BAUDSTOR),A
  93.     RET
  94.  
  95.     ORG    1A0H
  96. BAUDTBL:
  97.     DB    0,0        ; No 38400 on 9 MHz system...
  98.     DB    20H,0ffH    ; 19200 baud
  99.     DB    21H,0ffH    ; 9600 baud
  100.     DB    22H,0ffH    ; 4800 baud
  101.     DB    23H,0ffH    ; 2400 baud
  102.     DB    24H,0ffH    ; 1200 baud
  103.     DB    25H,0ffH    ; 600 baud
  104.     DB    26H,0ffH    ; 300 baud
  105.  
  106.  
  107.     ORG    1B0H
  108. MODESET:                          ; set communication mode
  109.     JP    SETBAUDS      ; not enough room here...
  110.  
  111.     ORG    1C0H              ; communication mode table
  112. MODETBL:
  113.     DB    60H        ; 7 N 1
  114.     DB    64H        ; 8 N 1
  115.     DB    61H        ; 7 N 2
  116.     DB    65H        ; 8 N 2
  117.     DB    62H        ; 7 E 1
  118.     DB    66H        ; 8 E 1
  119.     DB    63H        ; 7 E 2
  120.     DB    67H        ; 8 E 2
  121.     DB    72H        ; 7 O 1
  122.     DB    76H        ; 8 O 1
  123.     DB    73H        ; 7 O 2
  124.     DB    77H        ; 8 O 2
  125.  
  126.  
  127.     ORG    01CEH
  128. SPEED:    DB    09
  129.  
  130.     ORG    01CFH
  131. ESCCHR:    DB    0BH
  132.  
  133.     ORG    01D0H
  134. SIGNON:    DB    'SB-180 with H-19 Terminal',0
  135.  
  136.     ORG    1F0H              ; clear screen sequence
  137. CLRSCR:
  138.     DB    1BH, 45H, 0
  139.  
  140.     ORG    0200H             ; move cursor to X,Y
  141. MOVETO:
  142.     PUSH    HL
  143.     LD    C, 1BH
  144.     CALL    PRTCHR
  145.     LD    C, 59H
  146.     CALL    PRTCHR
  147.     POP    HL
  148.     PUSH    HL
  149.     LD    A,H
  150.     ADD    20H
  151.     LD    C,A
  152.     CALL    PRTCHR
  153.     POP    HL
  154.     LD    A,L
  155.     ADD    20H
  156.     LD    C,A
  157.     CALL    PRTCHR
  158.     RET
  159.  
  160.     ORG    022FH
  161. TERMCAP:
  162.     DB    0FFH
  163.  
  164. TSTRINGS:                         ; terminal control codes
  165.     ORG    230H
  166.     DB    1BH, 71H, 0
  167.  
  168.     ORG    238H
  169.     DB    1BH, 70H,0
  170.  
  171.     ORG    240H
  172.     DB    1BH, 4DH, 0
  173.  
  174.     ORG    248H
  175.     DB    1BH, 4CH, 0
  176.  
  177.     ORG    250H
  178.     DB    1BH, 4EH, 0
  179.  
  180.     ORG    258H
  181.     DB    1BH,40H,20H,1BH,4FH,1BH,44H,0
  182.  
  183.     ORG    260H
  184.     DB    1BH, 4BH, 0
  185.  
  186.     ORG    268H
  187.     DB    1BH, 4AH, 0
  188.  
  189.     ORG    270H        ; Extra Patch Area
  190. SETBAUDS:
  191.     PUSH    AF
  192.     LD    A,(BAUDSTOR)
  193.     POP    BC
  194.     PUSH    BC
  195.     BIT    4,B
  196.     SET    4,A
  197.     JR    NZ,NORST
  198.     RES    4,A
  199. NORST:
  200.     OUT0    (BAUDRP),A    ;set even/odd
  201.     LD    (BAUDSTOR),A
  202.     POP    AF
  203.     RES    4,A        ;bring up DTR
  204.     OUT0    (EXTCTL),A    ;set parity/noparity
  205.     RET
  206.  
  207. BAUDSTOR:
  208.     DB    0        ; storage for current baud rate.
  209.     END
  210.