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 / PROGRAMS / WSTAR / WS-USER.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  8KB  |  272 lines

  1. ;
  2. ;******************************************************************************
  3. ;
  4.     title    'WS-USER -- Patch for Wordstar Overlay Files'
  5. ;
  6. ;        (New, shorter version, (shrunk it so my other,
  7. ;         printer status patch would fit with this one
  8. ;         in the MORPAT area), added values for WS v3.3)
  9. ;
  10. ;                     -- Kim Levitt  11/13/84
  11. ;
  12. ;******************************************************************************
  13. ;
  14. ;    WS.COM can be made to work with ZCPR/ZCPR2/ZCPR3/etc.     04/17/84
  15. ;
  16. ;  You know how irritating the @@@@'s get when you try to open a file in a 
  17. ; user area that does not have the *.OVR files present ?????  I had been 
  18. ; pipping everything to a given user area to edit and then back again. ARRGH.
  19. ; To make a long story short, a few hours with DDT revealed several key areas
  20. ; within WS.COM that should interest a true hacker. Seems as how the FCB for
  21. ; WSOVLY1.OVR is at 364Dh, WSMSGS.OVR is at 3784h, the only BDOS entry vector
  22. ; is at 1823h and finally, the area between 02E0h and 035Bh inclusive is a 
  23. ; safe patch area. Well, well well....... A real simple kludge of mushware will
  24. ; set a default drive and user area every time WS.COM looks for an *.OVR file
  25. ; and then set it back again after the DOS operation. The infernal thing can 
  26. ; find the *.OVR files from any drive and user area A dream come true and
  27. ; it is really painless......
  28. ;
  29. ;//////////////////////////////////////////////////////////////////////////////
  30. ;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  31. ;
  32. ;        Copyright (c) 1984 .... Oak Brook Design 
  33. ;   
  34. ;                   All rights reserved.
  35. ;
  36. ;    Permission  is  hereby  granted  to copy and distribute this
  37. ;    program  for  any  non-commercial  purpose. Any use of this
  38. ;    material  for  commercial  advantage  without  prior written
  39. ;    consent of John P Sojak acting on behalf of Oak Brook Design 
  40. ;    is prohibited. 
  41. ;
  42. ;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  43. ;//////////////////////////////////////////////////////////////////////////////
  44. ;
  45. ;    You MUST examine your Wordstar under SID or DCON to verify several
  46. ;    locations within the memory image.... > denotes a console input
  47. ;    (You can use ZSID or DDT also, of course... -- KL)
  48. ;
  49. ;>    A0>DCON
  50. ;
  51. ;    --- dcon banner and some other gook ---
  52. ;
  53. ;>    #F100 5000 00        ; clear the ram out
  54. ;>    #IWS.COM        ; set up for read
  55. ;>    #R    
  56. ;
  57. ;>    #P0000            ; set a break at warmboot 
  58. ;>    #G100
  59. ;
  60. ;     --- you will get the usual WS menu.... Just eXit with 'X'
  61. ;
  62. ;    01 PASS 0000
  63. ;     -Z-E- A=00 B=1800 D=0006 H=3441 S=3443 P=0000    
  64. ;     ----- A'=00 B'=00 D'0000 H'0000 X=0000 Y=0000 JMP XXXX
  65. ;    *XXXX
  66. ;
  67. ;>    #D3780 3790
  68. ;    3780: 00 00 00 00 03 57 53 47 53 20 20 4F 56 52 .....WSMSGS  OVR
  69. ;    3790: 00       \    
  70. ;                     there it is... 
  71. ;                
  72. ;                              here it is..
  73. ;>    #D3640 3660                /   
  74. ;    3640: 00 00 00 00 00 00 00 00 00 00 00 00 57 53 ..............WS
  75. ;    3650: 4F 56 4C 59 31 20 4F 56 52 00 00 00 00 00 OVLY1 OVR.......
  76. ;    3660: 00 .     
  77. ;
  78. ;
  79. ;>    #L1820
  80. ;    1820       INX      H
  81. ;    1821    PUSH     D    
  82. ;    1822    PUSH    H
  83. ;    1823    CALL    0005    --- here is the DOS entry @ 1823h  
  84. ;    1826    POP    H
  85. ;    1827    POP    D
  86. ;    1829    XTHL
  87. ;    182A    RET
  88. ;
  89. ;>    #-P        ; clear the pass point at warmboot
  90. ;>    #G0        ; and exit to CCP
  91. ;
  92. ;    A0>
  93. ;
  94. ;    Now you can assemble the file, I used Mac. M80 / L80 has a problem with
  95. ;    extranious 00 between the two ORGs. Dont use it. 
  96. ;
  97. ;    Use the same procedure to load WS.COM into memory again but this time,
  98. ;    dont set any pass point at 0000. Set up for the read with IWSUSER.HEX
  99. ;    and then do a R to overlay the hex file. Exit to the CCP and then
  100. ;    
  101. ;    A0>SAVE 64 WS-TEST.COM
  102. ;    (Note: For 3.3 versions, use 69 usually, could be more if your
  103. ;    version has been customized with code in the secondary user
  104. ;    patch space PGBMEM.)
  105. ;
  106. ;    Thats it..... WS  will, or should now, work with all user areas and 
  107. ;    drives.
  108. ;
  109. ;****************************************************************************
  110. ;
  111. ;    NOTE: WS v3.3 values I found in CP/M-80 version:
  112. ;
  113. ;        FILE/ADDRESS    FCB ADDR
  114. ;        ============    ========
  115. ;        WSMSGS.OVR    3769H
  116. ;        WSOVLY1.OVR    3630H
  117. ;        CALL BDOS    1835H
  118. ;        PATCH AREA    02CBH    (check for previous patches first)
  119. ;
  120. ;                -- Kim Levitt
  121. ;                   (MBBS HQ RCP/M (213) 653-6398)
  122. ;
  123. ;****************************************************************************
  124. ;
  125. ; (Always 0005, this is entry point for BDOS function calls)
  126. ;
  127. bdos        equ    0005    ;BDOS function caller
  128. ;
  129. ;==============================================================================
  130. ;
  131. ; The WSMSGS.OVR fcb address:
  132. ;
  133. msgfcb        equ    3784h    ;(use 3769h for v3.3)
  134. ;
  135. ;==============================================================================
  136. ;
  137. ; The WSOVLY1.OVR fcb address:
  138. ;
  139. ovrfcb        equ    364Dh    ;(use 3630h for v3.3)
  140. ;
  141. ;==============================================================================
  142. ;
  143. ; The original BDOS vector call address:
  144. ;
  145. bdosvec        equ    1823h    ;(use 1835 for v3.3)
  146. ;
  147. ;==============================================================================
  148. ;
  149. ; The user patch space where patch code gets loaded:
  150. ;
  151. morpat        equ    02E0h    ;(use 02CB for v3.3)
  152. ;
  153. ;    (This value is the MORPAT value obtained from WS.COM)
  154. ;
  155. moroff        equ    0    ;(normally zero if virgin WS.COM)
  156. ;
  157. ;    (This value may have to be adjusted if you have a custom patch
  158. ;    already in the MORPAT area. If you have the printer status
  159. ;    check routine as listed in WSPAT-33.DQC, for instance, and the
  160. ;    patch for that starts at MORPAT then this patch would have to
  161. ;    start at MORPAT+11h, so you'd have to set MOROFF equ 11h)
  162. ;
  163. moron        equ    not moroff    ;(dummy equate, used for user)
  164. ;
  165. ;==============================================================================
  166. ;
  167. ; Set these to your desired default drive and user for the *.OVR files
  168. ;
  169. ovruser        equ    15    ; User area...  0-31
  170. ovrdrv        equ    01    ; Drive Spec... A:-> 01, B:-> 02 etc
  171. ;
  172. ;******************************************************************************
  173. ;
  174. ;        the patch gets called here
  175. ;
  176. ;******************************************************************************
  177. ;
  178.         org    bdosvec    ; remove the existing DOS hook
  179. ;
  180. ;    intercept the call to DOS before actual entry ... 
  181. ;
  182.         call    morpat+moroff
  183. ;
  184. ;******************************************************************************
  185. ;
  186. ;        the patch gets loaded here
  187. ;
  188. ;******************************************************************************
  189. ;
  190.         org    morpat    ; patch area is here
  191. ;
  192. ;    check BDOS function and FCB address
  193. ;
  194.         push    b        ; save function code (c)
  195.         mov    a,c        ; check it
  196.         cpi    15        ; open file?
  197.         jz    chkit
  198.         cpi    16        ; close?
  199.         jz    chkit
  200.         cpi    17        ; search first?
  201.         jz    chkit
  202.         cpi    18        ; search next?
  203.         jz    chkit
  204.         cpi    20        ; read next?
  205.         jz    chkit
  206.         cpi    33        ; read random?
  207.         jz    chkit
  208. ;
  209. ;    pass the call on without further hassle, its not for us
  210. ;
  211. passit:        pop    b        ; restore stack
  212.         jmp    bdos        ; and return
  213. ;
  214. ;******************************************************************************
  215. ;
  216. ;    check <de> for the two OVR fcb addresses, set <cy> if not found
  217. ;
  218. ;
  219. chkit:        mvi    a,(LOW msgfcb)    ;  fcb for WSMSGS.OVR 
  220.         cmp    e
  221.         jnz    nogood
  222.         mvi    a,(HIGH msgfcb)
  223.         cmp    d
  224.         jz    good
  225. ;        
  226. nogood:        mvi    a,(LOW ovrfcb)    ;  fcb for WSOVLY1.OVR 
  227.         cmp    e
  228.         jnz    passit
  229.         mvi    a,(HIGH ovrfcb)
  230.         cmp    d
  231.         jnz    passit
  232. ;
  233. ;    found one of the FCB's... set the user and drive 
  234. ;
  235. good:        push    d        ; save FCB
  236. ;
  237.         xchg            ; put FCB in HL
  238.         mvi    a,ovrdrv    ; find the overlays on this drive
  239.         mov    m,a        ; (stuff in FCB)
  240. ;
  241.         mvi    c,32        ; get the current user number
  242.         mvi    e,0FFh
  243.         call    bdos
  244.         sta    user        ; save it
  245. ;
  246.         mvi    c,32        
  247.         mvi    e,ovruser    ; find the overlays in this user
  248.         call    bdos
  249. ;
  250.         pop    d        ; original fcb addr
  251.         pop    b        ; original function code
  252. ;
  253.         call    bdos        ; finally we get there...
  254. ;
  255.         push    b        ; save bc
  256.         push    psw        ; save the result flags for later
  257. ;
  258.         mvi    c,32        ; set the old user... maybe funnies
  259.         lda    user
  260.         mov    e,a
  261.         call    bdos
  262. ;
  263.         pop    psw        ; get error flags
  264.         pop    b        ; restore c
  265. ;
  266.         ret            ; back to Wordstar
  267. ;
  268. user:        db    (HIGH moron)    ; (non-zero to mark end)
  269. ;
  270.         end
  271. ;
  272.