* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** I M P R O V E M E N T S T O W O R D B E E ** by PHIL WILKIN ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * I purchased my 16K 'Bee some three and a half years ago and acquired an Alpha-80 printer (same as the A.T. unit) shortly afterwards. The 'Bee now has a 32K series 3 coreboard. During this time, ROM based Wordbee has been used extensively for a variety of documents/letters and its frustrating deficiencies have resulted in various modifications being made to the program to expand its use. This article examines some of those shortcomings and suggests solutions. Early mods included changing the default printer from serial to parallel and doing a warm start when jumping to basic. However these variations are insignificant when compared to what can be achieved. You can't really expect much in an 8K word processing program yet Wordbee performs effectively. It would be nice to have auto paragraph numbering, sub-paragraph indenting and a screen formatted like the printed version, but it is nevertheless fairly comprehensive. The main deficiency and the area covered in depth here concerns printer codes. With standard Wordbee, if you wish to underline, and detest those silly little dashes invoked by the .ULx command, you would include in your file: .ES printer code sequence follows 27 45 1 as per printer manualfollow this with the part to be underlined, then: .ES 27 45 0to cancel the underlining. To underline a word in the middle of a line you also need to suppress line feeds with a .ZN and carefully space out to the required column for the underlined word, and so on. Similar messing about is necessary for any of the other attributes one is likely to want in the text such as italics, emphasised, double strike, enlarged, condensed, superscript or subscript. The solution is to modify Wordbee to recognise mid-line signals which cause the appropriate code to be output to the printer. Before we look at implementing these in Wordbee, let's have a look at the program (version 1.2) for some space to put our code. There are 128 bytes containing FF or 00 from DF67 to DFE6. You might think this is a bit out of the way and too restricted in size but your printer will never know the difference and it's worth keeping in mind. A point to note is that the early version (1.0) has 426 free bytes from DE40 which is sufficient for a number of printer codes. When you initialise Wordbee, you briefly see "Checking WORDBEE program" on the main menu page. If any bytes are different you will next see "EPROM ERROR press ESC to continue". If you modify Wordbee, this message will always come up. Once you have your modified version up and running in an EPROM, it won't change, so it does not need to checked each time. The checking routine is from C017 to C056 so if C017 reads JP C057, you then have from C01A to C056. As a bonus, you also get DF22 to DF53 where the messages were coded. When you have finished with a file and type (at the main menu level) 'KIL' you do not want to be asked by your Bee 'Are you sure ?' if you know what you are doing. Surely your fingers could not be that accidental!! The same thing happens when you exit to Basic but if you change that to a warm start Basic, an accidental 'E' will not crash your file. The 'Are you sure' routine is at C140 and the Basic exit starts at C132 with CD 40 C1 which if you change to CD 28 C9 C3 21 80 (CALL a CLS and JP 8021 to Basic) will give you from C138 to C152 which is 27 more bytes for printer codes. Of course you must also delete from the KIL routine the call to the 'Are you sure' subroutine: change C18F from CD 40 C1 C0 to 4 NOPs. To find more space, you need to critically look at those existing facilities which you have no need for. There seemed to be no good reason to send nulls or wait for x seconds or to .ULx or switch the printer on/off so all these, when deleted, provided spaces in the program for printer codes. The next problem is to decide exactly what new attributes we wish to add to the program. I had a need for continuous underlining, italic and super- script printing with enlarged, condensed and emphasised on the 'nice to have' list and it was not too difficult to add subscript and double printing at the same time. A new .FF command was also added to provide a form feed at the end of a letter. Now we need to look at just how and where to add our code.
We have made spaces in the original program and these can be
used for output code but we still need to put a 'trip' into the
program to test for our signal and then jump to the output
routine if the result is positive. If we are to simply add more
dot commands we can use the spaces in the test routine left by
removal of .SN#xx, .WT#xx, .XY and .ULx.
The dot test routine starts at CBA4 which is called at the
start of each line. If the first character is not a full stop
(2E hex) the test returns 'non-zero'. If it is a dot, the
routine then tests the fourth character for a <CR> (0Dh) - for
two-letter commands such as .JY; or tests it for a '#' (23h) -
for commands such as .LM#10. The final test here is for a .ULx
type of command which we will not need.
The method I employed was to use one letter for each new
facility followed by a 'Y' for switching it on or a 'N' for
switching it off. For example .IY would switch the printer over
to italic mode and a .IN would revert it to normal. Similarly,
'C' can be used for condensed printing, 'B' for big/enlarged
characters (E is reserved for .ES), 'M' for emphasised, 'U' for
underlining, and 'D' for double print. As super and subscript
are so closely related, it was decided to implement these as .SB
for sub, .SP for super and .SN for cancelling either (same
code).
The lines which checked for those attributes which are no
longer required can now be altered to test for a new attribute
such as italics. However, to check for each of the eight new
facilities we are adding, we run out of space here. The
assembler listing shows a jump to C039 where the tests continue
(in the area left vacant by deletion of the 'Checking WORDBEE'
routine). The listing has been commented to show what the code
does and if you have your printer manual open at Appendix B you
should be able to verify the signals being sent to the printer
for each attribute. Apart from the routines jumping around to
the various spaces created earlier, you will note that different
attributes require codes sent to the printer to vary from one
character (condensed: 0F for on, 12 for off) to four characters
(to turn off sub or superscript: ESC H and ESC T).
This method works quite well but, it still has the
disadvantage that you need a new line to invoke any of these new
facilities with its own dot command and another new line to
cancel it. If you wish to print one word in the middle of a
paragraph in italics to highlight it, you must put a <CR> at the
end of the previous line, suppress line feeds with a .ZN line,
type out the line to the preceding word, another <CR>, switch on
italic mode with a .IY line, type the italic word, <CR>, re-
invoke line feeds with a .ZY, space out to the next word and go
on typing. It has the advantages that it only requires one
line instead of two and you do not need to refer to a list of
the number codes for each facility.
An improvement, however, is to use a special character as a
mid-line trigger to jump to a test routine to ascertain whether
the following character is to switch an attribute on or off.
This method has also been used with the slosh (or backslash) '\'
character being employed as the trigger. Following this
character with the appropriate letter for each facility can
toggle the facility on or off.
In \Ithis\I example, the word 'this' would be printed in italics
as:
In this example, etc.
You should now be able to follow the screen dump of the
'PARALLEL PRINTER COMMAND MENU'.
This all sounds interesting, you say, but how do we operate
this 'switch'? Well, the original .ULx command uses a scratch
pad at memory location 0547h to store the character the user
selects as a trigger for underlining. On initialisation,
Wordbee sets that scratchpad to zero and as we have scrubbed
.ULx, we can use that location. If each of our eight new
attributes is allocated one bit of that byte, we then have eight
separate switches. Also, the original program used a routine
at CA96 to check if the character allocated by a .ULx was
present and, if so, act accordingly.
We simply replace that routine with our own which checks
for a slosh character, continuing on to the usual print routine
if not found. If there is a slosh, our routine ensures the
next character is upper case and then jumps to another routine
we put at DF28 which sets the switches and outputs the signals
to the printer. A few little points to note. Subscript and
superscript required new identifying characters: ']' and '^'
have been used. The word "PAGE x" which was located at DF5F and
addressed by location CB1D has been moved to DF22 and CB1D
amended accordingly. The second assembler listing shows how a
software switch is used.
One of the problems of using a mid-line switch is adjusting
the line length to compensate. This problem has not been
entirely overcome and using this facility upsets the right
justification mode. Perhaps one of the members out there has the
time and inclination to delve into the .JY routine and come up
with the solution? Well, with these changes to Wordbee, you will
find it much more convenient to use those special attributes
your printer can so readily provide. However, we haven't
entirely finished with improvements and you may consider the
following suggestions or perhaps design your own.
The Telcom monitor works the same way as the Wordbee
monitor but is more comprehensive and readily allows swapping
around between the PAK locations which, if done from the Wordbee
monitor, will result in an immediate crash. Having the Telcom
monitor thus makes the Wordbee monitor obsolete and could
provide us with a substantial chunk of spare memory if we delete
it. The Wordbee monitor starts at D061 and you can enter the
Telcom monitor at E024. Just a point to watch before you
delete the monitor, there are two routines called from the rest
of Wordbee so follow these steps:
1. Amend D061 to read -
D061 CD 28 C9 CALL C928 ; clear screen
D064 C3 24 E0 JP E024 ; Telcom mon
2. Move D468 - D486 to D067 - D085 (1F bytes)
Change CF31 from 68 D4 to 67 D0
3. Move D515 - D540 to D086 - D0B1 (2C bytes)
Change CE6C from 15 D5 to 86 D0
4. Delete D0B2 to D555
This gives us 1188 bytes (4A4 h) to play with !!
SETTING DEFAULTS
Do you find that each time you start a letter or other
document that you always commence with the same formatting
parameters? In my case, most files started with the following:
.ES
27 64 ; printer initialise to set top of form and
; ensure normal text
.LM#5 ; letters look better with a good sized margin
.LL#64 ; its a handy length for letters and the
; screen resembles the final print
.PG#0 ; single sheets are often used
It was decided to automatically start files with these
parameters after a 'KIL'. If not needed, they can easily be
deleted with ^Y. Here is my method of doing this.
The 'KIL' routine ends with a jump to C060 near the start
of Wordbee. The routine from C060 to C068 clears the scratchpads
after putting a '55' into location 500, and from C069 to C07C it
clears RAM from 0901 on. If we duplicate these routines
elsewhere, follow up with a routine which block moves our
initial file into RAM, adjusts the end-of-file pointer at 051D
and then jumps to the warm start address at C07D, we will
achieve our aim. Do not forget to change the jump address at
C19F from C3 60 C0 (JP C060) to point to the new routine
location - probably where you have just cleared out the monitor.
Just in case you are not sure how to do this block move,
assemble this:
LD HL,START ; address of 'file'
LD DE,0901h ; where Wordbee files start
LD BC,LENGTH ; of file - the above example
is 1D long
LDIR
LD (051Dh),DE ; end of file pointer
JP 0C07Dh ; warm start
One way to get your 'file' is to KIL any data in memory,
write your starting parameters as a file, jump to the monitor
and move it somewhere safe (away from EDASM source codes you
might perhaps be doing next). Alter natively, you can enter it
directly with the Telcom monitor in text mode.
Should you always want your standard parameters, just
change the instruction at C07A to CALL your new routine which
will start with the replaced "LD (0513),HL" and follow with the
block move routine, ending with a RET in lieu of JP 0C07Dh.
Having made a big hole where the monitor used to be, we
might as well do something worthwhile with it. I have a small
family company and I have designed a four line letterhead using
bit image graphics to print the company name in large fancy
writing. Perhaps readers might want to put their family crest on
letters or maybe just the house name in stylish print followed
by the address.
The problem was that the Wordbee file for the letterhead
consisted of around one thousand items of data, each being two
to four bytes long. Not only was it time consuming to load all
the data and to scroll through it before even starting the
letter, but also when saving the letter to tape.
A new command .LH was introduced to dump the data to the
printer. Instead of being part of a Wordbee file, the data is
now stored in hex, filling most of that big hole. To arrange
this, put a branch loop in the dot command look-up table. Refer
to listing one, line 210. Amend the address from 'LINE' (CC6E)
to 'LHEAD' which will be wherever you put the following code
(example is at D0F5):
; LETTERHEAD ROUTINE
;
ORG 0D0F5 ; or where it suits you
PRINT EQU 0CD54 ; usual print routine
START EQU 0D110 ; or where your letterhead data starts
LENGTH EQU 3DC ; change to the number of bytes in
your data
LINE EQU 0CC6E ; original .LS#xx test location
;
LHEAD LD A,(IY+2) ; get the next character
CP 'H' ; is the command .LH ?
JP NZ,LINE ; if not, revert to original test
; to get here it must have been a .LH command
LD HL,START ; location of your data
LD DE,START ; first piece of data
LD BC,LENGTH ; of data string
OUTPUT LD A,(DE) ; ready to print contents of A reg
CALL PRINT ; to printer
LDI ; to next byte
JP PE,OUTPUT ; print next if not finished
RET ; all done
END ; to keep EDASM happy !
It would be easy to modify this routine to give a choice of
letter heads or perhaps a signature. Just remember that the
fourth character (IY+3) MUST be a <CR> or a '#', so you would
need to test for .L1, .L2, etc or maybe .LH#1.
And now to the last modification of substance. Having tried
this modified Wordbee with a PC, a conflict occurred when trying
to move to the top of the file with ^T. This is because the
Shell at PAK 5 which controls the whole show acts on a ^T doing
a text dump to the printer! The solution is to change the
command to ^W which is achieved by changing D02F from 14 to 17
and changing D58A from 54 to 57.
The rest of the changes are cosmetic and include changing
the main menu choice of "Net" to "Telcom" and re-wording the
printer help page to reflect the new commands.
That's about the extent of changes implemented so far. I
cannot sell you a copy of his modified Wordbee because of
copyright on the original program, but if you bring along your
originally purchased copy of Wordbee and a spare 2764 EPROM,
your copy can be modified as outlined above for say $10 and
burnt into the EPROM.
One last point to help you with your mods. Rod Irving
Electronics has been selling 6264(8K RAM) chips for $7 and these
are pin compatible with 2764's. They won't work just anywhere
though, only in place of the BASIC ROM's and/or PAK 0, and only
if the link is made between "16" and "17" near IC10 on the
coreboard and the other links are set for 2764's. What this
means is that you can set up your modified Wordbee in a RAM chip
located at PAK 0 and test run it before burning it into an
EPROM. What you can't do is throw out your Basic ROM's and plug
in RAM to provide more memory for Wordbee because Wordbee makes
some ROM calls into Basic.
Perhaps some readers have other modifications which club
members may be interested in, or maybe someone will rewrite all
this unstructured (thrown together) code into some semblance of