(from Your Spectrum 4, Jun.1984)


DUMPS OF DISTINCTION

Frustrated at producing tiny screen dumps on your
full-sized printer? So was Andrew Pennell - until
he developed this clever little machine code
utility, that is!


If you're fortunate (ie. rich) enough to have an
Epson RX8O or FX8O connected to your Spectrum,
then this is the screen dump program for you.

Most printer interfaces are supplied with a high
resolution dump routine, which produces a ZX
Printer-sized copy of the screen. However, the
copies lack the different colours of the original,
and the colour system on the Spectrum can produce
weird results when copied because only the screen
bitmap is examined, and the colour information is
ignored.

Nothing's ignored in this colour screen dump.
However, not having the wherewithal for a full
seven-colour printer, I decided to write a screen
dump routine for my Epson that printed a large
picture with different shades simulating different
pixel colours; the following program is the
result, producing an 11-by 6-inch copy.

The program works on either the 16K or 48K
Spectrum, as it moves RAMTOP down to address
32349; 48K owners cannot use their extra 32K of
memory. For those with the inclination, the
routine can be modified to run from address 65118,
by changing all '205,20,127' sequences to
'205,20,255', and by changing '33,244,126' to
'33,244,254'.

Listing 1 shows the Basic loader for those with
the Hilderbay interface; note that you must load
the 'mini- software' first. For those with a
Kempston interface, add the lines in Listing 2
and, for those with a Kempston E interface, add
the lines in Listing 3. If you've got none of
these interfaces, you'll just have to modify the
machine code yourself - details to follow. And
equally important, if your printer requires Line
Feeds after Carriage Returns, add the line:

230 POKE 32478, 205: POKE 32479,20: POKE 32480,127

Once you've entered and RUN the loader, save the
routine to tape with SAVE "col copy" CODE
32350,250 - and the Basic loader after it, in case
of a crash. Then load a SCREEN$, and type
RANDOMIZE USR 32350. If your printer starts
printing, you've probably got the code right. If
it doesn't, or if the system crashes, then there
must be a mistake and you should re-load the Basic
and check it against the listings.

I think the best screen dumps are those from the
Ultimate programs, and some of these adorn this
article. Unfortunately, they all contain a lot of
black, so you'll need a new(ish) ribbon for best
results. If you're using fan-fold paper 11-inches
in length, position the perforations just above
the print head before the dump - otherwise the
next perforation will appear in the middle of the
dump. if you break in the middle of it, you may
find that your printer acts strangely, because
it's in bit mode; the best way to clear it is by
switching the printer off, then on again.


MODUS OPERANDI

The screen is copied sideways, and consists of a
176 x 256 grid of pixels. If each screen pixel is
represented by a three- by- three grid on the
printer, then this points to a printer resolution
of 528 x 768. The former figure rules out the old
Epsons (MX-type and assorted look-alikes) with
their resolution of only 480 dots per line. The
new Epsons have a resolution of 640 dots per line
in bit image mode 4, and that's why we're using
them here. As well as this, the vertical Line Feed
distance has to be changed to three dots, which is
3/72 of an inch, and is changed with the ESC "A"
command.


CRACKING THE CODE

The full assembler listing is shown in Listing 4,
printed from the Hisoft GENS assembler, which uses
'#' to denote hex numbers, and '%' for binary
numbers. It also supports conditional assembly,
which I have used to determine the setup and
output routines for different interfaces. If your
assembler does not support conditional
assembly,just leave out all mnemonics that refer
to interfaces other than your own. If you have a
different interface, substitute your own set-up
routine at START, and your own output routine at
OUTCH. Note that OUTCH must preserve the values of
HL and BC.

The copy routine proper starts at BEGIN, which
firstly resets the Line Feed distance to 3/72 of
an inch and zeros C - which is used as a counter
for the X co-ordinate. Next the printer is put
into graphics mode 4, and the B reg (which is the
Y counter) is set to zero. The ROM routine at 22AA
is called, which calculates screen location HL and
bit position B from the screen co-ordinates in B
and C, and the pixel colour calculated from the
attribute file. The relevant data is read from
TABLE and printed out, and this is repeated for
all 176 Y positions. After this, a Newline is sent
(and optionally a Line Feed), and all 256 X
positions are done. Finally, the Line Feed
distance is reset to 12/72 of an inch. The data at
TABLE contains the bit patterns for each colour.
They were originally chosen quite arbitrarily, but
I left them as they seem to produce good results.
If you don't like the shades produced, feel free
to change the data, though note that the fourth
byte for each colour should be zero. Also, beware,
Listing 4 was made with the Hilderbay interface
selected, so no object code was generated for
either of the Kempston interfaces.


The Basic loader for the Hilderbay interface.

Add these lines to the loader to use with a
Kempston interface.

Add these lines to the loader to use with a
Kempston E interface.

This listing is taken from the Hisoft GENS
assembler and uses # to denote hex numbers and %
for binary numbers. It also supports conditional
assembly.
