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 / ODEV10.PAT < prev    next >
Text File  |  2000-06-30  |  9KB  |  215 lines

  1. Odd/Even: Two sided printing with WordStar and NewWord
  2.      by Randy Brook, 13742 41st Av. NE, Seattle, WA 98125
  3. Version 1.1     11/3/85
  4.  
  5. This file explains how to modify WordStar versions 3.0 and 3.3 
  6. (CP/M) and NewWord version 2.x (CP/M) to print double sided 
  7. documents on continuous form paper.  Great for long documents.  
  8. Credit for the basic coding idea goes to Chuck Somerville.
  9.  
  10. These patches assume you are using the CP/M list device for sending 
  11. output to your printer.  This is the norm for standard printer 
  12. installations available through WordStar's and NewWord's 
  13. installation menus.  If you are using a custom printer driver, you 
  14. will need to adapt these patches to fit your driver.
  15.  
  16. The principle of the patches is very simple.  Characters directed to 
  17. the printer are intercepted by the new code.  A "flag" byte 
  18. determines whether the character will then be sent on to the 
  19. printer.  When the flag is 00h, no characters are printed.  When 
  20. it's 01h, they are printed.  When a form feed is intercepted, the 
  21. flag byte is toggled (i.e. from 00h to 01h or vice versa).  Thus, 
  22. two version of the main program (*.COM) are necessary.  In one the 
  23. flag starts at 00h; in the other it starts at 01h.  When printing, 
  24. the "Use form feeds?" question must always be answered yes.
  25.  
  26. Assuming your disk has the room, you can put both modified program 
  27. versions on the same disk.  You will only need one set of the 
  28. overlays.  The modified programs will function  normally in all 
  29. respects (except printing), and you can use either for creating or 
  30. editing documents.  [One minor variation:  If you use the "R"un 
  31. command, the "Press any key to return to WordStar/NewWord" feature 
  32. will misfunction.  It looks for the .COM file as it was named when 
  33. you installed the program (eg. WS.COM, NW.COM).]
  34.  
  35. To use the modified programs, run the odd .COM file, print pages 
  36. 1,3,5, etc., turn over the continuous form paper, and run the even 
  37. document.  Restart the program for each document, to ensure that you 
  38. reinitialize the flag byte properly.  REMEMBER:  You must "Use form 
  39. feeds - Yes" when printing.
  40.  
  41. I recommend a trial run for practice.  I found with NewWord, for 
  42. example, that I get an extra blank page (form feed sent to printer) 
  43. when I start printing the even pages, so I have to adjust by 
  44. starting my odd print after rolling an extra blank page through my 
  45. printer.  With WordStar, I get an extra page with both odd and even.
  46.  
  47. Note that this patch runs faster with NewWord than with WordStar.  
  48. This is because WordStar's printer driver is just plain slow.  For 
  49. example, it cannot keep up with my printer (200 cps), while NewWord 
  50. even works with the HP laser jet.  Similarly, WordStar is much 
  51. slower than NewWord in skipping over the non-printing pages.
  52.  
  53.                              DIRECTIONS
  54.  
  55. 1.  Use a disk with NewWord or WordStar on it.  You will need the 
  56. overlay files to test your results, but you will not need the 
  57. WordStar or NewWord Install program.  You will also need DDT.COM.
  58.  
  59. 2.  Load the .COM with DDT. 
  60.  
  61.          NW                 WS 3.0                   WS 3.3
  62.         ----                ------                   ------
  63.      A>DDT NW.COM        A>DDT WS.COM             A>DDT WS.COM
  64.      DDT VERS 2.2        DDT VERS 2.2             DDT VERS 2.2
  65.      NEXT PC             NEXT PC                  NEXT PC
  66.      3500 0100           3F00 0100                4600 0100
  67.  
  68. I'll save you a little arithmetic:  NewWord is 52 "pages," WordStar 
  69. 3.0 is 62, and WordStar 3.3 is 69.  
  70.  
  71. ********************  NEWWORD VERSION 2.X  ***********************
  72.  
  73.      (User listings for "Version 2", tested with version 2.16)
  74.  
  75. 3.  Verify that the area chosen for the patch is unused and that the 
  76. print/noprint flag will start at 00h:
  77.  
  78.      -S0431
  79.      0431 00   .    (you type the period to end this function)
  80.  
  81. If you see anything other than the "00", you will probably have to 
  82. relocate the patch (see Technical note to paragraph 5 below).
  83.  
  84. 4.  Assemble a jump instruction in the place NewWord checks for 
  85. special printer routines.  NOTE: The parentheticals aren't typed.  
  86.  
  87.      -A056D         (assemble the jump patch in subroutine)
  88.                     (   ULOSTO in the User Area Listing)
  89.      056D JMP  0432 (go to the special printer routines)
  90.      0570           (hit RETURN to end this assembly)          
  91.  
  92. 5.  The special printer routine:
  93.  
  94.      -A0432         (start point of new code, at start of)
  95.                     (  MORPAT in the User Area Listing)
  96.      0432 MOV  E,A  (char in E register for BDOS call)
  97.      0433 CPI  0C   (is char a form feed?)
  98.      0435 LDA  0431 (load the print/noprint flag)  
  99.      0438 JNZ  0440 (char not a form feed, skip next step)
  100.      043B XRI  01   (is form feed, toggle print/noprint flag)
  101.      043D STA  0431 (put flag back)
  102.      0440 ORA  A    (check if "print" or "noprint")
  103.      0441 RZ        ("0" flag is noprint, return from subroutine)
  104.      0442 MVI  C,05 (flag was print, BDOS print function #5)
  105.      0444 CALL 0005 (call for print driver)
  106.      0447 RET       (return from subroutine)
  107.      0448           (hit RETURN to end this assembly)
  108.        
  109. Technical note:  I have placed this routine at the beginning of the 
  110. MORPAT area, since it is generally unused.  There are 64 bytes 
  111. available in MORPAT.  The new code uses only 23 bytes, and can 
  112. easily be relocated elsewhere in MORPAT (or in CRTPAT, which also 
  113. allows 64 bytes) if necessary to find other unused space.
  114.  
  115. 6.  Leave DDT and save the modified NewWord:
  116.  
  117.      -G0            (exits to CP/M)
  118.      A>SAVE 52 NWEVEN.COM   
  119.  
  120. You now have a new NewWord .COM file, just for printing even 
  121. numbered pages.  
  122.  
  123. 7.  Create a NewWord file for printing odd numbered pages.  First 
  124. repeat step 2, this time loading the modified file:
  125.  
  126.      A>DDT NWEVEN.COM
  127.  
  128. Now repeat step 3, but this time set the print/no print flag to 
  129. start at 01h:
  130.  
  131.      -S0431
  132.      0431 00   01   (change this flag to 1)
  133.      0432 *    .    (ignore whatever appears at the *)
  134.                     (   the period ends this function)
  135.      
  136. Finally, repeat step 6, saving the new file:
  137.  
  138.      -G0            (exits to CP/M)
  139.      A>SAVE 52 NWODD.COM   
  140.  
  141. ****************************  WORDSTAR  **************************
  142.  
  143. 3.  Verify that the area chosen for the patch is unused and that the 
  144. print/noprint flag will start at 00h:
  145.  
  146.      -S0320
  147.      0320 00   .    (you type the period to end this function)
  148.  
  149. If you see anything other than the "00", you will probably have to 
  150. relocate the patch (see Technical note to paragraph 5 below).
  151.  
  152. 4.  Now assemble a jump instruction in the place WordStar sends a 
  153. character to the printer.  NOTE: The parentheticals aren't typed.  
  154.  
  155.   WS 3.0           WS3.3                  Explanation
  156. -------------    ------------- -------------------------------
  157. -A071D           -A071C        (assemble the jump patch at)
  158.                                (   LISEND in User Area Listing)
  159. 071D JMP 0321    071C JMP 0321 (go to special printer routine)
  160. 0720             071F          (hit RETURN to end this assembly)          
  161.  
  162.  
  163.  
  164.  
  165. 5.  The special printer routine ["*" means same as for WS 3.0]:
  166.  
  167.   WS 3.0           WS 3.3        Explanation
  168. -------------    ------------- ------------------------------------
  169. -A0321           *             (start point of new code, near top)
  170.                                ( of MORPAT in User Area Listing)
  171. 0321 MOV E,A     *             (char in E register for BDOS call)
  172. 0322 CPI 0C      *             (is char a form feed?)
  173. 0324 LDA 0320    *             (load the print/noprint flag)  
  174. 0327 JNZ 032F    *             (char not form feed, skip next step)
  175. 032A XRI 01      *             (is form feed, toggle print/noprint)
  176. 032C STA 0320    *             (put flag back)
  177. 032F ORA A       *             (check if "print" or "noprint")
  178. 0330 JZ  0723    0330 JZ  0722 (flag is noprint, ret. for next char)
  179. 0333 MVI C,05    *             (flag was print, BDOS function #5)
  180. 0335 JMP 0720    0335 JMP 071F (back to print driver)
  181. 0338             *             (hit RETURN to end this assembly)
  182.  
  183. Technical note:  I have placed this routine near the end of the 
  184. MORPAT area, past the point likely to be taken up by custom screen 
  185. drivers (eg. memory mapping routines).  There are 128 bytes 
  186. available in MORPAT, starting at 02E0h (WS 3.0) or 02CBh (WS 3.3).  
  187. The new code uses only 24 bytes, and can easily be relocated 
  188. elsewhere in MORPAT if necessary to find unused space.
  189.  
  190. 6.  Leave DDT and save the modified WordStar:
  191.  
  192.      -G0            (exits to CP/M)
  193.      A>SAVE ** WS-ODD.COM  
  194. ** Use 62 for WS 3.0 or 69 for WS 3.3.
  195.  
  196. You now have a new WordStar, just for printing odd numbered pages.  
  197.  
  198. 7.  Create a WordStar file for printing odd numbered pages.  First 
  199. repeat step 2, this time loading the modified file:
  200.  
  201.      A>DDT WS-ODD.COM
  202.  
  203. Now repeat step 3.  This time start the print/noprint flag at 01h:
  204.  
  205.      -S0320
  206.      0320 00   01  (change this flag to 1)
  207.      0321 *    .   (ignore whatever appears at the *)
  208.                    (   the period ends this function)
  209.      
  210. Finally, repeat step 6, saving the new file:
  211.  
  212.      -G0            (exits to CP/M)
  213.      A>SAVE ** WS-EVEN.COM
  214. ** = 62 for WS 3.0, 69 for WS 3.3.
  215.