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
/
ANYCODE3.LBR
/
ANYCODE3.DZC
/
ANYCODE3.DOC
Wrap
Text File
|
2000-06-30
|
18KB
|
407 lines
ANYCODE3
- or -
How to Lie to WordStar and Get Away With It
by Richard F. Binder
31 Fairmount Street
Nashua, NH 03060
1. INTRODUCTION
This document describes a patch for the CP/M-80 version of Word-
Star, to allow entry of an expanded set of printer control codes
into a WordStar document. This document contains the following
information:
o Historical information on the patch and its authorship.
o A description of the patch and how to use it.
o Instructions for installing and testing the patch.
This document is written so that both experienced computer
people and novices can use it. If you can't actually do the
things discussed, you can find someone more knowledgeable to do
them for you.
2. REQUIREMENTS FOR INSTALLATION
To use ANYCODE3, you will need the following:
o A computer system that runs CP/M, with two disk drives.
o An installed and working copy of WordStar.
o A CP/M system disk with DDT.COM and ASM.COM on it.
o This document.
o A copy of ANYCODE3.ASM, the 8080 source file for the patch
program.
Installation of ANYCODE3 is a relatively simple process, dis-
cussed as the last part of this document.
ANYCODE3.DOC PAGE 1 of 7
HISTORY
3. HISTORY
Despite its relative age, WordStar remains a popular word pro-
cessing tool, and it is still one of the most powerful word
processors available. You can install WordStar to use virtually
all of the features of modern daisywheel printers to produce
professional printed documents of exceptional quality. You can
also install WordStar to take advantage of many of the features
of a sophisticated dot matrix printer. But there just aren't
enough WordStar codes available to let you use everything a dot
matrix printer can do.
It would be convenient if you could simply enter the control
characters you want into the file the same way you enter codes
that WordStar knows about, but it isn't that simple. WordStar
filters your document as it prints it, and any nonprintable
characters that WordStar doesn't recognize are rejected.
The original ANYCODE was written for the Osborne by Doug Hurst,
to circumvent this limitation. Its function is to unlock all of
the features of a dot-matrix printer by providing a way to fool
WordStar into transmitting those control characters. Doug's
program is a patch that is inserted logically between WordStar
and the CP/M PRIMARY list device - if you're not using the
primary list device, this patch isn't guaranteed to work. The
version under discussion here, written by Dick Binder and named
ANYCODE3, fixes a couple of limitations in the original ANYCODE;
the enhancements will be pointed out later.
4. WHAT ANYCODE DOES
This section describes how ANYCODE3 works, with a little digres-
sion first, to explain some terms and coding conventions.
N O T E
In the following discussion, sequences of characters
will be enclosed in quotation marks. This method of
display is merely to call your attention to these se-
quences; when using ANYCODE3, you should not put quota-
tion marks in your file unless you want them to appear.
4.1. The Digression
Before you can understand how ANYCODE3 does what it does, you
need to understand a little about the code system used to des-
cribe the way characters are transmitted to your printer. If
you are an experienced programmer or system user, you will
probably not need to read this section.
ANYCODE3.DOC PAGE 2 of 7
HEX-ASCII
4.1.1. Hex-ASCII
You are familiar with the number system that we use every day,
the decimal system. In the computer industry, another number
system is usually used, called the Hexadecimal system ("hex" for
short). In the same way that the decimal system uses ten
digits, the hex system uses sixteen digits. In hex, you can
represent the values from zero to fifteen in a single digit, and
you can count up to 255 in two digits.
The digits used in the hex system are the ordinary digits 1-9,
plus the letters A-F. For example, the value 65 is written in
hex as 41, and 195 is C3.
If you look in the programming section of your printer's manual,
you will find a table of the characters the printer understands.
This table will assign a numerical value to each character; for
example, the character "A" has the value 41. The code system
used is called ASCII, and when it is represented in hex numbers,
then the combination is called hex-ASCII. That's how "A" be-
comes 41 - 41 is the hex value that represents "A".
4.1.2. Printer Control Sequences
If you explore the programming section of the manual further,
you will find a list of control character sequences to invoke
special features of the printer, such as the printing of ital-
ics. For most printers, these sequences begin with a character
called ESCAPE - sometimes it is abbreviated to ESC or <ESC>.
The sequence that will cause an Epson printer to begin printing
italics is <ESC> followed by the character "4". In the manual,
this sequence will be shown something like this:
<ESC> 4
With this digression in mind, you can follow the discussion of
how ANYCODE3 works.
4.2. Functionality
What ANYCODE3 does is to examine the printed stream, looking for
either of two characters that are set aside for it to use as
lead-in characters. A "lead-in" character signifies that a
special character sequence follows, telling ANYCODE3 to begin
processing. Detection of one of these characters will cause
ANYCODE3 to transmit a control character to the printer. The
control character is constructed from the next two characters in
the file, as described in the next paragraph.
ANYCODE3.DOC PAGE 3 of 7
FUNCTIONALITY
Because WordStar refuses to transmit nonprinting characters in
the file to the printer, ANYCODE3 uses ordinary printing
characters as they are passed to it by WordStar. It converts
them into nonprinting characters and then sends them to the
printer. For each special character you want to send to the
printer, you enter two characters that represent the two hex
digits of the special character. For example, to send an <ESC>
character, you look in the printer manual's code table and find
that <ESC> is assigned the hex value 1B. That's equivalent to
the decimal value 27. If you enter one of ANYCODE3's lead-in
characters into your file followed by the two characters "1B",
ANYCODE3 will convert those two characters into a real <ESC> and
send it to the printer.
(One of ANYCODE's two enhancements over the original ANYCODE is
that it will accept either uppercase or lowercase letters as
valid hex-ASCII digits - it will handle "0f" the same way it
handles "0F".)
4.2.1. The ANYCODE3 Lead-in Characters
The two characters set aside for ANYCODE3's lead-in characters
are the back-accent, sometimes called a grave accent ( ` ),
whose hex-ASCII value is 60, and the tilde ( ~ ), whose hex-
ASCII value is 7E. There are two lead-ins instead of only one,
so that ANYCODE3 can do some of the work for you. The two lead-
in characters work a little differently, as follows:
1. Back-accent. This character will cause a direct transmis-
sion of a single ASCII character; for example, to send an
ASCII <SI> character, include "`0F" in your text file.
2. Tilde. This character will cause transmission of an <ESC>
followed by the character defined by your two hex-ASCII
characters. For example, to send an ESCAPE sequence that
will turn on Epson italics ( <ESC> 4 ), include ~34 in the
file. The tilde is set aside in this way because so many
printer control sequences begin with an <ESC> - it saves you
a lot of time and typing to enter a sequence like "~34"
instead of "`1B`34".
From the previous list entry, describing how the tilde works,
you can see that it is possible to send longer sequences of
control characters by concatenating coded sequences - suppose
you wanted to send the three-character sequence <ESC> N 08
[where that 08 is a BACKSPACE, the character whose real hex-
ASCII value is 08]. All you enter is this: ~4E`08 .
Now the question is bound to arise: What do I do if I want to
print one of the lead-in characters? Won't ANYCODE3 see it and
ANYCODE3.DOC PAGE 4 of 7
THE ANYCODE3 LEAD-IN CHARACTERS
process the next two characters as a control character? Normal-
ly, yes. But the second of ANYCODE3's enhancements over the
original ANYCODE is that ANYCODE3 allows you to print a lead-in
character by repeating it in your file - to print the phrase "An
`enclosed' word", just enter it like this: "An ``enclosed'
word". The original ANYCODE did not allow you to print its
lead-in characters.
5.0. USING ANYCODE3
From reading the previous discussion, you have learned almost
all you need to know about using ANYCODE3. The last bit of
information you need concerns WHEN to use ANYCODE3. Or, more
accurately, when to insert the ANYCODE3 sequences into your
text. Do that after you have created the entire document and
have gotten it formatted just the way you want it. Because
ANYCODE3 sequences are "real" characters that aren't invisible
to WordStar, you should set the WordStar margin release feature
OFF (strike ^OX) so WordStar won't surprise you by reformatting
a line when you don't want it to change anything. Enter all the
ANYCODE3 sequences throughout your document, and then you can
print it. The following figure is a sample document file you
can use to test several of ANYCODE3's features after you've
installed it. This file will work with Epson printers that have
Graftrax-Plus installed, and with many Epson-compatible prin-
ters, such as the Mannesmann Tally Spirit-80.
`0FCompressed print`12
`0EExpanded print`14
~45Emphasized print~46
~34Italic print~35
~2D`01Continuous underline~2D`00
~53`01Sub~48~54`01script
~53`00Super~48~54`01script
Figure 1. Sample print file.
6.0. INSTALLING ANYCODE3
First, create a disk with WS.COM and ANYCODE3.ASM on it, and
nothing else. Then, follow this sequence. The patch goes into
the MORPAT: area of WordStar - the start of that area is 02BB
for Version 3.3, and 02DE for Versions 2.26 and 3.0. This
discussion will be for Version 3.3 with notes where things are
different for the other versions. In the following steps, the
things you enter are in lowercase, and the things the computer
says are in uppercase.
1. Put your CP/M disk into drive A: and your work disk (the one
ANYCODE3.DOC PAGE 5 of 7
INSTALLING ANYCODE3
with WS.COM and ANYCODE3.ASM on it) into drive B: Use STAT
to find out the size of your WS.COM file - it's different
for different computers.
A>stat b:ws.com
STAT will respond by telling you the size of the file in
Kbytes, records, and extents. You're interested in the
number of records. Divide this number by two, rounding up
if it doesn't come out even, and write down the result. You
will need it later, when you save the modified WS.COM file.
2. Assemble ANYCODE3 using the standard CP/M assembler.
A>asm b:anycode3.bbz
This command will cause ASM to look on drive B: for the
input file, and to place the output file, ANYCODE3.HEX, on
drive B: No listing file will be generated.
3. Now, using the standard CP/M debugger, you can install your
ANYCODE3 patch into WS.COM. The information DDT types out
may not be exactly the same as what is shown here - don't
worry about it.
A>ddt b:ws.com
DDT VERS 2.2
0100 NEXT PC 4600
-d2bb
(DDT will display 256 bytes of data comprising part of the
WS.COM program.)
If you have WordStar Version 2.26 or 3.0, use the address
2DE instead of 2BB. The purpose of this display command is
to see that the MORPAT: area is not already used; if the
first 120 locations are not 00, then you can't use this
patch. If that's the case, just reboot CP/M and cry for a
while.
4. Next, still using the debugger, read in the ANYCODE3 file.
-ib:anycode3.hex
-r
DDT will take a few moments, and then it will return to you
for your next command.
5. Now you must install another tiny patch to make WordStar
jump to ANYCODE3 instead of transferring characters directly
to the printer. You are still using the debugger.
ANYCODE3.DOC PAGE 6 of 7
INSTALLING ANYCODE3
-a71c
071C call 2bb
071F jmp 722
0722 <RETURN>
-
If you have Version 2.26 or 3.0, start at 071D instead, make
the CALL instruction point at 2DE, and make the JMP instruc-
tion go to 0723.
6. Your patching is complete. Now, you exit from the debugger
by giving it a command that will reboot CP/M. Your patched
WS.COM file will still be in place in memory.
-0g
7. Finally, you erase the old verion of WS.COM from your work
disk and save the new, modified version.
A>era b:ws.com
A>save NN b:ws.com
The NN in the save instruction represents the size in pages
of your WS.COM - you figured this size out back at the
beginning of this procedure. For Apple CP/M WordStar Ver-
sion 3.3, NN is 75.
That's it. Create a test file to activate the printer features
you'd like to test, and print it. Figure 1, earlier in this
document, is a good starting place.
You can use the WS.COM you've installed, exactly as it is, by
putting your regular WordStar disk in drive A: because WordStar
will always look on the system disk for its overlay files unless
it has been installed to look elsewhere. Just enter a command
to start WordStar like this:
A>b:ws
7.0. GOOD LUCK
Good luck - if you have any problems, you can send mail to me at
the address on top of this document. If you're on a computer
network, I may be at one of the following net addresses:
DEC Easynet: ASD::BINDER
DDN: binder%asd.DEC@decwrl.ARPA
uucp usenet: { decwrl, allegra, etc. }!asd.dec.com!binder
ANYCODE3.DOC PAGE 7 of 7