ILLUMINATOR (part 2 of 2)
by Alan Davis
from ZX Computing February 1987

Exploring the possibilities of the Illuminator program
with Alan Davies [sic].


Welcome back to ZX Computing's Anglo-Saxon department. If you've been
dabbling with the Illuminator program from last month's article, you
should now be the possessor of the following items: (a) 26 large
initial letter shapes stored in 832 bytes; (b) a redesigned "normal"
character set stored in 768 bytes: and very probably (c) spots before
the eyes! Never mind - this month we'll make all your tribulations
worthwhile, so put yourself in a suitably medieval frame of mind, and
let's get down to the serious business of churning out an illuminated
masterpiece or two ...

What we need, of course, is Listing 1 [see ILLUMINA.ASM] - this is the
assembler program which we'll be using to print our strings of text.
If you don't have an assembler, you can use Listing 2 instead. This
BASIC program will poke in the code for you and save it to microdrive
- but you can change line 50 to an ordinary SAVE command if you're
working with tape. The code is stored from 64800 onwards, and is 518
bytes long. Before you can use it, you need both the bytes for the
illuminated capitals, and those for your redesigned "normal"
characters residing in memory from 62976 onwards, and 64000 onwards,
respectively (ie. exactly as saved by the Illuminator program last
month.) Don't forget to lower RAMTOP before loading in the three
sections of code; CLEAR 62975 is what you want. (When all the various
parts are in memory, you'll probably find it convenient to save a copy
of the whole lot together as a single code block of 2342 bytes from
62976 onwards.)

To try it out, enter the following command: CLS: LET z$="Any old bit
of text will do as long as the first letter is in upper case": LET
m=USR 64800.

Did it work? (If it didn't, you'll need to go back and check carefully
through your saved copy one byte at a time, comparing it with Listing
2.) By the way, if perchance the first letter of z$ is in lower case
you won't get a crash - you'll just get a large square of rubbish
printed on screen where the illuminated capital should be.


Text effects

What else can it do for us? Well, quite a lot. There are several
addresses which can usefully be poked to produce a variety of effects,
and these are as follows: (the labels correspond to those in the
assembly listing.)

First, there are three addresses whose contents govern the attributes
of the illuminated capitals:
65229 (BRTC) can be POKEd with 1 or 0 to change the BRIGHT attribute
(normally zero).
65230 (INKC) can be POKEd with any number 0-7 to set the INK.
65231 (PAPC) can be POKEd with any number 0-7 to set the PAPER.

Then there are two addresses which set left and right margins:-
65232 (TAB) contains the width of the left hand margin.
65233 (TAB2) contains the width of the right hand margin.

So if, for instance, you POKE 65232,2: POKE 65233,1 then your text
will be printed with a maximum line length of 29 characters, inset 2
character squares from the left, and leaving a one character square
margin on the right. This gives great power to your illuminating
elbow, because it means you can set up a decorated border of any width
on both sides of your text, and the text will not overprint it.

There's one address whose contents control the printing mode:-
65234 (ILLUM) can be POKEd with either 0 or 1, where 1 corresponds to
illuminated capital printing, and 0 gives "normal ' printing, ie. the
illuminated initials are switched off.


Flexibility

Is that all? No, there's more (after all, I did promise you a utility
that was flexible!) Lurking among the code is a simple but effective
"window" clearing facility which can be called at USR 65250. This will
clear the screen between any two specified lines, and you control it
using these addresses:- 65235 (TOP) contains the number of the top
line to be cleared. 65236 (BOT) contains the number of the bottom line
to be cleared.

So if, for example, you want to clear a window between lines 1 and 12
inclusive, then POKE 65235,1: POKE 65236,12: LET m=USR 65250 will do
it. Note that the routine takes into account your left and right hand
margins (set by TAB and TAB2) and consequently clears only the space
within them.

Just one more point concerning colours. The INK and PAPER for both the
main text printing and screen clearing are established by whatever
permanent INK and PAPER you set from BASIC. No other action on your
part is needed.

You're now in a position to print more or less what you like, where
you like, however you like - and then rub it all out again. The only
limitation on what you print is that LEN z$ must be less than 255 -
though of course there's nothing to prevent you from printing longer
chunks of text provided you do it in bits, calling the routine to
print each chunk separately.

So much for the bread and butter; now for the jam. The point of this
exercise, you'll recall, is to try to produce an effect similar to
illuminated manuscript which could be used to improve the presentation
of a text adventure. It's fairly obvious, I think, that the
effectiveness of the idea will largely depend on the decoration you
put around the text, in addition to the text and initials themselves,
There are many possible approaches to this, and the illustrations
scattered around this and last month's article may give you a few
ideas to get you started.


Decoration

One possibility which seems promising is simply to make the TV screen
look like an old piece of parchment. Half an hour's work with
Melbourne Draw (or similar utility) will provide a suitably "ragged"
edge to the screen - and you can then load this in as a SCREEN$ and
print your text onto it (POKEing appropriate values for left and right
margins before you start). The BASIC "CLS" command must be avoided of
course, as it would wipe out all your decoration, but that's no
problem since you can do all your screen clearing selectively using
the USR 65250 call.

Another approach, either instead of or in addition to the above, is to
make use of the fact that many items in the full character set are not
likely to be needed, and to redefine these as suitably decorative
shapes for use either alone or in combination. If you look back at
Figure 1 [see ILLUM_11.GIF] in last month's article, for example,
you'll see that I redesigned CHR$ 91-93, and CHR$ 123-125 to produce a
"scroll" effect when they're printed in sequence, which makes an
attractive way of dividing blocks of text.

If you're a stickler for authenticity, and want to try to mimic some
of the features found on actual Anglo Saxon manuscripts, you might
like to try the poor man's version of the "knotted tracery" type of
decoration which I used in one of the illustrations here, and which is
shown in enlarged detail in Figure 1. (This interweaving line motif -
or variations of it - is very commonly used in Anglo-Saxon
illumination.) All you need to do is design 4 characters to the shapes
enclosed in boxes in Figure 1 - I chose CHR$ 94/95 and 126/127 for
this. Then just PRINT CHR$ 94; CHR$ 95 all the way down the left hand
side of the screen, and CHR$ 126; CHR$ 127 down the right hand side -
but don't forget to set both margins 2 character squares wide. (I
found it desirable to have a decent blank gap - half a character
square - between the border decoration and the text, or things begin
to look rather cluttered.)


Windows

If you're going to use this as a display method for a text adventure,
then you'll need to operate with several "windows" - one for location
descriptions, one for program responses, and another (perhaps the
bottom two lines) for displaying the player's input. The most
convenient approach is to incorporate the machine code calls within a
small number of BASIC subroutines to define your windows, set the
print position etc. - and I've offered some help here in the shape of
Listing 3. If you type this in and save it to auto-run from line 8000,
it will give you a simple demonstration of the effects that can be
achieved.

The four relevant subroutines in Listing 3 are as follows: GO SUB 10:
This sets top and bottom limits of the upper window (screen lines 1-12
inclusive), clears it, and resets the PRINT position to the start of
line 1. GO SUB 20: This sets top and bottom limits of the lower window
(screen lines 14-20 inclusive), clears it, and resets the PRINT
position to the start of line 14. GOS UB 50: This chooses a random INK
colour for the illuminated capitals, selects "Illuminated Initial"
mode, and prints the text held in z$ at the current PRINT position. GO
SUB 60: This selects "normal" printing of z$ and shows how the colour
of the text can be changed by altering the permanent INK colour.
Again, printing is done from the current PRINT position.

By arranging things in this way it becomes possible to do anything you
like within the two windows. If you use GO SUB 50 or GO SUB 60 alone,
printing will begin on the line following the last line printed, so
that several successive strings of text can be printed within the same
window. Alternatively, by preceding the text printing with a GO SUB 10
or GO SUB 20, you can clear out a window and reset the PRINT position
within it.

Lines 8040/50, by the way, set up the screen decoration and will only
produce a sensible display if you've defined your character set to
include the "scroll" and "knotted tracery" motifs (see Figure 1 in
last month's article). If you haven't, just replace those CHR$ numbers
above 90 by CHR$ 42 (asterisk). The result won't look very pretty, but
will still enable you to run the demonstration.

Once you've seen what the demonstration does - following the listing
so that you see why it does it - you're all set. If you're thinking of
writing an adventure, rather than just using it as a general display
facility, then you might like to be reminded that the machine code and
data are positioned in memory so that you can, if you wish, use the
Venturespeak command analyser (see the October- December issues of
ZXC). Otherwise it's over to you, and all that remains is for me to
say that I hope you find the experience ... illuminating?


--
Another Fine Product transcribed by:
Jim Grimwood, Weardale, England (http://www.users.globalnet.co.uk/~jimg/)
--
