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

  1. ; QTERM Version 4.x Patch Area for Apple II w/ super serial card
  2.  
  3. ; This is a ZSM version of patch, created by disassembling QT-PCPI.COM
  4. ; as provided by Tom Bopp.
  5.  
  6. ; The overlay assumes that you have selected either Soroc or TVI software
  7. ; codes for your video driver, so that <ESC>-* will clear the screen and
  8. ; <ESC>-= is the leadin for cursor addressing.  You can check this by typing
  9. ; <ESC>* at the CP/M prompt and see if your screen clears.  If your screen
  10. ; does not clear, either change your driver using CONFIGSV and INSTALL, or
  11. ; use DDT to change the code in the overlay to the appropriate screen codes.
  12. ; See PATCH.DOC for details on patching QTERM.
  13.  
  14. ; The overlay contains code to allow you to set the baud rate and
  15. ; communications mode, as well as send a break and drop DTR (hang up).
  16. ; Inverse video is disabled because I find it distracting; you may reenable
  17. ; it by changing the byte at 022FH from C0H to C3H.  You should also check
  18. ; the other video strings and 0230H and 0238H for your terminal.
  19.  
  20. ; Since the Apple video system does not have hardware insert/delete for lines
  21. ; or characters, you cannot use the Split-Screen option of QTERM. However the
  22. ; VT-100 emulation will work.
  23.  
  24. ;                             PATCHING FOR APPLE II+
  25.  
  26. ; I have used QTERM with this overlay on my Apple II+, with only one change
  27. ; needed.  This is to change the byte at 01CFH, which specifies the escape
  28. ; character.  The Apple II+ keyboard does not have the \ symbol, so ^\
  29. ; cannot be typed.  I would suggest a change to either 1BH (ESC) or 1EH(^^).
  30.  
  31. ;                            PATCHING FOR OTHER SLOTS
  32.  
  33. ; To use a Super Serial Card in some slot other than slot 2, some of the
  34. ; addresses used in the overlay have to be changed.  In particular, all
  35. ; routines that access the serial card (addresses C0A8, C0A9, C0AA, and C0AB)
  36. ; will need to refer to offset addresses.  These one-for-one substitutions
  37. ; depend on the slot used, and can be made easily with DDT.  For example, if
  38. ; slot 1 is used, the addresses are C098, 99, 9A, and 9B; for slot 4 they
  39. ; would be C0C8, C9, CA, and CB.
  40.  
  41. ; This has now been automated by selection of the slot number with the
  42. ; variable slot - D. Goodenough 7-22-89
  43.  
  44. .var    slot    2        ; stick your slot number here
  45.  
  46. .var    base    0xc088 + 16 * slot
  47.                 ; base address to access super serial card
  48.  
  49. .var    data    base        ; serial card data port
  50. .var    status    base + 1    ; serial card status port
  51. .var    control    base + 2    ; serial card control port
  52. .var    modep    base + 3    ; serial card mode port
  53.  
  54. .var    yes    0xff        ; true value
  55. .var    no    0        ; false value
  56.  
  57. .org    0x0110
  58. modist:
  59.     push    de
  60.     ld    de,status
  61.     call    MODGET
  62.     and    8
  63.     pop    de
  64.     ret
  65.  
  66. .org    0x0120
  67. modin:
  68.     push    de
  69.     ld    de,data
  70.     call    MODGET
  71.     pop    de
  72.     ret
  73.  
  74. .org    0x0130
  75. modost:
  76.     push    de
  77.     ld    de,status
  78.     call    MODGET
  79.     and    0x10
  80.     pop    de
  81.     ret
  82.  
  83. .org    0x0140
  84. modout:
  85.     push    de
  86.     ld    de,data
  87.     call    MODPUT
  88.     pop    de
  89.     ret
  90.  
  91. .org    0x0150
  92. sbreak:
  93.     push    de
  94.     ld    de,control
  95.     push    de
  96.     call    MODGET
  97.     set    2,a
  98.     pop    de
  99.     call    MODPUT
  100.     pop    de
  101.     ret
  102.  
  103. ;.org    0x0160        ; not needed - the above is 16 bytes
  104. ebreak:
  105.     push    de
  106.     ld    de,control
  107.     push    de
  108.     call    MODGET
  109.     res    2,a
  110.     pop    de
  111.     call    MODPUT
  112.     pop    de
  113.     ret
  114.  
  115. ;.org    0x0170        ; not needed - the above is 16 bytes
  116. dtroff:
  117.     push    de
  118.     ld    de,control
  119.     push    de
  120.     call    MODGET
  121.     res    0,a
  122.     pop    de
  123.     call    MODPUT
  124.     pop    de
  125.     ret
  126.  
  127. ;.org    0x0180        ; not needed - the above is 16 bytes
  128. dtron:
  129.     push    de
  130.     ld    de,control
  131.     push    de
  132.     call    MODGET
  133.     set    0,a
  134.     pop    de
  135.     call    MODPUT
  136.     pop    de
  137.     ret
  138.  
  139. ;.org    0x0190        ; not needed - the above is 16 bytes
  140. setbd:
  141.     push    de
  142.     push    hl
  143.     ld    de,modep
  144.     push    de
  145.     push    af
  146.     call    MODGET    ; 0x0280 
  147.     jp    FINBD    ; 0x02a0 
  148.  
  149. .org    0x01a0
  150. baudtb:
  151. b38400:    db    0,no
  152. b19200:    db    0,no
  153. b9600:    db    0x0e,yes
  154. b4800:    db    0x0c,yes
  155. b2400:    db    0x0a,yes
  156. b1200:    db    8,yes
  157. b600:    db    7,yes
  158. b300:    db    6,yes
  159.  
  160. ;.org    0x01b0
  161. setmod:
  162.     ld    (MODSAV),a
  163.     push    de
  164.     ld    de,modep
  165.     push    de
  166.     call    MODGET
  167.     jp    FINMOD
  168.  
  169. MODSAV:
  170.     db    0x96
  171.  
  172. .org    0x01c0
  173. modtab:
  174. n17:    db    0b00110000    ;0x30, 7n1
  175. n18:    db    0b00010000    ;0x10, 8n1
  176. n27:    db    0b10110000    ;0xb0, 7n2
  177. n28:    db    0b10010000    ;0x90, 8n2
  178. e17:    db    0b00110110    ;0x36, 7e1
  179. e18:    db    0b00010110    ;0x16, 8e1
  180. e27:    db    0b10110110    ;0xb6, 7e2
  181. e28:    db    0b10010110    ;0x96, 8e2
  182. o17:    db    0b00110010    ;0x32, 7o1
  183. o18:    db    0b00010010    ;0x12, 8o1
  184. o27:    db    0b10110010    ;0xb2, 7o2
  185. o28:    db    0b10010010    ;0x92, 8o2
  186.  
  187. ;.org    0x01cc        ; don't need this - we're contiguous
  188. resrvd:    db    0    ; reserved for future use
  189.  
  190. ;.org    0x01cd
  191. xfersz:    db    8    ;number of K to read/write during file xfers
  192.  
  193. ;.org    0x01ce
  194. speed:    db    6    ;cpu speed
  195.  
  196. ;.org    0x01cf
  197. escape:    db    '\e'    ;escape character
  198.  
  199. ;.org    0x01d0
  200. signon:            ;signon message
  201.     db    'Apple II/PCPI/SSC\0'
  202.  
  203. .org    0x01f0
  204. clrs:            ; string to clear the screen
  205.     db    '\e*\0'
  206.  
  207. .var    scrout    0x0109    ;(a routine to print to CON: the
  208.             ;   character in C)
  209. .var    decout    0x010c    ;(a routine to print to CON: a decimal value
  210.             ;   in HL.  Is available for VT100 and the like.)
  211.  
  212. .org    0x0200
  213. moveto:
  214.     push    hl    ;move cursor to position in HL (Row,Col)
  215.     ld    c,'\e'    ; lead-in with Esc (the ASCII one; not QTERM's)
  216.     call    scrout
  217.     ld    c,'='    ; 2nd lead-in is '='
  218.     call    scrout
  219.     pop    hl
  220.     push    hl
  221.     ld    a,h    ; row value (top row is 0.)
  222.     call    poff    ; add offset and send it to screen
  223.     pop    hl
  224.     ld    a,l    ; col value (leftmost col is 0.)
  225. poff:    add    a,' '    ; (adds 20h)
  226.     ld    c,a
  227.     jp    scrout    ; (scrout returns from 'moveto's call)
  228.  
  229.  
  230. ; Terminal Capability Bits.  The eight bits stand for each of the following
  231. ;   strings.   They count from 01h=bright to 80h=clear-to-end-of-screen.
  232.  
  233. .var    b_brit    0b00000001    ; 0: bright (1.)    -- NOT mandatory
  234. .var    b_dim    0b00000010    ; 1: dim    (2.)    -- NOT mandatory
  235. .var    b_dlln    0b00000100    ; 2: delete line (4.)    -- important
  236. .var    b_inln    0b00001000    ; 3: insert line (8.)    -- important
  237. .var    b_dlch    0b00010000    ; 4: delete character (16.)-- unused by QTERM
  238. .var    b_inch    0b00100000    ; 5: insert character (32.)-- NOT mandatory
  239. .var    b_clel    0b01000000    ; 6: clear to end-of-line(64.) -- important
  240. .var    b_cles    0b10000000    ; 7: clear to end-of-screen(128.)-- important
  241.  
  242. .org    0x022f
  243. tcbits:    db    b_clel + b_cles    ; capability bits
  244.  
  245. ;.org    0x0230
  246. brites:    db    '\e(\0'    ;bright string
  247.  
  248. .org    0x0238
  249. dims:    db    '\e)\0'    ;dim string
  250.  
  251. .org    0x0240
  252. dlstr:    db    0    ;delete line - not available
  253.  
  254. .org    0x0248
  255. ilstr:    db    0    ;insert line - not available
  256.  
  257. .org    0x0250
  258. dcstr:    db    0    ;delete character - not available
  259.  
  260. .org    0x0258
  261. icstr:    db    0    ;insert character - not available
  262.  
  263. .org    0x0260
  264. ceol:    db    '\eT\0'    ;clear to end of line
  265.  
  266. .org    0x0268
  267. ceos:    db    '\eY\0'    ;clear to end-of-screen
  268.  
  269. ; Entry and Exit hooks.  These are provided to perform custom initialisation
  270. ; on startup and on exit from QTERM.  They are invoked before any use is made
  271. ; of the screen or the port hardware.
  272.  
  273. .org    0x0270
  274. entry:    ret        ; entry hook (270h .. 272h)
  275.  
  276. .org    0x0273
  277. exit:    ret        ; exit hook  (273h .. 275h)
  278.  
  279. .org    0x0276
  280.     db    'PATCH AREA'
  281.  
  282. .org    0x280
  283. MODGET:
  284.     push    bc
  285.     ld    c,6
  286.     call    0xffe3
  287.     call    0xffe9
  288.     call    0xffe0
  289.     pop    bc
  290.     ret
  291.  
  292. .org    0x290
  293. MODPUT:
  294.     push    bc
  295.     ld    b,a
  296.     ld    c,7
  297.     call    0xffe3
  298.     call    0xffe9
  299.     ld    c,b
  300.     call    0xffe3
  301.     pop    bc
  302.     ret
  303.  
  304. .org    0x2a0
  305. FINBD:
  306.     and    0xf0
  307.     pop    hl
  308.     or    h
  309.     pop    de
  310.     call    MODPUT
  311.     pop    hl
  312.     pop    de
  313.     ret
  314.  
  315. .org    0x2b0
  316. FINMOD:
  317.     and    0x0f
  318.     push    hl
  319.     ld    h,a
  320.     ld    a,(MODSAV)
  321.     and    0xf0
  322.     or    h
  323.     pop    hl
  324.     pop    de
  325.     call    MODPUT
  326.     ld    a,(MODSAV)
  327.     and    0x0f
  328.     rlca
  329.     rlca
  330.     rlca
  331.     rlca
  332.     or    0x0b
  333.     ld    de,control
  334.     call    MODPUT
  335.     pop    de
  336.     ret
  337.