home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / a / anycodkp.lbr / ANYCOD.DZC / ANYCOD.DOC
Encoding:
Text File  |  1993-10-26  |  19.3 KB  |  458 lines

  1.                                ANYCODE
  2.  
  3.                               Doug Hurst
  4.  
  5. IMPORTANT NOTE:  The documentation for ANYCODE is based on an article 
  6. submitted to the newly revived "Portable Companion" magazine for 
  7. Osborne Computer Owners.  The reference are Osborne oriented.  In 
  8. reality, the program is more WordStar than Osborne oriented, and is up 
  9. and running on Heath and Zorba machines and is adaptable to all 
  10. WordStars, Versions 2.26, 3.0X and 3.3X.  Be absolutely certain that 
  11. you carefully make ALL substitutions for your version of WordStar.  
  12. There are several throughout.  Questions, comments and bugs should be 
  13. reported to me at 6808 Estrella Ave., Twentynine Palms, CA 92277, 
  14. evening (619) 367-1090 (evenings).
  15.  
  16.      PLEASE!!  Give this article a look even if it seems somewhat 
  17. complicated.  It is a useful, valuable modification to WordStar and is 
  18. quite simple if you will take it step by step.  
  19.  
  20. VALUE.  Makes WordStar more powerful and text files more flexible and 
  21. portable.  ANYCODE does this without enlarging the size of the main 
  22. WordStar program WS.COM. This is a very important point.  By keeping 
  23. WS.COM confined to its "stock" size, it may installed or reinstalled 
  24. using INSTALL.COM at will without affecting or having to reinstall 
  25. ANYCODE.
  26.  
  27. INTRODUCTION.
  28.  
  29.      The EPSON FX, MX (w/Graftrax) and RX series, as well as many 
  30. other brands of printers, have many more modes of operation available 
  31. than can be accessed by a normally installed WordStar, even if one 
  32. uses all the built-in and user defined print control code facilities 
  33. available.  Not only can these built-in and user defined codes NOT 
  34. keep pace with the printer's capability, once installed, they are not 
  35. alterable without using DDT/SID.COM or WordStar's INSTALL.COM.  There 
  36. are several commercially available programs that will let you send all 
  37. the control codes a printer will accept.  They differ from the one 
  38. presented in this article in that this one is free.  This article is 
  39. also designed to serve the dual purpose of displaying how much 
  40. untapped potential there is in standard WordStar. 
  41.  
  42. USING ANYCODE.
  43.  
  44.      Before getting into the coding and installation of ANYCODE, it is 
  45. important to see what the outcome of your efforts will be.  This will, 
  46. it is hoped, pique your interest and keep you from giving up.  If you 
  47. regularly use a WordStar with CHARTECH or similar program installed, 
  48. you already possess the function that ANYCODE will perform.  You're 
  49. welcome to continue anyway.  As mentioned earlier, a nice feature of 
  50. ANYCODE is that it does not enlarge the size of WS.COM as many similar 
  51. commercially available products do.
  52.  
  53.      Once installed, use of ANYCODE codes has the same functional 
  54. effect as WordStar's print control codes.  Instead of embedding them 
  55. in the text with a print control code such as ^PS, however, you enter 
  56. ANYCODE very much as the codes actually appear in your printer's 
  57. user's manual.  ANYCODE codes, however, are not invisible to the 
  58. editor.  In other words, when you place ANYCODE's codes in your text, 
  59. they are treated just like normal text by WordStar.  This means they 
  60. will be included in such functions as wordwrap and paragraph 
  61. reformatting.  For this reason, it is suggested that you enter all 
  62. your text, get it formatted just the way you want, then go back and 
  63. insert the ANYCODE codes.  This may force you to use the ^OX (release 
  64. margin) command more than you are used to (some lines will extend far 
  65. beyond the margin).  This should be of no concern to you though 
  66. because ANYCODE codes are non-printing just like WordStar's print 
  67. control codes.  The actual line will fit within the margins if it did 
  68. prior to code insertion.
  69.  
  70.      ANYCODE codes will usually take one of the three forms shown 
  71. below, just as most printers accept codes in one of these three forms.
  72.  
  73. straight hex code
  74. escape + hex code
  75. escape + hex code + trailer code 1 + trailer code 2....+ trailer code n
  76.  
  77. Below are ANYCODE examples of each type for EPSON printers:
  78.  
  79. `0F     Would transmit 0Fh (turn condensed print mode on).
  80. ~45     Would transmit <ESC>,45h (turn emphasized print on).
  81. ~2D`01  Would transmit <ESC>,2Dh,01 (turn on continuous 
  82.         underline).
  83.  
  84. As a further example, a short section of text, first without 
  85. codes and then with ANYCODE codes embedded.
  86.  
  87.  
  88. Dear Bob,
  89.  
  90.      Just wanted to let you know I was thrilled with the modified 
  91. BIOS you sent me.  It worked SUPER.
  92.  
  93. Dear Bob,
  94.  
  95.      Just wanted to let you know I was ~34thrilled~35 with the modified 
  96. ~2D`01BIOS~2D`00 you sent me.  It worked `0ESUPER!`14.
  97.  
  98. In the lower example with the embedded (again EPSON) codes, ~34 and 
  99. ~35 turn italics on/off, ~2D`01 and ~2D`00 turns underline on/off and 
  100. `0E and `14 turn expanded print on/off.
  101.  
  102.      Notice how the first line now extends past the normal margin.  
  103. Again, it WILL NOT when the printing actually takes place since 
  104. ANYCODE code is non-printing.  The two lead characters for ANYCODE 
  105. code were picked especially for the Osborne computer.  You will not 
  106. find them on your keyboard.  To make a "~", type ^+  (control +).  To 
  107. place a "`" on the screen, type a ^? (control ?).  
  108.  
  109.      If you haven't seen the obvious advantage to sending the printer 
  110. codes in the ANYCODE format over WordStar's codes yet, here are two.  
  111. First, you can send any code to the printer.  (Okay, the cats out of 
  112. the bag, now you know where the name of the program came from.) 
  113. Second, say you take WordStar and a document disk with you somewhere 
  114. (like from home to work) and want/need to print a file using another 
  115. computer (obviously another Osborne or Osborne disk format 
  116. compatible).  You prepared the document on your Osborne which is 
  117. installed with Print Controls to send EPSON codes.  The computer at 
  118. work, however, is driving a NEC printer.  With ANYCODE codes embedded 
  119. in the text, wouldn't it be easy to use the Find and Replace (^QA) 
  120. command to find the EPSON codes and substitute NEC codes?  Answer yes 
  121. so we can continue.
  122.  
  123.  
  124.      There are a few cautions, and you may as well know them now.  
  125.  
  126.           1.  Use all capital letters  (`0A, NOT `0a)(and that's zero 
  127. not o).
  128.           2.  Each hex code must be two digits. (5 entered as 05, 
  129. E entered as 0E, etc.)
  130.           3.  Due to space limitations and a desire on the part of the 
  131. author to keep ANYCODE confined to the MORPAT: area (explained later), 
  132. no provisions were made to be able to print the lead-in characters ` 
  133. and ~.  If you use either of these characters frequently in your word 
  134. processing operations, you should consider picking other characters 
  135. that you do not use often.  The comments to ANYCODE.ASM below indicate 
  136. where to make substitutions to the default lead-in characters.
  137.           4.  The MORPAT: area must be free.  Later in the article 
  138. DDT.COM is used to make some modifications to WordStar and check to 
  139. see that the MORPAT: area is clear.  If it is not, ABORT!  
  140.           5.  ANYCODE as installed below is for WordStar's installed 
  141. to use the CP/M Primary List Device.  You can check this when you 
  142. first boot WordStar and observe the sign-on message (Also when running 
  143. INSTALL.COM on WordStar, check the label CSWTCH:.  It must be 00 for 
  144. ANYCODE to be guaranteed to work).  
  145.  
  146.      Here are a wrong, then a right example of ANYCODE syntax.
  147.  
  148. WRONG
  149.  
  150. `FNow is the time for ....... the aid of their countries.`12
  151.  
  152. Meaning to turn compressed print on/off.  No zero 0 between the ` and 
  153. F at beginning of the sentence.  PROMISE! This will not work.
  154.  
  155. RIGHT
  156.  
  157. `0FNow is the time for ....... the aid of their countries.`12
  158.   
  159. PROMISE! This will work.
  160.  
  161.      Follow the simple rules laid out above, and you will have no 
  162. problem.  Now for the work.
  163.  
  164.  
  165. WHAT DO WE MODIFY AND WHERE DO THE MODIFICATIONS GO?
  166.  
  167.      MicroPro and/or Osborne, in their infinite wisdom, decided to 
  168. include INSTALL.COM with WordStar, but not to include the complete 
  169. terminal and printer patch areas. (Early Osborne 1 user's did receive 
  170. this treat before Osborne converted to the "improved" reference 
  171. manuals). Luckily, the author was able to find a complete manual for 
  172. WordStar 3.0.  At any rate, there is an area within WordStar, labeled 
  173. MORPAT: that contains 126 empty bytes and exists for the sole purpose 
  174. of user defined sub-routines.  ANYCODE will be installed in this 
  175. MORPAT: area. (By enlarging the size of WS.COM, even more area can be 
  176. made available for user supplied code. Stand-by to use some of it in a 
  177. later article.)  
  178.  
  179.      Where is the MORPAT: area?  For three WordStar versions 
  180. known to have ANYCODE successfully installed, it resides at the 
  181. addresses shown below:
  182.  
  183.                         WordStar Version
  184.  
  185.                 2.26           3.0            3.3
  186.  
  187.                 02DEh          02DEh          02BBh
  188.  
  189.  
  190. THE CODE AND ASSEMBLY.
  191.  
  192.      The comments to the code may seem a little cryptic so this 
  193. narrative explanation is supplied in advance.  We will modify one of 
  194. WordStar's printer drivers to divert all characters to be sent to the 
  195. CP/M Primary List Device to our ANYCODE subroutine.  Each character is 
  196. first checked to see if it is an ANYCODE lead-in character.  If it is, 
  197. it is stored, a flag is set and the next character is read. If this 
  198. character wasn't a lead-in character, it is checked to see if it is 
  199. the first or second character following a lead-in character.  If it 
  200. wasn't, it is sent out to the primary list device normally.  If the 
  201. lead character is being stored and the flag is set, it means the 
  202. current character is the first character following the lead character.  
  203. The flag is lowered, and the character processed to become half of the 
  204. total follow-on code.  Then the last character is read.  It too is 
  205. checked to see if it is a lead-in character or is the first or second 
  206. follow-on character.  If it is the second follow-on character, it is 
  207. added to the first follow-on character, and the result sent to the 
  208. list device (printer).  If you didn't understand most of that don't 
  209. worry about it.  Understanding is not a requirement for ANYCODE to 
  210. work.  Here is the code.  Be sure to use the "N" non-document mode if 
  211. you use WordStar.
  212.  
  213. ; ANYCODE.ASM - A program to allow printer codes to be 
  214. ;            transmitted to EPSON or other dot matrix 
  215. ;            printer from within WordStar text.
  216. ;
  217. ;            Author:  D. M. Hurst
  218. ;            Date:    April 23, 1984
  219. ;
  220.     ORG    XXXXh    ;Where XXXX is 02DEh for WS 2.26/3.0
  221.                         ;and 02BBh for WS 3.3
  222. mysub:    cpi    '`'    ;is it a code character?
  223.                         ;you may substitute another 
  224.                         ;character if you use the
  225.                         ;" ` " often in your text  
  226.     jnz    ncheck    ;no, so next check
  227.     sta    lead    ;yes, so store temporarily
  228.     mvi    a,1    ;get a 1 in accumulator
  229.     sta    fl    ;set fl flag
  230.     ret        ;get another character
  231.             ;without printing
  232. ncheck: cpi    '~'    ;is it a code character?   
  233.                         ;you may substitute another
  234.                         ;character if you use the  
  235.                         ;" ~ " often in your text  
  236.     jnz    hcheck    ;no, so check if part of
  237.             ;code sequence
  238.     sta    lead    ;yes so store temporarily 
  239.     mvi    a,1    ;get a 1 in accumulator
  240.     sta    fl    ;set fl flag
  241.     mvi    a,1bh    ;~ means escape required so 
  242.     jmp    pout    ;send it.
  243. hcheck: mov    b,a    ;set input char aside
  244.     lda    lead    ;get contents of lead
  245.     cpi    '`'    ;are we in a code seq?
  246.                         ;NOTE: if you changed this code
  247.                         ;above, change it here too. 
  248.     mov    a,b    ;char back in accumulator      
  249.     jz    flchk    ;yes, so check if flag set
  250.     mov    b,a    ;no, so char back to b
  251.     lda    lead    ;check lead again
  252.     cpi    '~'    ;are we in a code seq?
  253.                         ;NOTE: if you changed this code
  254.                         ;above, change it here too.    
  255.                         ;char back in accumulator      
  256.     mov    a,b    ;char back in accumulator
  257.     jz    flchk    ;yes, so check if flag set    
  258.     jmp    pout    ;no, so print char normally
  259. flchk:    mov    b,a    ;set char aside again
  260.     lda    fl    ;get fl flag
  261.     cpi    00h    ;1 if set set
  262.     mov    a,b    ;char back in accumulator
  263.     jz    addsnd    ;not set, so last char in seq
  264.     mov    b,a    ;yes, so set char aside again        
  265.     mvi    a,00h    ;no, so place 00h in accumulator
  266.     sta    fl    ;and lower the flag
  267.     mov    a,b    ;char back in accumulator    
  268.         cpi    39h    ;is code char a letter?
  269.         jm    nolet1  ;no, so never mind 
  270.         sui    07h    ;yes, so make it a number
  271. nolet1:    sui    30h    ;now down it form ASCII
  272.     rlc        ;first char in code so 
  273.     rlc        ;move 4 low bits to high
  274.     rlc
  275.     rlc
  276.     ani    0f0h    ;0 4 lower bits
  277.     sta    first    ;store it
  278.     ret        ;go get second char code
  279. addsnd:    mov    b,a    ;set 2nd code char aside
  280.     mvi    a,00    ;0 the accumulator
  281.     lxi    h,lead    ;get lead addr pointer in hl
  282.     mov    m,a    ;0 out the lead
  283.     inx    h    ;up the hl
  284.     mov    m,a    ;also 0 the flag
  285.     mov    a,b    ;get char back
  286.     cpi    39h    ;was 2nd code char a letter?
  287.     jm    nolet2    ;so so skip it
  288.     sui    07h    ;yes so make it a number
  289. nolet2:    sui    30h    ;now down either from ASCII
  290.     lxi    h,first    ;point to first code char addr
  291.     mov    b,m    ;move actual char to b
  292.     add    b    ;add a to b (result in a)
  293. pout:    mvi    c,5    ;print full code char
  294.     mov    e,a
  295.     call    5
  296.     ret        ;back for next real char
  297. ;
  298. lead    ds    1    ;space for lead code
  299. fl    ds    1    ;flag space
  300. first    ds    1    ;store first code while
  301.             ;waiting for 2nd to pro-
  302.             ;cess.
  303.     end
  304.  
  305. Having entered ANYCODE.ASM above, it must be assembled.  Place your 
  306. CP/M system disk in drive A and the disk containing ANYCODE.ASM in 
  307. drive B.  Enter the following command line from the A> prompt:
  308.  
  309. A>ASM ANYCODE.BBB
  310.  
  311. If there are no errors, another step complete.  The author has 
  312. successfully assembled this code exactly as it appears in this 
  313. article.  In fact, the code was read into the article from ANYCODE.ASM 
  314. using WordStar's ^KR command.  If there are errors in assembly, go 
  315. back and check your typing.  If it did assemble without error, you 
  316. should be left with ANYCODE.ASM, ANYCODE.HEX and ANYCODE.PRN on drive 
  317. B.  Do not use LOAD.COM and attempt to load ANYCODE.HEX into a .COM 
  318. file.  This is not necessary and would serve no useful purpose.
  319.  
  320. INSTALLATION:
  321.  
  322.      Very, very simple.  Although having all these files present isn't 
  323. necessary, place WS.COM, WSMSGS.OVR, WSOVLY1.OVR, MAILMRGE.OVR 
  324. (MRGEPRIN.OVR), DDT.COM and ANYCODE.HEX on a SYSGEN'd disk in drive A. 
  325. (Single density user's leave the three .OVR programs off for now and 
  326. add them after the installation of ANYCODE and the deletion of DDT.COM 
  327. and ANYCODE.HEX) (Remember ANYCODE.HEX was generated during the 
  328. assembly of ANYCODE.ASM).  When you have performed this task, enter 
  329. the following:
  330.  
  331. Version 2.26             Version 3.0              Version 3.30
  332.  
  333. A>DDT WS.COM<RETURN>     A>DDT WS.COM<RETURN>     A>DDT WS.COM<RETURN>
  334.  
  335. You should see:
  336.  
  337. A>DDT WS.COM             A>DDT WS.COM             A>DDT WS.COM         
  338. DDT Vers 2.2             DDT Vers 2.2             DDT Vers 2.2     
  339. NEXT  PC                 NEXT  PC                 NEXT  PC
  340. 4000 0100                3F00 0100                4600 0100
  341. -                        -                        -
  342.  
  343. The MORPAT: area must be clear. So, from the "-" prompt type the 
  344. following:
  345.  
  346. Version 2.26             Version 3.0              Version 3.30
  347.  
  348. -d2de<RETURN>            -d2de<RETURN>            -d2bb<RETURN>   
  349.  
  350. You should see something like the following provided your WS.COM has 
  351. not been previously modified by another add-on program.  If there is 
  352. anything besides zeros in this area, ABORT!.  Your WordStar has 
  353. already been modified by someone.  Continuing will overwrite the code 
  354. in this area. 
  355.  
  356. 02BB 00 00 00 00 00 ..... (WS.COM 2.26 and 3.0 will start at 02DE)
  357. 02C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  358. 02D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  359. 02E0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  360. 02F0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  361. 0300 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  362. 0310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  363. 0320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  364. 0330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  365. 0340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  366. 0350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  367. 0360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  368. -
  369.  
  370. Now, from the "-" prompt type the following:
  371.  
  372. -IANYCODE.HEX<RETURN>
  373. -R<RETURN>
  374.  
  375. Now type:
  376.  
  377. -d2bb<RETURN>    (WS.COM 2.26 and 3.0 type -d2de<RETURN>) 
  378.  
  379. You should see something like this: (WS.COM 2.26 and 3.0 will start at 
  380. -d2de)
  381.  
  382. 02BB FE 60 C2 23 01 .`.#. 
  383. 02C0 32 92 01 3E 01 32 93 01 C9 FE 7E C2 35 01 32 92 2..>.2....~.5.2.
  384. 02D0 01 3E 01 32 93 01 3E 1B C3 8B 01 47 3A 92 01 FE .>.2..>....G:...
  385. 02E0 60 78 CA 4C 01 47 3A 92 01 FE 7E 78 CA 4C 01 C3 `x.L.G:...~x.L..
  386. 02F0 8B 01 47 3A 93 01 fE 00 78 CA 70 01 47 3E 00 32 ..G:....x.p.G>.2
  387. 0300 93 01 78 FE 39 FA 64 01 D6 07 D6 30 07 07 07 07 ..X.9.D....0....
  388. 0310 E6 F0 32 94 01 C9 47 3E 00 21 92 01 77 23 77 78 ..2...G>.!..w#wx
  389. 0320 FE 39 FA 81 01 D6 07 D6 30 21 94 01 46 80 C3 8B .9......0!..F...
  390. 0330 01 0e 05 5F CD 05 00 C9 00 00 00 00 00 00 00 00 ................
  391. 0340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  392. 0350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  393. 0360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
  394. -
  395.  
  396. The code for ANYCODE now resides in the MORPAT: area previously 
  397. occupied by all those 00's.
  398.  
  399. The last modification inside WS.COM is to alter the printer driver to 
  400. jump to our sub-routine rather than simply send each character 
  401. directly to the primary list device.  We do this by overwriting the 
  402. assembly language starting at the address corresponding to your 
  403. version of WS.COM.
  404.  
  405. Version 2.26             Version 3.0              Version 3.30
  406.  
  407. -a71d                    -a71d                    -a71c              
  408. 071D  call     2de       071D  call     2de       071C  call     2bb 
  409. 0720  jmp      723       0720  jmp      723       071f  jmp      722 
  410. 0723  <RETURN>           0723  <RETURN>           0722  <RETURN>     
  411. -                        -                        -                  
  412.  
  413.  
  414. To close out, type:
  415.  
  416. -G0<RETURN>  or  -^C
  417.  
  418. Then type 
  419.  
  420. A>save XX WS.COM         (Where XX is 63 for version 2.26, 62 for 
  421.                           version 3.0 and 69 for version 3.30)
  422.  
  423. That's it!  You may now erase ANYCODE.HEX and DDT.COM from the disk 
  424. containing the WS.COM you just modified.   (Single density user's 
  425. should PIP WSMSGS.OVR, WSOVLY1.OVR and MAILMRGE.OVR (MRGEPRIN.OVR) 
  426. back onto the disk containing the modified WS.COM.
  427.  
  428. Below is a test file for EPSON printers.  If you have a different 
  429. printer type, consult your user's manual and substitute similar 
  430. workable codes.
  431.  
  432. *******************************************************************
  433.  
  434. `0FCompressed print`12        (All)
  435.  
  436. `0EExpanded print`14            "
  437.  
  438. ~45Emphasized~46                "
  439.  
  440. ~34Italic print mode~35       (MX w/Graftrax ,FX, RX only)
  441.  
  442. ~2D`01Continuous underline~2D`00          "
  443.  
  444. ~53`01Sub~48~54`01script                  "   
  445.  
  446. ~53`00Super~48~54`01script                "
  447.  
  448. *******************************************************************
  449.  
  450. Doug Hurst
  451. Hi-Desert Osborne Group (HOGS)
  452. 6808 Estrella Ave.
  453. 29 Palms, CA 92277  
  454. (619) 367-1090 (evenings)
  455. **********
  456.  
  457. Doug Hurst
  458. Hi-Deser