home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Free 37
/
Commodore_Free_Issue_37_2010_Commodore_Computer_Club.d64
/
code
< prev
next >
Wrap
Text File
|
2023-02-26
|
5KB
|
201 lines
Now for a full breakdown:
* lines 5-9 are just comments any
line stating with REM is a REMark
or comment and ignored by BASIC
however leaving these lines in
slows the program down.
* line 10 Assigns variables with
values, you notice A=0 B=A (A is
nothing and so on ) and A$"" any
variable ending with a $ is treated
as a text string so the quotes give
the value of no text
* 15-89 Remarks
* line 90 chr$(147) is a clear screen
code so this just prints a CLEAR
screen command poke 53280 is the
border colour and 0 is black so
turn the border black poke 53281 is
the screen and 0 is black so turn
the screen black poke 646 is the
screen or text colours 1 is white
so all characters are printed in
white
* line 100 There are 25 lines on a
Commodore 64 down the screen this
command sets i to Zero and prints
nothing on screen after the print
the Commodore does a carriage
return to the next line, the next
command makes the value of I
increment (go up) until it reaches
23 what this does is move the
cursor down the screen 24 lines so
the next line printed is at the
bottom of the screen
* 109 REMark
* 110 B=1504 this command sets B to a
value of 1504 this is the 13th row
down the screen (see screen MAP)
c=20 sets the value of C to 20 used
to place the ship 20 characters
from the left of the screen (centre
of the screen as the Commodore 64
has 40 columns across)
* 111-112 REMarks
* 120 This command sets the value of
a to a integer or whole number
between 0 and 39 this is used later
to place the dots on screen in a
random location across the screen
* 121- 123 REMarks
* line 130 the value 1984 is the
start of the C64{SHIFT-*}s bottom row so at
the start of the bottom row plus
the value of A (that is a random
value assigned in line 120 ,46 this
prints the character 46 a . on the
screen in a random location on the
bottom row
* 131-134 REMARKS
* 140 This generates a random
floating point number (less than 1)
sets the value of P to a whole
number between 0 and 39 and then
places the * character (42) on the
screen location value of P+1984
(bottom row) Experiment with the
number 42 if you use the value 36 a
$ (dollar) symbol will be printed
on screen
* 141-149 REMarks
* 150 the Command GETA$ checks the
keyboard for a key press if that
key press is Z and the value of C
is greater than 0 (so not less than
the screen starting column they are
0 to 39) then a character is placed
on screen at B+C then the character
32 (a SPACE) is printed on screen
and C is equal to c -1 as we have
moved our ship one place across the
screen to the left
* 160 Similar to 150 if the key is a
M and c is less than 40 (the end
column value as the c64 has 40
characters across the screen and 25
down) then place a 32 (or SPACE in
the value) and we have moved so we
need to increment the value of C by
1 we moved right 1 character
* 161-162 REMarks
* 170 this prints a SPACE remember
the value of 32 on screen at our
last location
* 175 simply prints nothing with a
carriage return what this does is
move the screen up a line as we are
on the last line so the screen
scrolls (or jump scrolls 1 line)
* 178-179 REMarks
* 180 the peek command LOOKS at a
value of memory in this case its
the value of B+C if the value is 42
(that's a * or an asteroid) they
your have crashed and the game ends
it does this by going to line 310
* 189 REMark
* 190 we check the value of the
memory location B+C with the PEEK
command if its a value of 46 we
make the program temporarily move
its sequence somewhere else this
needs a RETURN to take us back. the
value 46 is a . and so we hit a
fuel pod we need to add some points
to the placers score
* 193-194 REMarks
* 195 We better put a ship on screen
so we can move it this is done by
Poking or placing the Value 22 or
the character V at location B+C (
you see maths and algebra do
actually have a use, I wish I was
more awake at school now)
* 300 GOTO or make the program move
back to line number 120 and that
you remember starts all over again
with printing random * asteroids
and . Fuel pods
* 309 REMark
* 310 Prints character 147 or a clear
screen code
* 320 prints or places the text
between the quote marks "" on
screen
* 330 prints or places the text
between the quote marks "" on
screen the value S is a variable
you see it has no quote marks so as
the value of S is a number it
prints this number on screen.
* 331 prints a blank line
* 332 END this stops the program and
returns you back to basic
* 339 REMark
* 400 ok this is another loop it
increments the value of I from 0 or
back to 16 well the c64 has only 16
colours and 0 to 16 makes 17 so 16
is actually printed as black again
this ensures the screen stays black
as we continue this value is poked
or placed into the location 53280
(the commodore 64{SHIFT-*}s border) and
RETURN makes the program go back to
the line after the GOSUB command so
this line makes the border flash
all 15 colours and the 16 makes the
screen go black try changing the
value from 0 to 5 see what happens
:-)
=====================================