PROGRAM PITSTOP
Your Sinclair, April 1991

Right-o! Time to get those fingers tapping away at the keyboard again
and who better to help you on the way than YS's very own Dr. Love,
JONATHAN DAVIES.


It's been a lazy sort of month. Nothing much to do, really - no
pressure at all. But boring? Not at all. It's surprising how easy it
is to adapt to a completely event-free way of life. You just sort of
drift in and out of consciousness, watch a bit of telly, eat lots and
the days just rocket past. The only snag is that before you know it
the dreaded Pitstop deadline has come around again.

This month's episode contains something for everyone. Everyone except,
that is, people who've already got a machine code-to-data statement
program (to whom Kevin Gale's MC-DATA will prove entirely useless) and
a pop-up menu-making facility (Zafar Ahmad Khan's got that one covered
with Menu-er).

	So, if you'd follow me, please...


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


MC-DATA
by Kevin Gale

Kevin Gale's got a bit of a reputation in programming circles for
writing corking utility programs. At least, he has now - here's a
little something he knocked up for converting blocks of machine code
into DATA statements to slip into your Basic programs with the minimum
of effort. Now there was actually something a bit like this in Pitstop
a few years ago, but that was a few years ago. Besides, this version's
a lot more straightforward.

So what are we actually wobbling on about here? Well, you know how
sometimes you're typing in a program from Pitstop and you come across
a huge load of lines that are just DATA statements with lots of
numbers in? (Interesting Fact No 1: there are lots of these in
MC-DATA.) Well, actually these tend to be machine code routines in
disguise, and this program makes the process of 'disguising' the
machine code (as it were) a lot simpler. (Interesting Fact No 2: the
MC-DATA listing on this page was actually created using itself, if you
see what I mean.) All you need to do is tell the program the
whereabouts of the code in memory and how you'd like it all laid out
and it'll take care of everything else. This makes things easier not
only for you, but also for Pitstop readers (erm, and me) - if you run
your programs through this before you send them in it saves us all
from having to worry about hex dumps and other such horrors.

How does it work, then? Well, I won't bother simplifying things too
much as the program's only really going to be any use to techies. All
you've go to do is type in the First Listing (look - no hex) and save
it. When you run it, MC-DATA will be installed at address 60000. You
may need to change this if it clashes with your own program. Then you
need to set up the following variables ...

xx+54-55, start address of code
xx+60-61, length of code
xx+43-44, start line of Basic
xx+49, step of line numbers
xx+66, bytes per line (1-50)
xx+71, flags

... where xx is the start address of MC-DATA. If you want checksums to
be generated at the end of each line set 'flags' to 1, otherwise set
it to 0. Then RANDOMIZE USR 60000 and you're away.

Alternatively there's an easier way of doing this. Type in the Second
Listing, and enter numbers when requested, and it'll sort out
everything for you.

All that remains is to tag on a short routine to convert all the DATA
back into machine code and you're there. This is a doddle if you
haven't selected the checksum option - just set up a loop that reads
in all the numbers and POKEs them into memory. Otherwise you'll need
to keep a running total on each line and compare it with the checksum
at the end. This is a bit more complicated, but will save hours of
frustration for people typing the program back in.


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


MENU-ER
[actually Menu Maker]
by Zafar Ahmad Khan

It always amazes me when a program travels for thousands of miles
from, say, Islamabad (in Pakistan), across deserts and oceans, through
storms and perhaps even battlefields, and loads first time. And yet
other programs arrive from just a stone's throw away and sound as if
they've fallen victim to the tracks of a Challenger tank.

Zafar Ahmad Khan's tape did indeed load first time, having survived
the journey from Islamabad (in Pakistan) intact. Among the top-notch
stuff therein, I've picked Menu-er (Argh. Ed) as the most useful. What
it does it to let you create pop-up menus a bit like the ones on 128K
Spectrums with a group of options to choose between and a little bar
that moves up and down to pick them with. The possibilities for using
them in your own programs are, of course, endless.

It's all written in Basic, so all you've got to do is type it in and
try it out. Zafar's given us a demonstration menu which doesn't really
do much so you'll probably want to embark on a few of your own. This
is simplicity itself..

For each menu you'll need to write two DATA statements. The first
should contain seven numbers (line, column, paper, ink, number of
selections, length of longest selection and shadow colour) followed by
the title of the menu, and the second should be a list of the
selections that make up the menu. Take a gander at the demo's data
lines if you're not too sure about any of this. The bulk of your
program goes in the space before line 9000. Every time you want to
print a menu do RESTORE [line number of first relevant DATA statement]
and then GO SUB 9000. The number of the selection picked will be
returned as 'sel'. At the moment the program simply prints up this
number for demo purposes - yours will obviously do something a bit
more sensible.

