Contents / Part 3 / Previous chapter / Next chapter / Index
As we saw earlier, the following keywords can be used in a variety of statements which produce high resolution graphics effects on the screen:
MODE which selects a particular graphics mode
GCOL which selects the colour and drawing 'style' of any graphics (except in MODES 3, 6 or 7)
DRAW which draws lines (except MODES 3, 6 or 7)
MOVE which moves the graphics cursor (except MODES 3, 6 or 7)
PLOT which draws lines, dotted lines, points and colours in triangles (except MODES 3, 6 or 7)
VDU a versatile command which produces a wide variety of effects.
These will only become familiar with use. What follows is a description of how to use some of the keywords to produce a selection of results on the screen.
The screen mode can be changed at any time by typing MODE X, where X is the value 0 to 7 from the following list:
MODE 0 uses two colours (Model B only) with very high resolution and requires 20k of memory to "map" the screen
MODE 1 uses four colours (Model B only) with high resolution and requires 20K of memory
MODE 2 uses ]6 colours (Model l3 only) with medium resolution graphics - 20k
MODE 3 text only - 16k (Model B only)
MODE 4 two colours and high resolution graphics - 10k
MODE 5 four colours and medium resolution graphics xa 0k
MODE 6 text only - 8k
MODE 7 teletext (which is the subject of a separate section of this book) - 1k
In MODES 0, 1, 2, 4 & 5 the screen is divided up into imaginary rectangles, like a piece of graph paper. In mode 0 there are 640 x 256 squares; in MODES 1 and 4 therefore 320 x 256 and in MODES 2 and 5 there are 160 x 256 (in other words, the higher the resolution of the graphics the smaller the rectangle). The higher the resolution, the more memory is used up in the process of 'mapping' the screen.
On page 495 you will find a graphics planning sheet which shows the way the screen can be thought of as a piece of graph paper, with each point having, a horizontal (X) and a vertical (Y) value. The 'origin' is point 0,0 and is at the bottom left of the screen. Top right is 1279, 1023
100 MODE 5
110 MOVE 400,400
/li>120 DRAW 800,400
/li>130 DRAW 800,800
140 DRAW 400,800
150 DRAW 400,400
Run the program.
The normal foreground colour in MODE 5 is white. Add the following line
105 GCOL0,1
This changes the lines to "logical" colour 1, which in MODE 5 is red. MODE 5 only has 4 colours. When the machine is switched on they are BLACK, RED, YELLOW and WHITE. However, logical colours can be changed by using one of the VDU commands (see later). So, if you know what you are doing you can select any four colours in MODE 5.
PLOT 85,X,Y (see page 319) draws and then fills in a triangle drawn from the last two plotted points to the point defined by X and Y. The colour is the current graphics foreground colour. Add the following line:
160 PLOT 85,800,800
Run this program.
This will fill in one half of the square
Now add:
170 PLOT 85,800,400
Run the program and the whole square should become red.
At any particular moment the computer can print and draw on the screen using four colours. This page uses two "colours": a white background colour and a black foreground colour- that is, black writing on a white background. Similarly, the computer has a text background colour and a text foreground colour but, in addition, it is aware of a graphics foreground colour (used to draw lines), and a graphics background colour. When you change MODE the computer resets all these colours thus
Text foreground colour - white
Text background colour - black
Graphic foreground colour - white
Graphic background colour - black
The number of colours that can appear on the screen together depends on the MODE selected. In MODES 0, 3, 4 and 6 you can only have two colours at any time and they are normally black and white. In MODES 1 and 5 you can have up to four colours at any time and they are normally black, red, yellow and white. In
MODE 2 you can have up to 16 different coloured effects.
Let us consider MODE 5 for a moment and explore the effects that are available. MODE 5 is a four colour mode and the default colours are black, red, yellow and white. As you may have gathered, text and graphics are dealt with separately so to change the colour that will be used for text output you say
COLOUR 0 to give black text
COLOUR 1 to give red text
COLOUR 2 to give yellow text
COLOUR 3 for white text.
However, to change the colour used for graphics, for example to produce lines with the DRAW statement, you use these statements
GCOL 0,0 black graphics
GCOL 0,1 red graphics
GCOL 0,2 yellow
GCOL 0,3 white
The two groups of statements above change the "text foreground" and "graphics foreground" colours.
You will have noticed that, so far, 1 represents red, 2 is yellow and so on. To change the background colours we add 128 to these numbers. Thus COLOUR 129 will give a red text background, and GCOL 0,129 would set the graphics background colour to red.
For text, for example, to change from white lettering on black, to black lettering on red in MODE 5, type
MODE 5
COLOUR 129
COLOUR 0
CLS
All text will now be in black on red. Graphics will still appear in white. To change text colours in the middle a of a program merely insert the appropriate colour statements before the print statements to which they refer.
For graphics: use the GCOL statement which stands for "Graphics COLours". GCOL has two numbers after it (see page 262). The second number refers to the logical colour which is to be used for graphics from now on. The first number is usually set at 0.
So for example, to get red graphics lines on a yellow background, type
COLOUR 131
GCOL 0,1
CLS
But suppose that you wanted a blue background in MODE 5. SO far the only available colours have been black, red, yellow and white and there is a limit of four colours in MODE 5, but you can make one of those four colours blue if you want to. You do this with the statement
VDU 19,0,4,0,0,0
and then the four available colours would be blue, red, yellow
and white.
In MODE 5 only four colours are available at a time and they are referred to as 'logical' colours 0 to 3. In MODE 5 'logical' colour 0 is normally black, 'logical' colour 1 is normally red and so on but you can change the "actual colour" of any of the "logical colours" quite easily by using the VDU 19 statement followed by five numbers, separated by commas.
In a two colour mode such as MODE 4 we can do similar things e.g.
MODE 4
VDU 19,1,2,0,0,0
changes logical foreground colour 1 (which is initially white) to
actual colour 2 which is green and
VDU 19,0,5,0,0,0
changes logical background colour 0 to actual colour 5, which is magenta. (Note. The zeros at the end are for future expansion of the system.) The computer will now produce these colours until either it is switched off, the break button is pressed, or the mode is changed. These instructions to change the colours can be embedded in a program thus making it possible to alter the colours while a program is running.
Here is a list of the numbers for each "actual colour" that the computer can produce.
Actual colour number / Displayed colour
0 black
1 red
2 green
3 yellow
4 blue
5 magenta
6 cyan
7 white
8 flashing black-white
9 flashing red-cyan
10 flashing green-magenta
11 flashing yellow-blue
12 flashing blue-yellow
13 flashing magenta-green
14 flashing cyan-red
15 flashing white-black
So "actual colour" numbers are any numbers between 0 and 15. To make logical 3 a flashing red-cyan effect you write
VDU 19,3,9,0,0,0
and here are a couple of other examples
VDU 19,1,2,0,0,0 logical colour 1 is green
VDU 19,3,5,0,0,0, logical colour 3 is magenta
VDU 19,0,12,0,0,0 logical colours is flashing blue-yellow
Having set the logical colours up in this way you could then select logical colour 0 (flashing blue-yellow) as the text foreground colour with COLOUR 0, or as the graphic foreground colour with GCOL 0,0. The table opposite shows how things are set up each time you change mode.
Foreground colour | Background colour |
Logical no | Actual colour | Logical no | Actual colour |
Modes 0,3,4,6 |
0 | Black (0) | 128 | Black (0) |
1 | White (7) | 129 | White (7) |
Modes 1,5 |
0 | Black (0) | 128 | Black (0) |
1 | Red (1) | 129 | Red (1) |
2 | Yellow (3) | 130 | Yellow (3) |
3 | White (7) | 131 | White (7) |
Mode 2 |
0 | Black (0) | 128 | Black (0) |
1 | Red (1) | 129 | Red (1) |
2 | Green (2) | 130 | Green (2) |
3 | Yellow (3) | 131 | Yellow (3) |
4 | Blue (4) | 132 | Blue (4) |
5 | Magenta (5) | 133 | Magenta (5) |
6 | Cyan (6) | 134 | Cyan (6) |
7 | White (7) | 135 | White (7) |
8 | Fl. | Black/White (8) | 136 | Fl. | Black/White (8) |
9 | Fl. | Red/Cyan (9) | 137 | Fl. | Red/Cyan (9) |
10 | Fl. | Green/Magenta(10) | 138 | Fl. | Green/Magenta(10) |
11 | Fl. | Yellow/Blue (11) | 139 | Fl. | Yellow/Blue (11) |
12 | Fl. | Blue/Yellow (12) | 140 | Fl. | Blue/Yellow (12) |
13 | Fl. | Magenta/Green(13) | 141 | Fl. | Magenta/Green(13) |
14 | Fl. | Cyan/Red (14) | 142 | Fl. | Cyan/Red (14) |
15 | Fl. | White/Black (15) | 143 | Fl. | White/Black (15) |
You will have noticed that the GCOL statement is followed by two numbers.
The first number can be used to control the way that the colour (which is selected by the second number), is affected by what is
already on the screen. The statement
GCOL 0,3
tells the computer that the graphics colour to be used is to be logical colour 3 and that this is to appear no matter what was on
the screen under the new line or triangle. Values other than 0, for the first number, have other effects. For example, a value of
4, as in GCOL 4,0 has the effect of drawing a line which is the
"inverse" logical colour to the colour that it is currently crossing
over.
In two colour modes the inverse of logical colour 0 is logical colour 1. In four colour modes the following applies.
Logical colour | Inverse |
0 | 3 |
1 | 2 |
2 | 1 |
3 | 0 |
With 'default' actual colours of black, red, yellow and white the inverse colours would be white, yellow, red and black.
In MODE 2, the 16 colour effect mode, all steady colours translate to flashing colours and vice versa as the next table shows for the default colours.
Logical colour | Default displayed colour | Inverse |
0 | Black | Flashing white/black |
1 | Red | Flashing cyan/red |
2 | Green | Flashing magenta/green |
3 | Yellow | Flashing blue/yellow |
4 | Blue | Flashing yellow/blue |
5 | Magenta | Flashing green/magenta |
6 | Cyan | Flashing red/cyan |
7 | White | Flashing black/white |
8 | Flashing black/white | White |
9 | Flashing red/cyan | Cyan |
10 | Flashing green/magenta | Magenta |
11 | Flashing yellow/blue | Blue |
12 | Flashing blue/yellow | Yellow |
13 | Flashing magenta/green | Green |
14 | Flashing cyan/red | Red |
15 | Flashing white/black | Black |
Other values of the first number following GCOL enable the logical colour to be plotted to be ANDed, ORed or Exclusive-ORed with the logical colour presently on the screen. The user is referred to pages 205, 316 and 250 for a description of AND, OR and Exclusive - OR but the following examples may help.
In MODE 5 with the background set to red by the following statements
MODE 5
GCOL 0,129
CLG
An attempt to draw a yellow line ORed with the background colour by using the statement
GCOL 1,2
would in fact produce a white line since the background logical colour is 1 and the new line is to be drawn in logical colour (1 OR 2), i.e. logical colour 3. The same principles apply to GCOL 2, which ANDs the new colour with the previously displayed logical colour and to GCOL 3, which Exclusive-ORs the colours together.
(Obviously, an understanding of AND, OR and EOR are required before all the GCOL statements can be used. The effects which can be produced are very useful when it comes to the production of sophisticated animation effects.
The PLOT command can also be used to plot points.
Type MODE 4 (which is a 2 colour mode) and type
PLOT 69,500,500
This will plot a point in white at coordinates X=500, Y=500. Type
PLOT 69,600,500
and another point will appear at X=600, Y - 500.
Typing, CLG would clear the whole graphics area. However instead of CLG, type
PLOT 70,500,500
and you will see that one of the two points has gone. This is because PLOT 70 prints the 'inverse' colour at the given point. This is particularly useful when 'animating', say, a point (see below). In MODE 4 the 'inverse' of logical colour 1 is logical colour 0.
Suppose we want, say, a yellow dot on a blue background, we need to change the colour of the foreground colour from white to yellow and of the background colour from black to blue. To do this, use the VDU 19 command as described earlier
VDU 19,1,3,0,0,0
This alters logical colour 1 (this means the normal foreground colour) to actual colour 3 (i.e. yellow).
Now type
VDU 19,0,4,0,0,0
This alters logical colour 0 (which is the normal background colour) to actual colours (i.e. blue).
PLOT 69, 500, 500
will now produce the desired effect.
This time we'll write a program in steps to make a yellow 'ball' consisting of 4 dots which move on the screen on a red background.
10 MODE C
20 VDU 19,1,3,0,0,0
30 VDU 19,0,1,0,0,0
/li>1000 DEF PROCBALL(X,Y)
1010 PLOT 70,X,Y
1020 PLOT 70,X,Y+4
1030 PLOT 70,X+4,Y
1040 PLOT 70,X+4,Y+4
1050 ENDPROC
We use PLOT 70 rather than PLOT 69 to help the animation which follows.
/li>40 REM HORIZONTAL MOVEMENT
50 FOR N = 1 TO 1000
60 PROCBALL(N,500)
70 PROCBALL(N,500)
80 NEXT N
90 END
You will see that this prints the ball at the point (N,500) and then 'unprints' it only to print it again one step further on, and so on.
To speed the ball up, alter line 50
50 FOR N = 1 TO 1000 STEP 10
Each character which you type in at the keyboard has an associated ASCII code. When the computer is told to print this character it looks up the code and prints the appropriate character as an 8 x 8 matrix of dots. The letter A, for example, has the code value 65 and 'a' has the value 97 (See page 486 for the other codes). However, certain code values have been left to be defined by the user. They include values 224 to 255 (See page 384 for more details). They can be defined by use of the VDU 23 command.
Create the character by planning it on an 8 x 8 square grid.
Note the numbers along the top of the grid which start at the right and double for every column moved to the left.
To store the character shown above as code number 240, type in
VDU 23,240,28,28,8,127,8,20,34,65
The numbers which follow VDU 23,240 tell the computer the pattern of dots in each horizontal row. These values are the 'byte' patterns corresponding to the eight cells of each row.
They can be calculated in a number of ways and entered as a decimal or hexadecimal number. The simplest way for the novice is to add up the values shown in the diagram above.
Thus row a consists of 16 + 8 + 4 = 28, row b is also 28, the third row is 8, the fourth row is 64 + 32 + 16 + 8 + 4 + 2 + 1 = 127, and so on. So to create the little man, type the following program
5 MODE 5
10 VDU 23,240,28,28,8,127 8,20,34,65
20 PRINT CHR$(240);
30 GOTO 20
Note the last two lines, which print him over and over again.
We have created a character which can be reproduced in any mode (except MODE 7). By printing him and then erasing him at successive positions he can be made to move across the screen in a similar way to the ball. However, since he exists as a character he is treated as text, not graphics. This means that he is made to appear by using PRINT - as above - and the position can be defined by using the TAB statement.
Try this:
5 MODE
10 VDU 23,240,28,28,8,127,8,20,34,65
20 PRINT TAB(20,10); CHR$(240)
The character appears at text position 20,10. This is a 40 character wide mode so 20,10 is roughly in the middle of the screen.
Now try this:
20 FOR X=1 TO 19
30 PRINT TAB(X,10); CHR$(240)
40 NEXT X
This will print the man nineteen times across the screen. Now type these additional lines:
40 FOR T = 1 TO 100: NEXT T
50 PRINT TAB(X,10) ; " "
60 NEXT X
And he appears to run across the screen. By altering lines 30 and 50 so that the value in brackets is (X,X) he can be made to move diagonally on the screen.
Note that line 40 acts as a time delay.
This time, a space ship.
Plan this by using several grids.
So we have
5 MODE 4
10 VDU 23,240,8,8,28,28,62,62,62,62
20 VDU 23,241,62,62,62,62,62,62,62,62
30 VDU 23,242,62,62,62,127,127,127, 93,93
40 X = 20: Y = 10
50 PRINT TAB(X,Y);CHR$240;
60 PRINT TAB(X,Y+1);CHR$241;
70 PRINT TAB(X,Y+2);CHR$242;
This produces the space ship in the middle of the screen. To make it take off, change the program by adding these lines
35 X=20
40 FOR Y = 24 TO 1 STEP -1
80 FOR T = 1 TO 100: NEXT T
90 PRINT TAB(X,Y); " ";
100 PRINT TAB(X,Y+1); " ";
110 PRINT TAB(X,Y+2);" ";
120 NEXT Y
Now add an extra character to produce flames at the bottom of the space ship for the initial take off.
32 VDU 23,243,28,60,30,60,126,
108,162,162
75 IF Y>12 THEN PRINT TAB(X,Y+3);
115 PRINT TAB(X,Y+3); " ";
The rocket does not appear to move up the screen smoothly but in a series of jumps. This is because when you use TAB(X,Y) there are only 32 possible lines you can print on.
The VDU5 statement (see also page 75, where it is used for positioning accents, etc.) causes text to be written at the graphics cursor. This means that you can move to any point on the screen on the normal 1280 x1024 graphic "grid" and print text or user defined characters. To do this MOVE X,Y is used.
VDU 4 undoes the effect of a VDU 5 statement.
If causes text to be written where the text cursor is.
Then the first character can be printed using PRINT CHR$(240); or VDU 240. These two alternatives are equivalent but VDU 240 means less typing! We now need to backspace one character from our original position and move down one character cell so we can print the next character. We can't use TAB(X,Y) because it won't work after a VDU5 statement, so we use two of the four "cursor movement commands" (see page 75).
VDU 8 backspace cursor one character
VDU 9 forward space cursor one character
VDU 10 move cursor down one line
VDU 11 move cursor up one line
Later on we'll also use VDU127 which has exactly the same effect as pressing the DELETE key. All the VDU commands are listed at the back of the book - there's no need to remember them all.
We need to use VDU 8 and then VDU 10, or the other way round. You can string VDU commands together, so we can use
VDU 240,8,10
which will print the first character and then move the cursor into position to print the next one. To print the whole rocket and flames this is repeated 3 times: here it is done in PROCROCKET
5 MODE 4
7 VDU 23;8202;0;0;0;:REM turn off
cursor
10 VDU 23,240,8,8,28,28,62,62,62,62
20 VDU 23,241,62,62,62,62,62,62,62,62
30 VDU 23,242,62,62,62,127,127,127,93,93
32 VDU 23,243,28,60,30,60,126,108,162,
162
35 X%=20
37 VDU 5
38 GCOL 4,1
40 FOR Y%=120 TO 1023 STEP 10
50 PROCROCKET: REM draw the rocket
60 FOR F=0 TO 200 : NEXT : REM wait a while
90 PROCROCKET: REM now delete it
120 NEXT Y%
130 END
1010 DEF PROCROCKET
1020 MOVE X%,Y%
1025 VDU 240
1030 VDU 10,8,241
1010 VDU 10,8,242
1050 IF Y%<500 THEN VDU 10,8,243
1060 ENDPROC
Notice the 'integer' variables (followed by a % sign), are used: these make the program run considerably faster than 'real' variables.
The rocket is printed at line 50 by PROCROCKET. Line 60 is a short delay and line 90 prints the rocket again in its inverse colour (as specified in line 38 GCOL 4,1), and so deletes it.
As an alternative to this, the rocket could be deleted by replacing line 90 with PROCdelete, deleting line 38, and adding the new procedure
2000 DEF PROCdelete
2010 MOVE X%,Y%
2020 VDU 9,127
2030 VDU 10,9,127
2040 VDU 10,9,127
2050 VDU 10,9,127
2060 ENDPROC
This just deletes the rocket with VDU 127.
We can get smoother movement if we just delete the bottom character every time. This removes most of the flicker and what remains becomes almost a virtue. The price is that the detail at the bottom of the rocket is lost, so this method only works if your character gets wider at the bottom!
Delte lines 60 and 90, and type this new procedure:
38 GCOL0,1
40 FOR Y%=120 TO 1023 STEP 4
1010 DEF PROCROCKET
1020 MOVE X%,Y%
1025 VDU 240,10,8
1030 VDU 241,10,8
1040 VDU 242
1050 VDU 10,8,243
1055 VDU 127
1060 ENDPROC
If you change one line
1050 IF Y%<500 THEN VDU 10,8,243 ELSE VDU 10
the flames will cut out after take-off again.
Using the procedures we have developed for creating and moving the rocket on the screen, we can incorporate these into a complete game which can test your skill at landing a space ship on the Moon. This complete program uses a range of techniques described elsewhere in the book and was written by Jim Murray. We include a few notes to explain what is going on.
5 ON ERROR REPORT:GOTO 245
10 MODE5
20 VDU 23,240,8,8,28,28,62,62,62,62
30 VDU 23,241,62,62,62,62,62,62,62,62
40 VDU 23,242,62,62,62,127,127,127,93,93
50 VDU 23,243,28,60,30,60,126,108,162,162
60 VDU 23;8202;0;0;0;
70 VDU 19,2,2,0,0,0
80 VDU 28,0,20,14,0
90 @%=&906
110 *FX 11 1
Line 70 enables us to use green
Line 80 sets up a text window
Line 90 sets @% - so numbers are printed as we want them
Line 110 sets the auto repeat delay period to its minimum value
Line 5 disables the effect of line 110 if you press ESCAPE, otherwise it's difficult to type anything again!
120 PROClabels
130 PROCmoon
140 PROCinitialise
15Q VDU 5
160 X%=960
165 GCOL 0,3
170 REPEAT
180 burn%=INKEY$(0)
185 *FX 15 1
190 IF burn$="" THEN burnrate%=0 ELSE burnrate%=VAL(burn$)*30
200 PROCcalculate
210 PROCdashboard
220 IF Y%>oldY%+4 OR Y%<oldY%-4 THEN PROCrocket
225 PROCburn
230 UNTIL height=0
240 IF speed>0.004 THEN PROCcrash ELSE PROCfanfare
245 *FX 12, 0
247 *FX 15, 1
250 END
Notes: Although line 250 says END this is not the end of the program. What follows are the various procedures which have been called by the program as its exists so far.
Before we give the procedures, some notes on the earlier lines.
Line 120 PROClabels - sets up the titles
Line 130 PROCmoon - draws moon's surface
Line 140 PROCinitialise - sets all the variables to initial
values
Lines 170 - 230 are the main part of program - a REPEAT
UNTIL loop
Line 180 - checks to see if any key has been pressed
Line 185 - flushes the key buffer, otherwise the burn continues for a long time after the key is released.
Line190 - reuse INKEY$ to check if anything has been pressed.
But this returns a string. Line 190 converts it to a number.
Line 200 PROCcalculate - does the maths
Line 210 PROCdashboard - prints up the results
Line 220 - prints the rocket if Y% (the variable used in MOVE X%,Y%) has gone up or down by 4. in this mode the rocket is printed in the same place unless the change is greater than 4.
Line 225 PROCburn - draws the fuel burning
Line 240 - Crash or good landing? - at less than 15 mph it's good.
Line 247 - flushes keyboard buffer again so you don't get a whole string of numbers printed when the program stops.
700 DEF PROClabels
710 PRINT TAB(0,7)"secs"
720 PRINT TAB(0,9)"miles"
725 PRINT TAB(0,10)"feet"
730 PRINT TAB(0,12)"speed"
740 PRINT TAB(0,14)"fuel"
750 PRINT TAB(0,16)"burn?"
760 ENDPROC
800 DEF PROCmoon
805 GCOL 0, 2
810 LOCAL X
820 FOR X=100 TO 1280 STEP 200
830 MOVE X,0
840 PLOT 85,X,30
850 PLOT 85,X+100,0
860 NEXT X
870 ENDPROC
900 DEF PROCinitialise
910 TIME=0:now=0
920 speed=1 :REM in miles/second
930 height=46:REM in miles
935 Y%=920
937 oldY%=Y%
940 gravity=0.001
950 fuel=16500
960 totalmass=33000
965 burnrate%=0
970 ENDPROC
1100 DEF PROCcalculate
1105 IF fuel<=0 THEN fuel=0:burnrate%=0
1110 burntime=(TIME-now)/100
1120 now=TIME
1130 slower=(burnrate%/totalmass)*2*EXP (burnrate%*burntime/totalmass)
1140 height=height-speed*burntime-burntime*burntime/2*(gravity-slower)
1150 speed=speed+burntime*(gravity-slower)
1160 burnt=burnrate%*burntime
1170 totalmass=totalmass-burnt
1180 fuel=fuel-burnt
1190 IF height<0 THEN height=0
1200 Y%=height*20+32
1210 ENDPROC
1300 DEF PROCdashboard
1310 VDU4
1320 PRINT TAB(5,7)INT(TIME/100)
1330 PRINT TAB(5,9)INT(height)
1340 PRINT TAB(5,10)(height*5280) MOD 5280
1350 PRINT TAB(5,12)INT(speed*3600)
1360 PRINT TAB(5,14)INT(fuel)
1370 PRINT TAB(5,16)burnrate%
1375 VDU5
1380 ENDPROC
5000 DEF PROCcrash
5020 SOUND 4,-15,100,70
5030 FORX=1 TO 100
5040 MOVE 850+RND(200),RND(200)
5045 GCOL6,RND(4)
5050 DRAW RND(1280),RND(1024)
5055 NEXT
5060 ENDPROC
6000 DEF PROCfanfare
6010 FOR X=1 TO 11
6015 READ P,D
6017 IF P=999 THEN L=0 ELSE L=-15
6020 SOUND 1,L,P,D
6025 SOUND1,0,0,3
6030 NEXT
6035 DATA 97,15,97,5,101,5,999,5,101, 5,97,5,101,10,97,2,89,5,81,5,77,10
6040 ENDPROC
8000 DEFPROCburn
8005 GCOL0,1
8010 MOVEX%,oldY%
8015 IF burnrate%=0 THEN VDU10 9,127 ELSE VDU10,243
8025 GCOL0,3
8030 ENDPROC
10000 DEFPROCrocket
10100 MOVEX%,oldY%
10110 VDU 10,9,127,11,9,127,11,9,127,
11,9,127
10120 MOVE %X,Y%
10140 VDU 242,8,11,241,8,11,240
10150 oldY%=Y%
10160 ENDPROC
You start off at a height of 46 miles moving at 1 mile/sec or 3600 mph. You have fuel of 16500 lbs and your weight to start with, including fuel, is 33000 lbs. You fire the rockets by pressing one of the keys 1-9 and holding it down until you want to stop burning. The rate of burning is proportional to the number.