home *** CD-ROM | disk | FTP | other *** search
/ Commodore Free 37 / Commodore_Free_Issue_37_2010_Commodore_Computer_Club.d64 / code < prev    next >
Text File  |  2023-02-26  |  5KB  |  201 lines

  1.  
  2.  
  3.  
  4. Now for a full breakdown:
  5.  
  6. * lines 5-9 are just comments any
  7.   line stating with REM is a REMark
  8.   or comment and ignored by BASIC
  9.   however leaving these lines in
  10.   slows the program down.
  11.  
  12. * line 10 Assigns variables with
  13.   values, you notice A=0 B=A (A is
  14.   nothing and so on ) and A$"" any
  15.   variable ending with a $ is treated
  16.   as a text string so the quotes give
  17.   the value of no text
  18.  
  19. * 15-89 Remarks
  20.  
  21. * line 90 chr$(147) is a clear screen
  22.   code so this just prints a CLEAR
  23.   screen command poke 53280 is the
  24.   border colour and 0 is black so
  25.   turn the border black poke 53281 is
  26.   the screen and 0 is black so turn
  27.   the screen black poke 646 is the
  28.   screen or text colours 1 is white
  29.   so all characters are printed in
  30.   white
  31.  
  32. * line 100 There are 25 lines on a
  33.   Commodore 64 down the screen this
  34.   command sets i to Zero and prints
  35.   nothing on screen after the print
  36.   the Commodore does a carriage
  37.   return to the next line, the next
  38.   command makes the value of I
  39.   increment (go up) until it reaches
  40.   23 what this does is move the
  41.   cursor down the screen 24 lines so
  42.   the next line printed is at the
  43.   bottom of the screen
  44.  
  45. * 109 REMark
  46.  
  47. * 110 B=1504 this command sets B to a
  48.   value of 1504 this is the 13th row
  49.   down the screen (see screen MAP)
  50.   c=20 sets the value of C to 20 used
  51.   to place the ship 20 characters
  52.   from the left of the screen (centre
  53.   of the screen as the Commodore 64
  54.   has 40 columns across)
  55.  
  56. * 111-112 REMarks
  57.  
  58. * 120 This command sets the value of
  59.   a to a integer or whole number
  60.   between 0 and 39 this is used later
  61.   to place the dots on screen in a
  62.   random location across the screen
  63.  
  64. * 121- 123 REMarks
  65.  
  66. * line 130  the value 1984 is the
  67.   start of the C64{SHIFT-*}s bottom row so at
  68.   the start of the bottom row plus
  69.   the value of A (that is a random
  70.   value assigned in line 120 ,46 this
  71.   prints the character 46 a . on the
  72.   screen in a random location on the
  73.   bottom row
  74.  
  75. * 131-134 REMARKS
  76.  
  77. * 140 This generates a random
  78.   floating point number (less than 1)
  79.   sets the value of P to a whole
  80.   number between 0 and 39 and then
  81.   places the * character (42) on the
  82.   screen location value of P+1984
  83.   (bottom row)  Experiment with the
  84.   number 42 if you use the value 36 a
  85.   $ (dollar) symbol will be printed
  86.   on screen
  87.  
  88. * 141-149 REMarks
  89.  
  90. * 150  the Command GETA$ checks the
  91.   keyboard for a key press if that
  92.   key press is Z and the value of C
  93.   is greater than 0 (so not less than
  94.   the screen starting column they are
  95.   0 to 39) then a character is placed
  96.   on screen at B+C then the character
  97.   32 (a SPACE) is printed on screen
  98.   and C is equal to c -1 as we have
  99.   moved our ship one place across the
  100.   screen to the left
  101.  
  102. * 160 Similar to 150 if the key is a
  103.   M and c is less than 40 (the end
  104.   column value as the c64 has 40
  105.   characters across the screen and 25
  106.   down) then place a 32 (or SPACE in
  107.   the value)  and we have moved so we
  108.   need to increment the value of C by
  109.   1 we moved right 1 character
  110.  
  111. * 161-162 REMarks
  112.  
  113. * 170 this prints a SPACE remember
  114.   the value of 32 on screen at our
  115.   last location
  116.  
  117. * 175 simply prints nothing with a
  118.   carriage return what this does is
  119.   move the screen up a line as we are
  120.   on the last line so the screen
  121.   scrolls (or jump scrolls 1 line)
  122.  
  123. * 178-179 REMarks
  124.  
  125. * 180 the peek command LOOKS at a
  126.   value of memory in this case its
  127.   the value of B+C if the value is 42
  128.   (that's a * or an asteroid) they
  129.   your have crashed and the game ends
  130.   it does this by going to line 310
  131.  
  132. * 189 REMark
  133.  
  134. * 190 we check the value of the
  135.   memory location B+C with the PEEK
  136.   command if its a value of 46 we
  137.   make the program temporarily move
  138.   its sequence somewhere else this
  139.   needs a RETURN to take us back. the
  140.   value 46 is a . and so we hit a
  141.   fuel pod we need to add some points
  142.   to the placers score
  143.  
  144. * 193-194 REMarks
  145.  
  146. * 195  We better put a ship on screen
  147.   so we can move it this is done by
  148.   Poking or placing the Value 22 or
  149.   the character V at location B+C (
  150.   you see maths and algebra do
  151.   actually have a use, I wish I was
  152.   more awake at school now)
  153.  
  154. * 300 GOTO or make the program move
  155.   back to line number 120 and that
  156.   you remember starts all over again
  157.   with printing random * asteroids
  158.   and . Fuel pods
  159.  
  160. * 309 REMark
  161.  
  162. * 310 Prints character 147 or a clear
  163.   screen code
  164.  
  165. * 320 prints or places the text
  166.   between the quote marks "" on
  167.   screen
  168.  
  169. * 330  prints or places the text
  170.   between the quote marks "" on
  171.   screen the value S is a variable
  172.   you see it has no quote marks so as
  173.   the value of S is a number it
  174.   prints this number on screen.
  175.  
  176. * 331 prints a blank line
  177.  
  178. * 332 END this stops the program and
  179.   returns you back to basic
  180.  
  181. * 339 REMark
  182.  
  183. * 400 ok this is another loop it
  184.   increments the value of I from 0 or
  185.   back to 16 well the c64 has only 16
  186.   colours and 0 to 16 makes 17 so 16
  187.   is actually printed as black again
  188.   this ensures the screen stays black
  189.   as we continue this value is poked
  190.   or placed into the location 53280
  191.   (the commodore 64{SHIFT-*}s border)  and
  192.   RETURN makes the program go back to
  193.   the line after the GOSUB command so
  194.   this line makes the border flash
  195.   all 15 colours and the 16 makes the
  196.   screen go black try changing the
  197.   value from 0 to 5 see what happens
  198.   :-)
  199.  
  200. =====================================
  201.