PROGRAM PITSTOP
from Your Sinclair #33 (September 1988)

What do you get if you cross David McCandless and the best amateur
programming talent in the world? Program Pitstop of course!


Right, I've got a bone to pick with you lot! Yes, I know you can get
them for 2p at the Microfair, and I know that some of you have +3s
(cough! cough!). But please, please don't send me your skillo programs
on +3 disk! I have supreme hassle trying to print out +3 programs. So
cassettes only, please. Ta very much.

Anyway enough moaning and on with the show - and what a show! First is
Chris Pile who's been delving into ancient, moth-eaten 'O'-level maths
tomes to come up with an ultra-fast machine code circle routine. Then,
there's Dan Nielson who's adapted the message scroller routine printed a
century or two back, to do something else - read on to find out what. 
R. Mulligan is third with his simple but useful password program. And
lastly this month is a Star Tip from protection expert Graham Mason,
who's written us the fabbiest loader I've ever seen.

If you think that you can equal, surpass or even transcend the programs
printed here, then don't just sit at home and let your head swell, send
the routines in to me and let me pump up your ego instead. Not only does
your name appear in these hallowed pages but you could possibly win #50!
So send all your programs to David McCandless, Program Pitstop, YS, 14
Rathbone Place, London W1P 1DE.


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


CIRCLES
by Chris Pile
from Your Sinclair #33 (September 1988)
[files CIRCLES.*]

Of all the shapes in the universe, of all the forms in the cosmos, do
you know which is the hardest to draw on the humble old Speccy? No, not
a rhombicosidodecahedron, nor a double helix, but a ... circle! It's so
complex that even the venerated Speccy ROM takes ages to draw one. But
here comes Chris Pile with a circle routine that is 20 times faster than
Basic.

Techno Bilge

For all you bilgo mathematicians out there, here's how it works:
(x^2+y^2)-r^2 for a 45 degree axis in seven points of x-y horizontal
symmetry. Understand? I thought you might.

Method

Despite the complexity of the actual code, it is contrastingly simple to
use. Type in or load the hex loader, and then enter the 320 bytes of
code into address 63000. After you've done that, save it to tape with
SAVE "name" CODE 63000,320.

Circulating

Halo, halo, halo. What's all this then? Just a dab of light humour there
to stir a groan from your chests. Right, now you have the code in
memory, type RANDOMIZE USR 63267. This sub-routine initialises the root
and plot tables which, in English, means it builds up the data for the
circle. You only need to do this once - every time you load the program!

[The routine at 63267 requires a sequence of 8 bytes holding the values]
[of each set bit at $FF00 (65280). This data was omitted from the      ]
[magazine listing, so the routine didn't work as printed. The extra    ]
[line 15 in the Basic listing corrects this. Thanks to "Woody" for     ]
[explaining the required correction.                               JimG]

To draw a circle use the following variables:
POKE 63002, x co-ord of centre
POKE 63004, y co-ord of centre
POKE 63006, radius

Then once you've done that, it's a case of typing RANDOMIZE USR 63000 to
see your circle on screen. The program is totally crash proof (cross my
fingers), and will not explode in a splurge of flashing squares should
your circle stray off the edge of the screen.

To see how really zippo and fast it is, type in the short demo program.
Get circulating!


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


MESSAGE SCROLLER 2
by Dan Nielson
from Your Sinclair #33 (September 1988)
[files MSCROLL2.*]

Remember that old Message Scroller routine printed way, way, way, way
back in issue 30? Well, Dan Nielson (as in Bridgette - wahay! Fnar!),
from the tongue-twistingly named Tornskadavenget (excuse me while I
unknot my tongue), has sent in an updated version of the program which
allows you to scroll letters up to four times wider than normal text.
And why not?

Method

This is pretty simple to start up and get working. All you do is type in
the 19 lines of hexadecimal with the hex loader (see Circles), and then
save the chunk of code with: SAVE "name" CODE 23296,160. Or, alternat-
ively, you can type in the Basic controller program and utilise the save
option on that. Nuff said?

Basic Controller

This smallish BASIC program helps you establish scrolling messages. It
contains the variables all you programming bods could ever need. To save
it type: SAVE "name" LINE 1 and it will auto-run when you load it next.


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


STAR TIP 12 (Custom Loader)
by Graham Mason
from Your Sinclair #33 (September 1988)

Graham has been programming since the good old days, back in the ZX81
century. He's worked for a majority of major companies including Lothorien,
PSS, and CRL. He's also a pretty deadly hacker, so check out some of his
work in Practical POKEs. His all time fave rave games are Exolon and Gothik,
and music-wise he likes a good bout of Genesis to un-curdle his muscles.

And as a grand finale this month, we have for you a grand, great, supa,
smashing, ace Star Tip for you to slaver over. This thrilling star tip
is from Graham Mason. His speciality is loading and protection systems,
and he has developed the indomitable - to all but him - Injectaload
system, used on recent CRL games. So this month I asked him to write us
a snazzy, glow-in-da-dark, hyper-fast, loading system. Check it out.

Loader Specs

This is probably the most comprehensive, compact and down-right crucial
loading routine I've ever come across.Within it's 400 byte size (1),
there's facilities for loading and saving a program of any length, with
any colour in the border, at any baud rate. And what's more - and listen
now! - it's possible to have the loader program scrunched down to an
amazing 52 - yes, 52! - bytes!

Method

First of all, type in the main basic initialiser program and save it with
SAVE "name" LINE 10. Then type in the 400 bytes code block using the hex
loader (from Circles), and save that with SAVE "name" CODE 60000,400.
After you've managed that, RUN the basic program and re-load the code.

Initialising

The program allows you to set up all the variables you need to get your
loader working. Here's a quick resume of them:

TO LOAD:

POKE	60003,length HI
	60004,length LO
POKE	60007,start HI
	60008,start LO
POKE	60015,n
	60027,n
	60085,n
	60177,n
Where n is the border colour	(2)
POKE	60090,x
	60116,x
	60124,x
	60129,x
	60144,x
Where x is the baud rate	(3)
RANDOMIZE USR 60000

TO SAVE:

POKE	60208,length HI
	60209,length LO
POKE	60205,start HI		(4)
	60206,start LO		(4)
POKE	60223,n
	60274,n
	60302,n
Where n is the border colour	(2)
POKE	60257,x
	60290,x
	60296,x
	60312,x
Where x is the baud rate	(3)
RANDOMIZE USR 60201

The format for typing in the variable marked HI or LO (be it "length" or
"start") is:

POKE address,value-256*INT(value/256)
POKE address+1,INT(value/256)

If the variable is marked with an "x" or an "n" then just POKE in the
value as per normal.

Using the initialise program is easier than typing in all these variables,
but do have a pencil and pad handy to write down any values you might have
to POKE, such as the length number for example. Once you're satisfied with
the variables, the program will exit to basic and expect you to POKE the
colour, length and start variables into the address previously given. You
don't have to bother with the baud rate, they're POKEd in for you.

The baud rate can be any value between 1200 (snail speed), and 60000
(Boris Becker serve) (5). Then once you've POKEd them all, type either
RANDOMIZE USR 60000 to load or RANDOMIZE USR 60201 to save (have your
tape running). Both routines are fully  error-trapped, crash-less and
fool-proof, so thank your lucky hyphens.

Mega-Loader			(6)

This is an assembly listing of the 52 byte mega-loader, which will load
any code saved by the previous routine with a little trial-and-error.

Unfortunately - this is the price you have to pay for such a small loader
- you'll have to experiment to get the correct value for the timing
constant, but c'est la vie as les frogs say.

This little loader will load any length of program and as soon as you
stop the tape, or when the program that's loading ends, it will return
to basic.

notes:
(1)	It's actually 350 bytes - that's all the basic program bothers
to save, and it seems to work just fine.
(2)	No real explanation is given of this, but it's just a cosmetic
detail, so it doesn't really matter.
(3)	No real explanation of this either! This would be important, but
fortunately the basic program does it all for you.
(4)	These values are not the same as the ones given in the listing -
these are correct, the listing is wrong. Had I noticed when I typed it
in I would have corrected it.
(5)	Yes, it really does say 60000 baud! Must be a typo for 6000 though.
(6)	see seperate text file [TurboLoad.asm].

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


PASSWORD
by R. Mulligan
from Your Sinclair #33 (September 1988)
[files PASSWORD.*]

You can punch 'em, beat 'em or tie 'em up, but you can't keep them from
doing it. Ooooo-er! What am I talking about? Brothers and sisters of
course. No matter where you hide it, they'll always find your computer
diary and have a quick gawp and snigger. Well now's your chance to stop
them, with this BASIC password protection system which you can bolt onto
your programs, courtesy of R. Mulligan from Northern Ireland.

Method

What you do is type in the password routine and then place (via
MERGEing) your own program from lines 100-8999. Once you've done that,
then type GO TO 9000 [9040, actually. JimG]. You will then be asked to
type in your personal, private password, and afterwards it will SAVE and
RUN your files (or whatever), complete with password protection. Got
that? Of course you have. To change your password, should you succumb to
the obsequious pleadings of a sibling or simply mutter it in your sleep,
then type: MERGE "": GO TO 9000. Easy eh? Warning! Woe betide anyone who
types in the wrong password. The computer will crash.

Challenge

Okay all you whizz-kids (and whizz-kidesses) out there. If you think you
can write a similar program to this in machine code then send it to me.
Now! The best one printed will receive a #50 reward. I'm waiting ...


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


At last, we've finished. Didn't it take you ages to read? I can hear you
mumbling in the background. Right now listen, next month we have the
start of a series of bi-monthly specials. The first will be a sound and
music special, and will include such programs as Sound-To-Light, 128K
Sound Effects Generator and all manner of weird and wonderful tunes. Oh,
and your program may be in there somewhere too. Until then then.
Byeeeee!


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =


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

