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-HP125.Z < prev    next >
Text File  |  1989-09-08  |  8KB  |  275 lines

  1. ; QT-HP125.Z - QTERM Overlay for Hewlett-Packard HP-125 Computer
  2. ;
  3. ; Author: Mike Freeman 17-Apr-89
  4. ; 301 N.E. 107th Street; Vancouver, Wa 98685; (206)574-8221
  5. ;
  6. : Modified 6/24/89 by D. Goodenough to use ZSM style
  7. ;
  8. ; See QTERM.PAT for documentation of QTERM's patch area
  9. ;
  10. ; I claim no copyright on this overlay; as a road-sign in Oklahoma
  11. ; once said:  "No Speed Limit -- Do Your Damnedest"
  12. ;
  13. ; The program QTERM is Copyright 1989 by DPG (David Goodenough)
  14. ;
  15. ; Revised 04/19-89 to save/restore all Z80 registers (including IX and IY)
  16. ; during BDOS calls; Ymodem Batch transfers now work -- Mike Freeman
  17. ;
  18. ; Re-revised for V4.2, - new entries in patch added, and IX / IY stuff
  19. ; deleted since it got fixed in V4.1e -- DPG  7-31-89
  20. ;
  21. ;This overlay adapts QTERM.COM from QTERMxxx.LBR to run on the Hewlett-Packard
  22. ;HP-125 Series 100 Business Computer running a HP-modified CP/M Version 2.2
  23. ;operating system.  This overlay is a full QTERM implementation except that:
  24. ;(1) Break is not implemented (a Break can be sent from the Keyboard only);
  25. ;(2) The DTR-manipulation/modem hangup routines are not implemented; (3) The
  26. ;routine to change Baud-rate is not implemented (this is changed from the
  27. ;Keyboard's Configuration Menu); (4) Stop-bit manipulation is not implemented
  28. ;(HP gives the user no way to do this) and (5) changing of parity is not
  29. ;implemented (this is also changed from the Configuration Menu).  The Hp-125
  30. ;consists of 2 Z80 processors: one is the CPU and the other handles terminal
  31. ;I/O.  HP does not allow the user to access the Z80 I/O ports directly.
  32. ;However, HP does provide the CP/M Reader and Punch BDOS calls along with
  33. ;a "subfunction" call (passed in BC) to get Reader status.  When properly
  34. ;mapped, the Reader takes input from Datacomm Port 1 and the Punch sends
  35. ;output to Datacomm Port 1.  All data is in the form 8N1 and special
  36. ;provisions must be made to insure that all 8 bits of data are sent/received
  37. ;by DAtacomm 1. (Datacomm 2, the Printer Port, can only accommodate 7-bit
  38. ;data).  Device mapping of Reader/Punch to Datacomm Port 1 is accomplished
  39. ;by sending a series of escape sequences to the HP-125's Console (rather than
  40. ;using the IO byte).
  41. ;
  42. ;To assemble QT-HP125.Z using ZSM, and overlay with ZPATCH
  43. ;A>ZSM QT-HP125
  44. ;A>ZPATCH QTERM.COM QT-HP125
  45.  
  46. .var    no    0
  47. .var    yes    ! no
  48.  
  49. ; Parameters
  50. ;
  51.  
  52. .var    hayes    no        ;'yes' means HAYES-style hang-up string
  53. ;
  54. ;BDOS equates
  55. ;
  56. .var    boot    0        ;CP/M Warm-start
  57. .var    rdr    3        ; Reader input
  58. .var    pun    4        ; Punch output
  59. .var    bdos    5        ; BDOS entry
  60. .var    prt    9        ; Print "$"-terminated string to Console
  61. ;
  62. ;Special HP subfunctions
  63. ;
  64. .var    rdrsts    0x70ff        ; Get Reader status (A nonzero if char ready)
  65. .var    bits8    0x73ff        ; Set Datacomm 1 to pass 8-bit data
  66. .var    bits7    0x74ff        ; Set Datacomm 1 to allow only 7-bit data
  67. .var    jvt    0x7eff        ; Jump-vector (BIOS routine address) transfer
  68. ;
  69. ;Ascii equates
  70. ;
  71. .var    escchr    '\\' & 0x1f    ; QTERM's local escape character
  72. ;
  73. ;Routine addresses
  74. ;
  75. .var    scrout    0x0109        ; Character in C to Console
  76. .var    decout    0x010C        ; Number in HL to Console in decimal
  77. ;
  78. ;
  79. ;Get modem (Reader) status
  80. ;
  81. .org    0x0110        ; Overlay starts here
  82.     ld    bc,rdrsts    ; Set subfunction call to
  83.     jp    bdos        ; Get Reader status
  84. ;
  85. ;Get modem character into A
  86. ;
  87. .org    0x0120
  88.     ld    c,rdr        ; Set function call to
  89.     jp    bdos        ;Get character
  90. ;
  91. ;Get Punch status (always true)
  92. ; DPG - This strikes me as a trifle dangerous, but I am assured by Mike F.
  93. ; that it works. So if it ain't broke, don't fix it
  94. ;
  95. .org    0x0130
  96.     xor    a        ;Set Z
  97.     inc    a        ;Clear Z
  98.     ret            ; And return
  99. ;
  100. ;Send character in A to Punch
  101. ;
  102. .org    0x0140
  103.     ld    e,a        ; Put character in E
  104.     ld    c,pun        ; Set function call to
  105.     jp    bdos        ;Send character
  106. ;
  107. ;Set Break (not implemented)
  108. ;
  109. .org    0x0150
  110.     ret
  111. ;
  112. ;Clear break (not implemented)
  113. ;
  114. .org    0x0160
  115.     ret
  116. ;
  117. ;Kill DTR routines/modem hang-up string (not implemented)
  118. .org    0x0170
  119. .if    ! hayes
  120.     nop            ; move the return
  121. .endif
  122.     ret            ;Modem hangup string follows
  123. .if    hayes
  124.     db    10,0xfe,'+++',0xfe,'ATH0\r',
  125. .endif
  126. ;
  127. ;Restore DTR (not implemented)
  128. ;
  129. .org    0x0180
  130.     ret
  131. ;
  132. ;Baud-rate setting routine (not implemented
  133. ;
  134. .org    0x0190
  135.     ret
  136. ;
  137. ;Baud rate table is empty
  138. ;
  139. .org    0x01a0
  140.     db    0,no
  141.     db    0,no
  142.     db    0,no
  143.     db    0,no
  144.     db    0,no
  145.     db    0,no
  146.     db    0,no
  147.     db    0,no
  148. ;
  149. ;Set Parity/Stop-bits (not implemented)
  150. ;
  151. ;.org    0x01b0
  152.     ret
  153. ;
  154. .org    0x01c0
  155.     db    0,0,0,0,0,0,0,0,0,0,0,0
  156.  
  157. ;.org    0x01cc
  158.     db    0        ;Reserved for future use
  159. ;
  160. ;.org    0x01cd
  161.     db    8        ; Transfer size
  162. ;
  163. ;.org    0x01ce
  164.     db    4        ; Processor speed in mHz
  165. ;
  166. ;.org    0x01cf
  167.     db    '\\' & 0x1f    ; Escape character
  168. ;
  169. ;.org    0x01d0
  170.     db    'HP-125 Series 100\0' ; Sign-on id
  171. ;
  172. ;.org    0x01f0
  173.     db    '\eH\eJ\0    ; Home cursor/clear screen
  174. ;
  175. ;MOVETO - Place cursor in row/column H/L
  176. ;
  177. .org    0x0200
  178. moveto:    push    hl        ; Save row/column
  179.     ld    c,'\e'        ; Send cursor leadin
  180.     call    conout
  181.     ld    c,'&'
  182.     call    conout
  183.     ld    c,'a'
  184.     call    conout
  185.     pop    hl        ; Get row/column
  186.     push    hl        ; Save again
  187.     ld    l,h        ; Get row
  188.     ld    h,0        ; Make 16-bit integer
  189.     call    decout        ; Type in decimal to Console
  190.     ld    c,'r'        ; Say it was a row
  191.     call    conout
  192.     pop    hl        ; Get row/column
  193.     ld    h,0        ; Isolate column as 16-bit integer
  194.     call    decout        ; Type in decimal
  195.     ld    c,'C'        ; Terminate sequence - column
  196.     jp    conout        ; And return
  197. ;
  198. .org    0x022f
  199.     db    0b11111111    ; Terminal capabilities (all)
  200. ;
  201. ;.org    0x0230
  202.     db    '\e&@\0'    ; Enhancement off
  203. .org    0x0238
  204.     db    '\e&F\0'    ; Enhancement on
  205. .org    0x0240
  206.     db    '\eM\0'        ; Delete line
  207. .org    0x0248
  208.     db    '\eL\0'        ; Insert line
  209. .org    0x0250
  210.     db    '\eP\0'        ; Delete character
  211. .org    0x0258
  212.     db    '\eR \eQ\b\0'    ; Insert character
  213. .org    0x0260
  214.     db    '\eK\0'        ; Clear to end-of-line
  215. .org    0x0268
  216.     db    '\eJ\0'        ; Clear to end-of-screen
  217. ;
  218. ;
  219. .org    0x0270
  220.     jp    init        ; Initialization
  221. ;.org    0x0273
  222.     jp    finish        ; Termination
  223. ;.org    0x0276
  224.     ret            ; user code - ^\ U
  225. .org    0x0279
  226.     ret            ; keyboard window
  227. ;
  228. ;Initialization code
  229. ;
  230. .org    0x0280
  231. init:    ld    de,jbuf        ; Point to dispatch vector address arg block
  232.     ld    bc,jvt        ; Set subfunction call to
  233.     call    bdos        ; Get Reader input routine address
  234.     ld    hl,(jbuf + 3)    ; Remember this address
  235.     ld    (read8 + 1),hl    ; For 8-bit Reader routine
  236.     ld    hl,read8    ; Put this address in BIOS dispatch table
  237.     ld    bc,bits8    ; Set up to set 8-bit passthru
  238.     jr    comcod        ; And branch to common code
  239. ;
  240. ;Final (exit) code
  241. ;
  242. finish:    ld    hl,(read8 + 1)    ; Point to real Reader input address
  243.     ld    bc,bits7    ; Set for 7-bit terminal passthru
  244.     ld    a,'9'        ; Set to turn off Datacomm mappings
  245.     ld    (mapseq + 8),a
  246.     ld    (mapseq + 19),a    ; And fall into common code
  247. ;
  248. comcod:    push    bc        ; Save passthru function code
  249.     ld    (jbuf + 3),hl    ; Put BIOS dispatch address in arg block
  250.     ld    a,1        ; Say we want to write into dispatch table
  251.     ld    (jbuf + 1),a
  252.     ld    de,jbuf        ; Point to jump vector argument block
  253.     ld    bc,jvt        ; Set subfunction call to
  254.     call    bdos        ; Write routine address into dispatch table
  255.     ld    de,mapseq    ; Send mapping escape sequences
  256.     ld    c,prt        ; To the Console
  257.     call    bdos        ; To do/undo Reader/Datacomm Port 1 mappings
  258.     pop    bc        ; Get passthru code
  259.     jp    bdos        ; Set passthru and return
  260. ;
  261. ;Routine to read 8-bit data from Datacomm Port 1
  262. ;
  263. read8:    call    0        ; Read data
  264.     ld    a,b        ; Get 8-bit data
  265.     ret            ; And return
  266. ;
  267. ;Put BIOS routine address vector block here
  268. ;
  269. jbuf:    db    7,0,0xc3,0,0    ; ...
  270. ;
  271. ;Escape sequence string to map Reader/Punch to Datacomm Port 1
  272. ;
  273. mapseq:    db    '\e&i0s25d2M'    ; Map Datacomm 1 to Reader
  274.     db    '\e&i10s16d2M$' ; And Punch to Datacomm 1
  275.