home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / trompat2.lbr / WSKEYS.AZM / WSKEYS.ASM
Encoding:
Assembly Source File  |  1993-10-25  |  5.1 KB  |  291 lines

  1.     .title    "WordStar Function Keys"
  2.     .pabs
  3.     .phex
  4.     .xlink
  5.     .setdat    7/1/86
  6.     .settim    8:34:00
  7.     .setwid    120
  8. ;
  9. ;    7/1/86    gsd    morpat for 3.3 changed to 02d7h
  10. ;            eliminated last 3.3 patch
  11. ;
  12. ;
  13. ;    note: this code assembles with the CDL ZASM assembler
  14. ;
  15. version    =\    "WordStar Version 30 or 33 "
  16.  
  17.     .ife    version-30,[
  18.     .sbttl    "Version 3.0"
  19. ucnsta    =    002BAH
  20. xtab    =    00649H
  21. fptab    =    0066EH
  22. nfilx    =    00470H
  23. vtab    =    00481H
  24. inisub    =    002A4H
  25. morpat    =    002E0H
  26. pbgmem    =    0035CH
  27. patch1    =    01C04H
  28. epat1    =    01C2EH
  29. patch2    =    01E4EH
  30. epat2    =    01E63H
  31. RECR    =    02121H
  32. patch3    =    RECR
  33. epat3    =    0213EH
  34. ftchry    =    01CF3H
  35. ftchrx    =    01D14H
  36. CRPU    =    02316H
  37. ecrpu    =    02330H
  38. bioscl    =    01D58H
  39.  
  40.     ]
  41.     [
  42.     .sbttl    "Version 3.3"
  43. ucnsta    =    0029AH
  44. xtab    =    00655H
  45. fptab    =    0067AH
  46. nfilx      =    0047CH
  47. vtab    =    00489H
  48. inisub    =    00287H
  49. morpat    =    002d7h    ; formorally 002CBH
  50. pbgmem    =    0034BH
  51. patch1    =    01C1AH
  52. epat1    =    01C44H
  53. patch2    =    01E68H
  54. epat2    =    01E7DH
  55. RECR    =    0213BH
  56. patch3    =    RECR
  57. epat3    =    02158H
  58. ftchry    =    01D09H
  59. ftchrx    =    01D2AH
  60. CRPU    =    02330H
  61. ecrpu    =    0234AH
  62. bioscl    =    01D6EH
  63.     ]
  64.  
  65. ;*****************************
  66. ;patch space at end of nofile dispatch (0CH bytes)
  67.     .loc    nfilx+5
  68. getflg:    lhld    1    ;get bios pointer
  69.     mvi    l,034H
  70.     ret
  71.  
  72. ;note that 3.3 has less space than 3.0
  73.     .ifg    .-vtab,[
  74.     .error    "NFILX Patch Overflow"
  75.     ]
  76.     .remark    " "
  77. ;*****************************
  78. ;patch space at end of edit dispatch (20H bytes)
  79.     .loc    xtab+5
  80. ;***
  81. ;set bios flag
  82. ninit:    call    getflg
  83.     set    7,m    ;get function keys raw
  84.     ret        ;6 bytes
  85. ;***
  86. ;reset bios flag
  87. dinit:    call    getflg
  88.     res    7,m    ;switch of function raw
  89.     ret        ;6 bytes
  90. ;***********
  91. ;new console input routine
  92. bconin:    call    bcnsta
  93.     ora    a
  94.     jrz    bconin    ;loop until ready
  95. nxtchr    =    .+1
  96.     mvi    a,0    ;in line buffer
  97.     lxi    h,nxtchr
  98.     mvi    m,0    ;clear buffer
  99.     ret        ;13 bytes
  100. ;*********
  101.  
  102.     .ifg    .-fptab,[
  103.     .error    "XTAB Patch Overflow"
  104.     ]
  105.     .remark    " "
  106. ;*****************************
  107. ;new init and de-init jumps
  108.     .loc    inisub
  109.     jmp    ninit
  110.     jmp    dinit
  111.  
  112. ;****************************
  113. ;new console status and input jumps
  114.     .loc    ucnsta
  115.     jmp    bcnsta
  116.     jmp    bconin
  117.  
  118. ;*****************************
  119. ;main user patch area (07CH bytes)
  120.     .loc    morpat
  121. ;use this area to store the actual tables as we neeed 
  122. ;a reasonable contiguous area
  123.  
  124. strptr:    .byte    str0- .    ;use self relative pointer
  125.     .byte    str1- .
  126.     .byte    str2- .
  127.     .byte    str3- .
  128.     .byte    str4- .
  129.     .byte    str5- .
  130.     .byte    str6- .
  131.     .byte    str7- .
  132.     .byte    str8- .
  133.     .byte    str9- .
  134.     .byte    strA- .
  135.     .byte    strB- .
  136.     .byte    strC- .
  137.     .byte    strD- .
  138.     .byte    strE- .
  139.     .byte    strF- .
  140.     .byte    str10- .
  141.     .byte    str11- .
  142. str0:    .byte    'E'-'@' ! 80H
  143. str1:    .byte    'X'-'@' ! 80H
  144. str2:    .byte    'S'-'@' ! 80H
  145. str3:    .byte    'D'-'@' ! 80H
  146. str4:    .ascis    '0'
  147. str5:    .ascis    '1'
  148. str6:    .ascis    '2'
  149. str7:    .ascis    '3'
  150. str8:    .ascis    '4'
  151. str9:    .ascis    '5'
  152. strA:    .ascis    '6'
  153. strB:    .ascis    '7'
  154. strC:    .ascis    '8'
  155. strD:    .ascis    '9'
  156. strE:    .ascis    '-'
  157. strF:    .ascis    ','
  158. str10:    .byte    'M'-'@' ! 80H
  159. str11:    .ascis    '.'
  160.  
  161.  
  162. ;space for bigger strings --average 5 bytes per key
  163.  
  164.     .ifg    .-pbgmem,[
  165.     .error    "MORPAT Patch Overflow"
  166.     ]
  167.     .remark    " "
  168. ;*****************************
  169. ;  (017H bytes)
  170.     .loc    patch2
  171. ;continued constat routine
  172. ;
  173. ;***********
  174. ;new console status routine
  175. bcnsta:    lda    nxtchr    ;see if char in buff
  176.     ora    a
  177.     rnz        ;already set
  178. morchr    =    .+1
  179.     mvi    a,0    ;inline flag
  180.     ora    a    ;test if we are sending string
  181.     jz    notstr
  182. rentry:    push    psw    ;save exit flag
  183.     call    getstr
  184.     rlc
  185.     srlr    a    ;crunch and get hi bit in cy
  186.     jmp    cnsta1
  187.  
  188.     .ifg    .-epat2,[
  189.     .error    "Patch2 Area Overflow"
  190.     ]
  191.     .remark    " "
  192. ;******************************
  193. ;  (02AH bytes)
  194.     .loc    patch1
  195. notstr:    mvi    a,3
  196.     call    bioscl    ;direct bioscall
  197.     ora    a    ;test if ready
  198.     rz        ;return if not
  199.     xra    a
  200.     dcr    a
  201.     push    psw
  202.     mvi    a,6
  203.     call    bioscl    ;go get character
  204.     ora    a    ;set flags
  205.     sta    nxtchr    ;save it in conin
  206.     jp    notlst    ;if not > 7FH
  207.     ani    07FH    ;crunch hi bit
  208.     lxi    h,strptr
  209.     call    addahl    ;get offset to ptr
  210.     mov    a,m    ;get offset to string
  211.     call    addahl    ;add in offset
  212.     shld    cptr    ;save the pointer
  213.     jmp    cnsta2
  214.  
  215.     .ifg    .-epat1,[
  216.     .error    "Patch1 Area Overflow"
  217.     ]
  218.     .remark    " "
  219. ;*****************************
  220. ; (01FH bytes)
  221.     .loc    ftchry
  222.     jmpr    ftchrx
  223. ;*****
  224. cptr:    .word    0
  225. ;*****
  226. addahl:    add    l
  227.     mov    l,a
  228.     rnc
  229.     inr    h
  230.     ret
  231. ;*****
  232. getstr:    lhld    cptr
  233.     mov    a,m    ;get char
  234.     inx    h
  235.     shld    cptr    ;save it again
  236.     ret
  237. ;*****
  238.  
  239. cnsta1:    sta    nxtchr
  240.     jrnc    notlst    ;if not end of str
  241.     xra    a
  242.     sta    morchr    ;mark end of string
  243. notlst:    pop    psw
  244.     ret
  245.  
  246.     .ifg    .-ftchrx,[
  247.     .error    "RUBFX Patch Overflow"
  248.     ]
  249.     .remark    " "
  250. ;*****************************
  251. ;  (01EH bytes)
  252.     .loc    patch3
  253.     ret
  254. ;***
  255. ;******
  256. cnsta2:    pop    psw
  257.     sta    morchr    ;mark start of string
  258.     jmp    rentry    ;use start of routine
  259.  
  260.  
  261.  
  262.  
  263.     .ifg    .-epat3,[
  264.     .error    "RECR Patch Area Overflow"
  265.     ]
  266.     .remark    " "
  267. ;*****************************
  268. ;  (01AH bytes)
  269.     .loc    CRPU
  270.  
  271.  
  272.  
  273.  
  274.     .ifg    .-ecrpu,[
  275.     .error    "CRPU Patch Area Overflow"
  276.     ]
  277.     .remark    " "
  278. ;******************************
  279. ;patches needed to fix some of the strange wordstars
  280. ;that kaypro has distributed
  281.     .ife    version-33,[
  282.     .loc    03EE3H
  283.     call    inisub
  284. ;
  285. ;    this code eliminated 7/1/86 gsd
  286. ;    .loc    03C57H
  287. ;    call    03EA0H
  288.     ]
  289.  
  290.     .end
  291.