Patches for an 8-bit WordStar 4 (CP/M) ====================================== CP/M is a 7 bit system, but the Z80 is an 8 bit processor. I suppose the same is true for the 8080, but I have no experience with it. WordStar, in Document Mode, uses the 8th bit of a character to mark the end of a series: word, line, spaces, etc. To set an 8th bit, it uses the instruction 'or 80h' (0F6h 80h). To remove the 8th bit for screen and printer, it uses 'and 7Fh' (0E6h 7Fh). As CP/M does not interfere with WordStar, it is possible to send 8-bit characters to your screen and your printer simply by changing these instructions for the end of words, as this is marked already by a space. This change does not affect the document. But for good screen performance, the end of a line, page, series of spaces and tabs must be marked by setting the 8th bit of 09/0D/0A/0C/20h. This bit must be removed for screen and printer output. Since extra spaces are treated separately by sending a '+' to the screen (if that option is on), all characters from 8Eh (141d) onwards can be used. If you have a Z80 (8080?) processor _and_ an 8-bit terminal _and_ are able to change your configuration for screen and keyboard to write and read 8-bit characters, you can make the following changes...but _only_ at the addresses given in WS4-8B.PTC: F6 80 (or 80h) to 00 00 (nop nop), and E6 7F (and 7Fh) to E6 FF (and 0FFh). Since 'and' affects the flags, it must not be changed to 'nop.' I have tested this on my CP/M-computer, a Philips P2000C and on a QUME Sprint 5, a QUME Laser printer, a HP DeskJet 500 and a CANON LPB A2 Laser printer. A simple BASIC program for testing your screen and printer is given below. I do not use spell checking, word count, etc., so I cannot say if other WS programs are influenced, or how they should be patched. As I had to use 'trial and error', I might have made too many alterations, or not enough. Debugging in 64k of memory was not possible. If you discover any problems, let me know and I'll examine them. One item I was not able to find: Ctrl QA can exchange 7-bit characters and 8-bit characters. It can also exchange a 7-bit for an 8-bit. But if you try to exchange an 8-bit for a 7-bit, the eighth bit is set. That means: trying to change "e`" with Ctrl QA into "e" results not in 65h, but in 0E5h. An extra Sign On message may be placed at INITID (WS.COM address 06BBh). If you want more information, just let me know. For email, change 'nospam' into 'ks'! G. Doekes, P2000gg, Netherlands email: d.nospam@net.HCC.nl 10 REM A simple BASIC program for testing screen and printer. 11 REM For printer, replace PRINT by LPRINT and put the printer initia- 12 REM lization codes at line 20. 20 ' 30 X=32 40 GOSUB 200 50 X=64 60 GOSUB 200 70 X=96 80 GOSUB 200 90 X=128 100 GOSUB 200 110 X=160 120 GOSUB 200 130 X=192 140 GOSUB 200 150 X=224 160 GOSUB 200 170 'Put here printer de-initialisation codes if necessary 180 END 200 FOR I=X to X+31 210 PRINT CHR$(I);" "; 220 NEXT 230 PRINT CHR$(10)CHR$(13)CHR$(10)CHR$(13) 240 RETURN Remarks: 1. Some printers use 128d-159d for control purposes. If your printer behaves badly after printing the third line, remove 90-100. 2. If your printer prints two sets of identical characters, check if your init-code is correct. For instance, the CANON LBP8 has two; code 1 for 7 bits, and code 2 for 8 bits. ============== PATCHES FOR USING WORDSTAR 4 IN 8-BIT VERSION Note: Addresses are in HEX, with an offset of 100h. If you do not use a debugger, you should subtract 100h from each address to get the absolute addresses; i.e., 0B33 is 0A33 absolute. Patches for WS.COM ================== E6 7F -> E6 FF at: 0B33, 0C80, 14D2, 1687. (Note: No others!!) (If you want to alter the Sign On, use INITID on 06BBff). Patches for WS.OVR ================== E6 7F -> E6 FF at: 0F13, 10BC, 11A1, 1CDA, 3478, 41A4, 41C5, 41E5, 6F7A, AB2C. F6 80 -> 00 00 at: 3789, 46AA, 4C1A, 4CEA, 4E2C, 7ADE, 85ED, BAB3. At A787 you should change 'A0' to '8E', and at A788 change 'CA' to 'D2.' This ensures that 8-bit characters are printed on the screen. Patches for WSPRINT.OVR ======================= Note: The complete WSPRINT.OVR (148k) is meant! E6 7F -> E6 FF at: 089C, 090D, 093A, 0965, 09B8, 09ED, 0A22, 0AF8, 0BD4, 0C33, 0D9D, 0DBE, 0FEB, 1058, 1454, 148B, 14A1, 14CF, 1676, 1BAD, 1BE1, 1C48, 1C4B, 2783, 2685, 28EA, 2A72, 2C18, 2C77, 3254, 3789, 37BD, 3832, 387A, 3886, 4258, 4289, 46E3, 4735, 4755, 4C66, 4CA5, 5040, 5203, 5254, 526B, 55E1, 610B, 64C9, 8BD1, 95A7, 9759, 9786, 97C3, 9814, 982B, 9B1B, 9C87. Configuring your printer ======================== Finally, you have to alter the printer character codes with WSCHANGE. (I'll assume that you now have a print-out of your printer, and have compared this with your screen output.) Normally, the printer expects 80h for 'C,' My computer sends 0CEh instead, so on code 0CEh I have to send 80h to the printer. The easiest way to do this is: load WSCHANGE.COM; (maybe it's called WINSTALL.COM) select Printer; Printer Driver Library; Change Printer Driver Data; Strings & Tables; Compos; you get: 17CD* 3F 00 3F 00 3F 00....... ?.?.?.etc This is the line with codes 00h-07h. You should not change these, so type RETURN or ENTER till you reach 18CD*. Then you have reached the codes 80h-87h and the cursor stands under 80h. Type '00' to the end: (char=80 81 82 83 84 85 86 87) 18CD 43 2C 75 22 65 27 61 5E 61 22 61 60 61 00 63 2C C,u"e'a^a"a`a.c, (you) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 (=88 89 8A 8B 8C 8D 8E 8F) 18DD you 00 00 09 00 0A 00 00 00 0C 00 0D 00 ...and from 8Eh on, you put your screen output codes. There are three possibilities: 1. screen and printer codes are the same; 2. codes are different; 3. printer code not available, but can be made from two char. Examples: Video Printer Compos character ===== ======= ====== ========= ad 1: 9D 9D (=9Dh:) 9D 00 (Yen) ad 2: CE 80 (=CEh:) 80 00 C, ad 3: F2 -- (=F2h:) 61 7E a~ (=a~) If important characters figure on your screen between 80h-8Dh, you must configure your computer in such a way that they replace less important characters. For example: if you want 'u"' (81h,129d), but not A9h (169d), then you must alter your video in such a way that it outputs 'u"' on A9h. (My computer has an extensive confi- guration program, both for keyboard and screen.) Assuming that the printer outputs 'u"' on 81h, you get in Compos: (=A9h:) 81 00. So, from 8E onwards you change to the required character; e.g., at 8Eh you write D5 if that character is sent by the computer: (=8E 8F) you D5 00 D7 00 (=90 91 92 93 94 95 96 97) 18ED you 00 00 C9 00 CB 00 BB 00 CC 00 CE 00 B9 00 C8 00 ..and so on. As an example, I gave you some of mine, used for the DeskJet. '90' cannot be used on my computer, as it gives PrintScreen. *17CD is an example of an address given by WSCHANGE. It may be different, such as 1821. Anyway, you should add 100 to see if you have reached the right address. Then you should add 10 for every 8 characters. Of course, it's easier to just press RETURN till (begin+100) appears at the top of your screen, and then do a PrintScreen. That way, you'll have a hard copy print-out to compare with the results of the BASIC program as it displays to your screen. Remark: Some printers, like the CANON LBP8, use different codes for 7-bit and 8-bit. So for 7-bit printing, WS has codes with 'CSI' (9Bh). They must be changed to ESC '[' (1Bh 5Bh). This implies changing the number of characters in the string and, as there is not room enough, changing the addresses of the strings. If you are interested in this particular printer, let me know and I'll send you the patches. If you want it done for other printers, I'm prepared to try...but without a printer on which to test the patches, no guarantees can be given!! For email: change 'nospam' into 'ks'. G. Doekes, P2000gg, Netherlands e-mail: d.nospam@net.HCC.nl