DOCKING
Clyde W Bish, Exeter, Devon
Your Computer, June 1984

THIS PROGRAM MAKES use of the excellent 3D Graphics Rotation program by Mark
Jones  YC July. It simulates bringing a spacecraft into visua1 range of a
satellite using a radar screen system, then using a visual/instrument display
docking with the object. The satellite is displayed as a simple cube with a
cross on the front face. This could be elaborated with extra data statements
 there is room purposely left above RAMTOP for this  but it would slow down
the graphic draw routine. In the program information which follows I have
included the machine code listing in decimal as the original listing
contained some errors which were corrected in subsequent issues of your
magazine. The same is for the 48K machine although the 16K version of the
machine code is used as space is needed to hold the screen bytes.

Type in program 1 and RUN. Enter the numbers in table A. This is the machine
code routine. If you already have the 16K version of the original program on
tape CLEAR 30999: LOAD "name" CODE 31000 and RUN 4. You have two checks for
accuracy available. Each entry is displayed on screen after it is entered,
and a check number appears at the end of the inputs. This should be 84810.
Any other number means you have made mistake.

If all is well, press CONT and ENTER. The program will now construct the sine
table and data table above RAMTOP, then draw the cockpit display. When this
is complete the D File bytes are loaded above RAMtop. Whilst all this is
going on make yourself a cup of coffee and recover from entering umpteen
machine bytes without making a mistake!

The option to SAVE the code then follows. Use this if you do not intend to
type in the main program now, otherwise BREAK and NEW the machine. Don't
worry  your precious code is safe above RAMTOP  and type in program 2.
Before you try your skill as a shuttle pilot SAVE the whole program using:
	SAVE "dock" LINE 6110: SAVE "d" CODE 31000,10144
and verify using:
	VERIFY "": VERIFY "" CODE
If you have previously SAVEd the code, LOAD it into the machine using:
	CLEAR 30999: LOAD "" CODE
before Saving as above.

When you LOAD in the program it will auto-start and LOAD in the CODE before
starting the display. If you want to play having just typed it in use RUN 6115.

The first display is of your craft and the satellite in orbit. You must guide
your craft to superimpose the two images using the 6 key to bring it into a
tighter, faster orbit, and 7 to move into a wider, slower orbit. Each move
uses up 10 fuel units. The read-out of the fuel remaining and difference in
the two orbits is given at bottom left of screen.

When you have superimposed the images the second part of the task begins. You
are given a view of the satellite - at random attitude and position  through
the viewport plus a readout of the current docking status and thruster
control in operation at top left of screen, and a read-out of the control
attitudes status, thrust level, and remaining fuel at bottom right.

The control keys are:
P & 0 = pitch to front or back
Y & T = yaw to right or left
R & E = roll to right or left
U & D = move up or down
F & B = move forward or back
M & N = move right and left

Use these to select your thruster, then press a number 1-9 to select the
power of the thrust. High values are less wasteful of fuel, but you are more
likely to overshoot! Cancel the thrust using the opposing thruster eg. B
cancels F. You have to get all the read-outs of control attitude status,
except F-B, to 0 before moving in to dock. Your final thrust speed must be
between 4 and 6 inclusive and F-B must end at 0. If all attitudes do not end
0, or you come in too fast, you will crash. If you come in too slowly you
will not close the docking latches, but will see the satellite bounce off.
You may try again, but be careful not to run out of fuel! Pressing 0 will
play again.

The capital letters in program 1, lines 6019, 6020, 6022, 6027, and program 2,
lines 6020, 6040 and 6050 are user-defined graphics and should be entered in
the Graphics mode.
