YOUR SINCLAIR, April 1986
=========================


AUTOFADE
from Your Sinclair #4 (Apr.1986)

FADE AWAY

Have you got a burning desire to be on the telly? Well,
you're going the right way about it - unless you use this
program. Andy Pennell's AutoFade provides the perfect
protection policy for your TV.


Have you ever wondered what happens to your telly if you
decide to go walkabout while you're in the middle of a spot
of programming. Sod's law says that something always crops
up right in the middle of what you're doing - nature calls,
the cat dies, the telegram arrives to tell you that your
premium bond's just come up. Well, if you've just won a
hundred grand you're not going to worry too much about your
TV, but for the rest of us it's worth knowing what happens
if the Speccy's left on too long untouched. Well, if you
leave any image on the screen for a long time you may affect
the phosphor in the TV tube and that can result in a faint
image being burnt permanently into your screen.

So, how do you avoid it happening? Well, what you need is a
program that turns the screen off if you don't do anything
for a while. And that's exactly what this program, AutoFade,
does. If you don't touch a key for a certain period - you
can choose any time lapse up to twenty minutes - the screen
will go completely black. Well, all except for a single
flashing white square that lets you know what's happened.
The next time you press a key the screen will be restored to
its previous state. The idea for the program was suggested
to me by a YS reader who'd seen a similar routine for the
Beeb - the ancient historians amongst you may remember the
machine! As usual my filing system fell over and I lost the
original letter, but thanks anyway whoever you may be.


INTERRUPT US!

You've probably guessed already that the program uses
interrupts to do its stuff. And I use my interrupts so that
they work regardless of what add-ons are connected,
including Interface 1. That's what makes the program not
only genuinely useful but also a good illustration of how to
handle Interrupt Mode 2 neatly.

The usual problems with IM2 type routines is that they don't
work with non- Sinclair peripherals. That's because the byte
that's read when the Z80 tries to get the vector address is
not FF as normal but it can be any value. To take into
account all the values from 0 to FF you have to construct a
jump table that allows for all possibilities. And in spite
of what you'll read in many Z80 manuals, bit 0 isn't zeroed
when the vector is to be found. So, the interrupt routine
has to lie at an address that has two bytes the same - I've
used #FDFD. The I vector points to $FE00, which is a table
of 257 bytes of $FD, allowing for all possibilities. Take a
look at the Source Code and you'll see what I'm on about.


The Source

The easiest way of blanking the screen while saving its
previous contents is not to save all 6K of screen data but
just the attribute file of 768 bytes. You can then make the
display file black by zeroing the attributes, leaving the
display bit map well alone. The attributes are stored In the
area SCRBUF.

The INIT routine sets up the vector table and the Interrupt
mode. It also sets TIMER to 1 - this normally increases by 1
every 50th of a second until it reaches its maximum value,
when the screen is blanked, then it's set to 0 until a key
is pressed. The DISFAD routine turns off the fader by going
back to the usual Interrupt mode 1.

INTROU is my version of the Interrupt routine which normally
just scans the keyboard. It starts by calling the ROM
interrupt routine in either the Basic ROM or Interface 1,
then saves the registers before calling the extra routine
MYINT. It then restores the registers and returns in a
similar way to the ROM routine. The JP INTROU must always be
at #FDFD and it must immediately be followed by the 257 byte
vector table at #FE00. All these requirements do mean that
relocating the program to another memory address isn't just
a simple matter of changing the ORG directive. It's a job
that should only be attempted by the brave - or foolhardy!

MYINT is the special interrupt routine that controls the
screen. It starts by testing for a TIMER value of 0, which
means that the screen's been blanked. Now assuming that it
hasn't, it sees if the count has reached the magic number -
altering the LD DE instruction changes the period of the
delay in 50th seconds. If it's not timed out, the timer is
incremented unless a key's been pressed, when it's reset to
1.

BLANK handles the job of clearing the screen which it does
by copying the attributes to the buffer then setting them
all to 0 (black). The border's set to black as well and
you'll find the flashing cursor at the bottom right position
on the screen. It returns with a zero value on HL for TIMER.

TISBLA works when the screen's already blank and tests to
see if you've pressed a key. If you have, the old screen
attributes are restored, the correct border colour is set
and the TIMER is set to 1.


--
Another Fine Product transcribed by:
Jim Grimwood, Weardale, England
--


**********************************************************************


CHERRY RUN
by Conor O'Neil
from Your Sinclair #4 (Apr.1986)

Welcome to the Cherry Dome. But don't think you're going to have a
chance to relax - there are far too many cherries to collect for that.
You play Henry the Cherry Collector - and don't ask us why he's call
Henry, ask his mum. Our 'Enery has to eat his way through the four
rooms collecting cherries and taking them back to the base. But he's
chased by four cherry bugs who can only follow paths that he's
created. Fortunately, the bugs aren't invincible - Henry can do the
dirty on them by undermining the rocks, just so long as he gets out of
the way in time.

If you're not yet convinced of how good the game is, let Conor himself
persuade you. "This is my 99% megacool hypergame. Software houses
watch out - the dawn of a new force in programming genius arrives with
my launch upon the scene." Can you let a claim like that go
unchallenged?

The keys you'll need are Q for up, A down, O left and P right. Oh, and
if Conor's game has you beat you may find these POKEs useful - 49094,0
gives you infinite lives and 49174,n lets you choose any number of
lives between 1 and 9.


--
Another Fine Product transcribed by:
Jim Grimwood, Weardale, England
--


**********************************************************************


.........1.........2.........3.........4.........5.........6.........7.........8

Codebuster
by Bruce Anderson
from Your Sinclair #4 (Apr.1986)

[NOTES:                                                    ]
[The UDGs for this listing weren't printed in the magazine,]
[and no explanation was given for them, so I've just had to]
[use my best guess as to which is which.                   ]
[The location for the machine code is set so low that there]
[is only about 300 bytes free for variables, causing the   ]
["Competition" option to always fail half way through with ]
[an "Out of memory" error.                             JimG]

This is the ultimate version of the classic board game Mastermind.
STOP! Hold on. Don't turn the page. You should at least give it a
chance 'cos this program is truly unique. As far as we know this is
the only version of the game that'll guess your code as well as
guessing its own; and there are a full five skill levels.

Okay, so far you're not completely convinced yet, but since you've got
this far you might as well find out all the different options on the
main menu.

1. Competition mode: swapsies time - you and your Speccy take it in
turns to break each other's codes and whichever of you does it in the
least number of goes collects a score equal to the number of goes they
beat their opponent by. Well, that's what it says here. Looks as
though you'll just have to play the game to work out what it means!

2. Set code: you set the code for the computer to break.

3. Break code: the computer sets a code for you to break.

4. Level: how hard do you want to play? - 0 for thickies, 5 for the
faultless.

5. Holes: you can have between two and six peg holes.

6. Colours: you can choose two to nine colours - black through white
plus blank.

7. Target: the score that you have to reach to win.

8. Autoscore: the computer scores itself.

9. Quit ...

... but not yet 'cos you don't know how to play. The program
automatically puts you on the correct line and then flashes the
position. Simply press the colour/number required (space is blank).
You can edit your entry by using the cursor keys - provided the
computer doesn't think you're cheating; then press Enter to proceed.

--
Another Fine Product transcribed by:
Jim Grimwood, Weardale, England
--


**********************************************************************


FONT DESIGNER
-------------
by Lee Privett
from Your Sinclair, April 1986

YS MegaBasics back in a big way! Lee Privetts excellent utility is designed
for all of you who are looking to add more character to your MegaBasic
programs  it allows you to change the three character sets, Spectrum,
Amstrad and BBC within the MegaBasic system.

Once youve defined your new characters, the program then allows you to save
them off so you need never lose your new creations. And if youre worried
about how to make full use of the program  dont. Its completely menu
driven so theres no need for copious instructions here.

Before you type in the listing, make sure that MegaBasic is installed or you
wont get further than line five where youll meet the first MegaBasic
command.


**********************************************************************


