Bomb Blaster

An Atari 8-bit game
Designed by William Kendrick (age 5)
Programmed by Bill Kendrick (papa)

July 2012


A few days back, my 5½ year old son William cut up some paper, drew symbols on them, flipped them over, made a logo, and said "do you want to play 'Bomb Blaster'?" The rules didn't make much sense, and was it basically a game of chance.

However I decided it'd be fun to whip up a computer game based on it, for his amusement. So after dinner the other night, I pondered some rules, fired up an Atari character set editor I had written for myself in BASIC in 1990, and did my best to reproduce his game's symbols.

Then, over the course of that evening, while ignoring a huge pile of laundry, and interrupted to help tend our infant son, I came up with an Atari version of my son's game, written in TurboBASIC XL:

Requirements

How to Play

Download

Code Breakdown

I used "detokenize.pl" to convert the TurboBASIC XL code to an ATASCII listing. (I should have used BASIC's "LIST "D:FILENAME.LST"" command, since I had to manually put back some TBXL-specific code that was missing).

Then I created a little HTML script to convert ATASCII text into HTML, using Unicode characters to represent some of the Atari graphical characters. And here's the code:

HTML ATASCII Viewer by Bill Kendrick, 2012-2013
Options:
Columns: 38 | 40 | Unlimited
Style: Unicode | Images | Images (2x) | Compute! listings








































































































































Set-Up, Title and Main Loop

  • 10-50 — Switch to large, colored text mode (10). Set some colors (15). Find a spot for a character set (20), load it (30-40), and switch to it (50).
  • 20-110 — Draw the title and credits.
  • 120 — Randomly flash one of the color palette spots red.
  • 130 — Wait until user presses FIRE or START
  • 140 — Wait until user releases FIRE (so they don't accidentally pick a cell)
  • 200-240 — Draw the game screen, including a 3x3 grid of "??" cells
  • 250 — Reset game: selection starts in the middle (1,1), no cells are uncovered, you have no money, and you don't have the good-guy bomb
  • 260 — Clear the cells; all cells are covered, nothing in the cells yet
  • 270 — Jump to subroutine at line 1000, which randomly fills the cells with objects
  • 280-285 — Draw a big dollar sign on the left side
  • 300-320 ‐ Highlight the cell the cursor is at
  • 350 — Capture state of the joystick and Fire button
  • 355 — Randomly flash one of the color palette spots red.
  • 360 — If joystick is not being moved, and Fire not being pressed, go back to 350
  • 400-420 — Unhighlight the cell the cursor is/was at
  • 500-530 — If the joystick was moved, move the cursor that direction
  • 535 — If the joystick is still being moved, wait until the user lets go (only move one cell at a time)
  • 540 — Play a sound effect, if the cursor was being moved. Then go bac to 300 and wait.
  • 600 — They pressed fire. If the cell was already uncovered, play a complaint sound effect, and go back to 300 and wait.
  • 610-650 — Uncover the cell (610), figure out what piece is there (620), draw the shape of the piece (630-640), and keep track of how may cells we've uncovered.
  • 700-720 — Do something, depending on what piece was uncovered.
  • 800 — If all 9 cells were uncovered, go to the Game Over subroutine, at line 10000. Then go back to 200 to start a new game.
  • 990 — Randomly flash one of the color palette spots red.
  • 999 — Go back to 300 and wait.

Subroutines

  • 1000: Randomly pick pieces
    • 1000-1040 — For the five money pieces (1000), pick a spot on the grid (1010), play a little sound while we 'think' (1015), and if the spot is taken, try again (1020), otherwise set the cell to a money piece (1030)
    • 1100-1140 — For the three bad-guy pirate bombs (1100), pick a spot on the grid (1110), play a little sound while we 'think' (1115), and if the spot is taken, try again (1120), otherwise set the cell to a bad-guy piece (1130)
    • 1150 — Stop playing sounds
    • 1200-1220 — There should be one clear ("-1") spot on the board. Place the good-guy bomb there.
  • 2000: Uncovered money piece
    • 2000 — Add money and play a 'ding!' sound three times
    • 2010 — Show how much money has been collected, under the big dollar sign on the left
  • 3000: Uncovered bad-guy pirate bomb
    • 3000 — Wipe out money!
    • 3010-3030 — Search all uncovered cells for money. When one is found, jump to subroutine at line 4000 to replace it with an explosion image.
    • 3040 — Erase the number underneath the big dollar sign on the left
  • 4000: Replace a money piece with an explosion (sub-subroutine!)
    • 4000 — Based on the cell number (0-8 for the 9 spots), determine the (x,y) position on the 3x3 grid.
    • 4010-4020 — Draw an explosion
  • 5000: Uncovered good-guy bomb
    • 5000 — Note that we have the good-guy bomb.
    • 5010-5020 — Draw the good-guy bomb on the right.
  • 10000: Game-over
    • 10000 — Write "Game Over" at the top.
    • 10005 — If user is still pressing Fire, wait until they release (so we don't dismiss the game-over screen immediately!)
    • 10010 — Randomly flash one of the color palette spots red.
    • 10011 — If you have all 5 money, the sound effect will go up in celebration; otherwise, it will go down.
    • 10015 — Avoid having sound pitch (and color) go negative.
    • 10016-10017 — Play a sound effect (with a little reverb effect, using two channels)
    • 10018 — If you have all 5 money, flash the background rainbow colors, in celebration!
    • 10019 — Avoid having sound pitch (and color) go above ~255.
    • 10020 — Keep doing all this until user press Fire or Start.
    • 10030 — Then wait until they let go of Fire or Start...
    • 10040 — End sound effects.

Note: Only a few TurboBASIC XL commands were used:

  • "BGET" command on line 40 to quickly load the font from disk into memory.
  • " MOD " operator on line 4000 to convert a cell position (0-8) into a grid X-position on the screen.
  • "IF {...}:{true}:ELSE:{false}:ENDIF" block on line 10011.

Font:

Here's a screenshot of the font:

Here are the characters I redefined:

#a + shape, for the grid
$%
&'
money
*+
,-
bad-guy pirate bomb
:a | shape, for the grid
;an explosion
=a – shape, for the grid
[\
]^
good-guy bomb

Note that in "GRAPHICS 2" mode on the Atari, only the first 64 characters of the character set are available. The second 64 appear as the first 64, but using a different color from the palette. Inverse-video is not supported, either. The high bit causes another pair of colors to be used. (e.g., the various colors of the character "!" can be made with: "!", Ctrl+A, Inverse-"!", and Inverse-Ctrl+A.)

So, for example, the Ctrl+D character (┫) in "P=ASC("┫")" is checking for a green-colored "$" character (part of the "$%&'" sequence used to make the large (2x2) dollar-sign symbol). The inverse-video ";" is the red-flashing one.


Back to New Breed Software. E-mail me.