ROAD RACE
by David Hanson and Geoffrey Bowers
from ZX Computing Oct-Nov 1985


David Hanson and Geoffrey Bowers, of SMUG - Speyside Microcomputer Users 
Group - sent us this superior racing game which needs skill and strategy
as well as fast reactions.

The Road Race program is somewhat different from others that you may have 
seen and incorporates several interesting features:

1. The object of the game is to complete five laps in the fastest possible 
time. A record time is kept.

2. The track covers two screens, has real hairpin bends which involve some 
careful planning, has PITS for re-fuelling and tyre change, spectators, 
trees, etc, and the screen scrolls downwards.

3. Driving:
   You have five possible movements, three of which require two keys to be 
pressed at the same time.


To negotiate the hairpin bends effectively requires skill.

You decide whether or not to go into the pits and then have the option to 
take on fuel and/or change tyres.

There are some risky 'stunts' which can be of benefit to an experienced
driver, but you can discover these for yourself!

There is a PANIC facility - holding down the 'P' key will temporarily halt
you whilst you collect your thoughts!

4. On-screen dials (PRINTED on lines 22/23, which are not affected by the 
down scroll, but are not COPYed by the printer) show FUEL, TYRE WEAR, LAPS 
COMPLETED and TIME.

5. Your attempt ends prematurely if you crash into a tree (asterisk), run 
over a spectator (inverse zero), run out of fuel, have a burst tyre (because 
your tyres have worn too much) or run out of space (ie if you get too high 
up or, more likely, too low down the screen).


Change the Circuit
------------------

If you do not like the circuit as it is, you can easily change it by 
altering the graphics in the strings in line 1020 to 1450. It is best to 
plan your circuit on square paper first, though.


Notes on some of the lines

Line
7110-7116   Check the fuel input to make sure that a letter
            key has not been pressed by mistake, since
            this would BREAK the program with an error report.
5945-5955   PRINTing on lines 22/23 is accessed by POKE
            16418,0 before and POKE 16418,2 afterwards.
9990-9995   If the program is SAVEd by GOTO 9990, the
            program will auto-RUN on LOADing.


The program makes use of two machine code routines
   (i) A screen inversion routine.
   (ii) A down-scroll routine.


Variables Used

FT          Fastest time.
T$(44,32)   Track graphics.
N           Number of T$ to be PRINTed.
E           Line number at which T$ is to be PRINTed.
G,F         Line and column number of car.
N1          A value of N used in checking crashes.
Z$          Input of fuel.
LZ          Length of Z$.
Z           Number of character in Z$.
Z           Fuel input.
Y           Fuel during re-fuelling routine.
R           Random time for tyre change.
T           Time during tyre change routine.
R$          Input during end routine.
S$,V$       Title.
LAPS        Number of completed laps.
FUEL        Fuel left.
TW          Tyre wear.
TIME        Time taken so far.


Main Sections of the Program. These are indicated in the listing as REMs in 
inverse video, but are listed here for convenience.

100          INSTRUCTIONS
1000         TRACK GRAPHICS
1500         PRINT RECORD TIME (If appropriate)
3000         PRINT TRACK AND CAR AT THE START
3200         START VARIABLES
5000         CONTROL CENTRE (The main part of the
             program, checking to see if keys have been
             pressed, PRINTing car, updating the variables
             FUEL, TW, TIME)
5900         PRINT FUEL ETC
6000         CHECK GRAPHICS (And crossing line at completion
             of each lap)
6500         PANIC
7000         PIT STOP
7090         FUEL
7200         TYRE CHANGE
8100         FINISH (Successful completion of 5 laps)
8200         END ROUTINE
8250         HIT TREE
8300         HIT CROWD
8400         TYRE BURST
8500         TIME UP
8600         TANK EMPTY
8700         OFF SCREEN (If car gets too high up or too
             low down on the screen)
8999         TITLE


Cassette Insert
---------------

It is relatively easy to design your own cassette insert, particularly if 
you have a ZX printer which produces screen dumps of the correct size. Why 
not make use of the one here, or better still design your own? 
