A downloadable game



  2021 BASIC 10 Liner Submission

  By David A. Gershman - @dagershman


Ka-Boomer is a game which pays homeage to the 'ol Atari 2600 game

"KaBoom!".  The name variation, "Boomer", is proof this version was

written by an "older" person. :)


Submission Contents


kaboomer.txt    : This info file.

kaboomer.d64    : Commodore d64 disk image for use with emulator.


                : Animated .gif of a sample game load and play


                : Screenshot of the typed program showing 80chars/line

  max. (Note: Line 1 has a typo of '[' instead of ':'

  thanks to fat fingers on a Mac keyboard.  The char

  is inside a string so does not affect game play.

  D64 image contains a corrected version of the



Play Instructions


** Play Options **

Upon executing the program, the user is prompted for the "Time

Limit".  This is the amount of seconds the user wishes to play.  30

seconds is a good value for first-time players.

The next prompt is the "Sparcity" of bombs ranging from .1 to .9.  .1

is hardly any bombs and .9 is a bomb on virtually every line.

Once these values are entered, your "bucket" is put at the top of the

screen and play begins.  Bombs start flowing up to your bucket which

you need to catch.  Time does not start counting down until the screen

starts actually scrolling.

The object is to "catch" as many bombs as you can within the time

limit you provided.

** Bucket Movement **

The bucket can be moved by using numbers 1-6 with 1 being all the way

on the left and 6 being all the way on the right.

Alternatively, the user may use the joystick in port 2 to move the

bucket left or right.

The difference is the joystick moves the bucket in increments of 1

while the numbers put the bucket directly in a specific position.

Both methods may be used during game play.

** Game Completion **

After time is up, the screen clears except for the last line and you

are presented with the number of bombs you caught out of the total

number of bombs displayed.  Finally, you are prompted to play again or



Program Listing


0 a$=chr$(13):print"{clr}{white}"spc(15)"ka-boomer"a$a$"time limit(sec)  :";:inputtl:print"spars";
1 print"ity (.1-.9):";:inputf:p(0)=8:fori=1to6:p(i)=p(i-1)+24:next:y=56320:b=53248:z=0
2 fori=3072to3077:readx:pokei,x:next:fori=3078to3135:pokei,0:next:pokeb+39,1:poke2040,48
3 pokeb,p(1):pokeb+1,50:pokeb+21,1:j(4)=-1:j(8)=1:restore:print"{clr}{down}":pokeb+32,z:pokeb+33,z:g=0:i=1
4 j=(127-peek(y))and12:i=i+j(j):i=-(i>=1andi<=6)*i+-(i>6)*6+-(i<1):getn:ifntheni=n
5 pokeb,p(i):print"{white}{CBM-B}{red}";:x=int(rnd(ti)*18):ifpeek(214)<23thenti$="000000"
6 printspc(x+1);:if(rnd(0)<f)thenprint"{left}!";:s=s+1
7 printspc(17-x);:t=tl-int(ti/60):g=g-(peek(b+31)>0):print"{white}{RVSON}{CBM-B}{RVSOFF}{cyan} t:"t" pts:"g:ift>0then4
8 fori=1to22:print:nexti:print"{white}final score: "g"/"s:pokeb+21,0:print"play again [y/n]?";
9 poke198,0:wait198,1:geta$:ifa$="y"thenclr:goto0:data127,255,254,255,0,255


Program Explanation



** Line 0 **



  Typing this program in Linux and using VICE's /petcat/ tool allows

  the use of certain terms, such as "{return}" to include carriage

  returns in strings.  However, when typing the program in the

  emulator, there is no way to insert a carriage return in a string.

  Instead I had to assign chr$(13) to a variable and then use the

  variable in the string later.


print"{clr}{white}"spc(15)"ka-boomer"a$a$"time limit(sec)  :";

  Display the centered title and prompt the user for the time limit.



  Read in the time limit.


  Maximizing character usage per line sometimes requires breaking up

  strings into pieces on different lines. This is the first part of

  the "Sparsity:..." prompt.


** Line 1 **


print"ity (.1-.9):";

  Finish printing the "Sparsity..." prompt


  Read in the sparsity factor.


  The p-array holds the bucket sprite's possible x-positions. I only

  use positions 1-6 but initialize 0 to 8 in preparation of the next

  'for' loop.  In retrospect, I would need this if I initialize p(1)

  and loop from 2 to 6 in the next part.


  Initialize the p-array to the bucket sprite's possible x-positions.

  Later, I'll manipulate a variable which will be the index for the

  array to position the bucket.


  Prep for fewer chars later by setting some variables.  'y' is the

  register for Joystick Port #2, 'b' is the start of the Spring VICII

  addresses, and 'z' *was* used for screen/background colors. However,

  I decided to keep both black and thus don't need 'z' either. :(

  (Amazing what you find when you make this writeup at 11:30pm.)


** Line 2 **



  Load first 6 bytes of sprite #0 to "draw" the bucket.


  Clear the rest of the sprite leaving just the bucket.


  Set sprite #0's color to white.


  Set sprite #0's pointer to the data.


** Line 3 **



  Set sprite #0's x-coord to the left most position.


  Set sprite #0's y-coord.


  Turn on sprite #0.


  The joystick register will clear bit *values* 4 and 8 depending on

  if pushed left or right, respectively.  This sets the j-array

  positions 4 and 8 to the increment adjustment values for the p-array

  when setting the buckets new x-position.


  This line had space to reset the data in case the user will want to

  play again on the same execution.


  Clear the screen in preparation for game play and move the cursor

  down so the first bomb won't count as a collision (giving a point)

  right away.


  Set the border/background colors to black.  Since I don't change

  either during game play, this is why the 'z' variable is not needed

  and I could have just hard coded 0 (or even period).


  Initialize 'g' to 0 which will accumulate the number of bombs




  Initialize 'i' to 1 which will be used to index the p-array (the

  bucket position 1-6).


** Line 4 **



  "peek(y)" is the current value of the Joystick #2 register.

  Unfortunately, that registers is 127 by default (0111111) and

  *clears* the bits when the joystick is moved in a direction.  For

  example, left would result in 0111011.  Substracting from 127,

  "flips the bits" to 1000100.  ANDing with 12, masks out only the

  bits for left and right movement.  Thus 'j' is set to 4 if the

  joystick is pressed left, or 8 if the joystick is pressed right.  If

  the joystick is not touched, the result in 0.


  Update the index for the p-array by the amount of the increment

  pointed to by the Joystick movement.  If 4 (left), j(4) is -1, so

  the index variable 'i' is "moved left".  If 8 (right), j(8) is 1, so

  the index variable 'i' is "moved right".  If the joystick is not

  touched, 'j' will be 0 and j(0) is 0, so 'i' won't be changed.


  Adjusts the index variable, if necessary, to the p-array to ensure

  its value stays between 1 and 6.


  Check to see if a number was pressed.


  If so, then the index variable gets set to that.  Thus, the keyboard

  numbers get priority over the joystick, BUT does still allow either

  methods for game play.


** Line 5 **



  Once the appropriate x-position (index value) is determined, set

  sprite #0's new position.


  Print the left border wall and set color for the bomb.


  Compute random position on the line for the bomb.


  Keep the clock at 0 until the screen is full of bombs and they start

  to actually scroll.


** Line 6 **



  Space over to where the bomb MAY go.  For now, print a space as if

  the bomb WON'T be placed.


  Get a random number between 0 and 1 and if it is less than the

  factor the user requested, then move back 1 position and print the

  bomb.  Else, the bomb is skipped.


  Remember, BASICv2 does *not* have an 'else'.  So this portion is

  only performed if the bomb was printed.  So this variable, s, will

  track the total number of bombs displayed so when the score is shown

  at the end, we know how many total bombs were displayed.


** Line 7 **



  Finish printing the spaces of the line holding the (possible) bomb.


  Compute the remaining time of the game.


  Increment player's score if the bucket sprite #0 collided with the

  background (i.e. a bomb).

print"{white}{RVSON}{CBM-B}{RVSOFF}{cyan} t:"t" pts:"g

  Display the right wall, time remaining, and current points.


  If there's still time in the game, go back and check the

  joystick/keyboard again.


** Line 8 **



  Scroll the game up to clear the screen except the last line.

  Another retrospect...don't need 'i' in "next i". :(

print"{white}final score: "g"/"s

  Display the final score out of the total number of bombs.


  Turn off bucket sprite #0

print"play again [y/n]?";

  Prompt the user if they want to play again.


** Line 9 **



  Clear the keyboard buffer and wait for an answer to the "Play again"



  Get the answer and if 'y', then go play again.  Final

  retrospect..."clr" is left over from when I had a dim'd array at the

  beginning.  Without 'clr', I'd get a "redim" error when the user

  wanted to play again.  I ended up removing the dim'd array but

  forgot to remove 'clr'.  This line could have been shorter. :(


  Data for bucket sprite.

Install instructions

Emulator Usage/Loading/Execution


Kaboomer was developed on a Linux host using the VICE C64 Emulator

('x64' binary).  To execute the program, it is presumed the

reader/user has knowledge of VICE and mounting of .d64 images.

To run the program, the reader/user must mount the provided .d64 file

using the VICE emulator running the "x64" binary.

After mounting the disk, issue the following commands:

    load "*",8 <ENTER>

followed by

    run <ENTER>


kaboomer.d64 170 kB
kaboomer.txt 11 kB

Leave a comment

Log in with itch.io to leave a comment.