YOUR SINCLAIR - Program Pitstop - August 1992

Tap in those numbers, press the Enter key and stare in complete
amazement at your screen. Is there no end to the joy that a few digits
can bring?

For your delectation and delight this month I've got a rather fabby
screen compressor which, erm, squeezes your picture into a smaller
space, which not only saves you vital memory space but also makes it
easier and quicker to load.
  Then there's one for the good old SAM which makes loads of pretty
patterns. Ahh! I've also put in a Hex loader and a one line text-
centring routine. Let's get on with it shall we?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

SCREEN COMPRESSOR
by Guy Palmer

[The POKE 32921 mentioned in the instructions is the value of the]
[marker byte, which must not exist in the area to be compressed. ]
[The published version of the program expects you to guess a     ]
[suitable value - which makes it not a lot of use.  I've added a ]
[modified version which first checks for an unused value and uses]
[that. NOTE that a value of 1 cannot be used for the marker byte,]
[as it conflicts with the value used to initialise the workspace.]
[                                                           JimG ]

Good old Guy - he sends me loads of stuff, even though most of it
narrowly misses the printed page. His loyalty has paid off this month
though, he says in his letter: "If you like it, print it, and give me
the dosh. If you don't like it, then may your aubergines be denser
than a lobotomised chicken's mental capacity for cornflakes.". Yes,
Guy, I expect so. Sometimes I worry, I really do. Back to the business
then - save the BASIC using SAVE "name" LINE 9998, then use the
universally acclaimed Hex Loader to enter that bit of hex over there,
okay?
  The program then does the rest pretty much by itself, but it does
tell you the bits you have to do yourself as it runs. If you're
interested in the tech, here goes - it works by finding clumps of
similar bytes, and storing them as just three bytes. For example, if
the first ten bytes of a screen were all A7, then the program saves it
as 26 A7 10 [Wrong!! It would be 26 0A A7 - count then value. JimG],
instead of A7 A7 A7 A7 ... etc. The 26 tells the computer to put 10
A7s at a certain address. That's all there is to it, really.
Apparently, each screen is saved with a copy of the decompressing
routine, so you don't need to load it in first or anything. If the end
result of your compressed save is just garbage, Guy recommends a swift
poke - POKE 32921 with a number between 0 and 255, then try the whole
thing again.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

SAM EMBROIDERY
by Andrew Heard

Next up is a ... wait for it - SAM Coupe program. Hurrah! But better
still, it's ... wait for it - Spectrum compatible. Double hurrah! The
program was written with the SAM in mind, and as such the output
effect is infinitely better on the Coupe than on the Spec, but then,
the Coupe doesn't have attribute squares the size of small continents
to worry about. The program is printed in SAM format, so if you're a
Spec owner simply perform the following changes ...
* Delete lines 20, 40 and 110.
* Enter line 50 as INK RND*7
* Replace the PALETTE command in line 55 with CLS
* Enter line 110 as RUN and the program will go about its pattern-type
business quite happily. It may strike you that this is the first SAM
program we've had while I've been in charge; hopefully things will
change as Alan Miles has got wind (oo-er) of my appointment here. He
may well be alerting the SAM population to the general amazingness of
Pitstop and YS as a whole even as we speak, and for my part I will be
more than happy to print any SAM programs that are sent my way.
(Provided they're not the computer equivalent of a steaming pile of
pease pudding, of course!) After all, many people say that the SAM is
the natural successor of the Speccy. But then some people will say
anything.

[The DRAW commands in lines 80 & 90 were wrong in the magazine.]
[They're correct here.                                    JimG ]

  10 REM Embroidery
  11 REM by Andrew Heard
  12 REM 1992 on the SAM Coupe
  20 DO
  30 FOR n=0 TO RND*255 STEP 2
  40 PALETTE RND*15,RND*127
  50 PEN RND*15
  55 LET a$=INKEY$: IF a$<>"" THEN PALETTE: RUN
  60 PLOT 0,0: DRAW n,173
  70 PLOT 255,0: DRAW -n,173
  80 PLOT 0,173: DRAW n,-173
  90 PLOT 255,173: DRAW -n,-173
 100 NEXT n
 110 LOOP

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

BEGINNER'S CORNER
by Jonathan Arden

Just a quickie this month, a one-line routine which centres text. This
clearly has loads of useful applications like, well, menus and stuff.
The little demo program shows you how to use it in your own programs.
Just set the Y value to whatever line you want your text printed on,
then GO SUB 9999. One quick bit of easy-peasy maths later and your
text is plonked artistically in the centre of the line. Simplicity
itself. Jonathan also informs me that I've made his year by printing
this. It's always nice to make someone happy.

  10 REM Centre Text
  20 REM Written by John A
  30 BORDER 0: PAPER 0: INK 7: CLS
  40 LET a$="a sentence": LET y=10: GO SUB 9999
  50 STOP
9998 REM Centre Routine
9999 LET x=15-(LEN a$/2): PRINT AT y,x;a$: RETURN

