Bally Alley

Hacking "Astro Battle" ("Space Invaders")

on the Bally Arcade/Astrocade

By Adam Trionfo
(March 3, 2020)

This article is made-up of several postings to the Bally Alley Yahoo discussion group from August 2011. The initial posting which kicked off the topic of hacking "Astro Battle" was made by Adam Trionfo, while other members of the discussion group, especially Lance Squire, added plenty of their own work to the threads that eventually sprang forth from the original topic of discussion.

This article does include a link to the Z80 disassembly of "Astro Battle" that was eventually posted to I'm sorry if this article seems a bit piece-meal, but I did my best to include the important information from the threads that took place on the Bally Alley discussion group in August 2011. I have wanted to post this as an article for nine years and I wanted to make it "perfect." I realize I don't have time for that to happen, so sometimes the tense in this article might seem a little "off." Also, if any information seems missing from this compiled article, then read the individual postings at (hopefully that won't be necessary).

Finally, note that the message numbers referenced in this article are the original Yahoo Group message numbers, which did not carry-over to when the messages were moved there in 2019.

Astro Battle Mod (Messages #10994 and #10996)
Astro Battle - Unmodified
 Astro Battle - Unmodified ROM

I've been disassembling the Bally/Astrocade cartridge "Astro Battle" (originally called "Space Invaders") and I made a few easy modifications to the game. The 4K cartridge ROM image that I modified is here:

This ROM image can be played in the Astrocade emulator included in MAME or burned to an EPROM and played on real hardware. This is probably not the final version of the mod-- I just wanted to share what I've done so far. Here are the few changes I made to the game:

  1. When you start the game, there is no longer a menu to select difficulty. The game automatically skips that menu and starts on "Professional." I just simply changed the two-byte word in the Menu Structure at $2005 from $2007 (where the Difficulty Menu is located in cartridge ROM) to $2015 (where the difficult game begins). Who is playing the game on the "Novice" level, anyway?
  2. I removed the Bunkers. I did this the cheap and dirty way by removing the graphics for them. The code to "build" them is still in the game. So, if you want to modify the graphics, the bunkers are located at $29A7-$29E7. They are 5 bytes wide by 13 lines high (65 bytes total).
  3. My biggest pet peeve about this game is that when a game ends, the game goes back to the main menu. What's the point of that? Originally, at the end of a game the On-Board ROM's System Sentry is looking for a key press (on any key) or a pull on the trigger to return to the main menu (it actually jumps to On-Board ROM location $0000-- so it totally starts over). Now, instead of doing a warm reset, the game just starts the difficult game over again. It would have been very easy to clear the screen and then re-display the difficulty menu. There is plenty of ROM available for that small change, so I'm not sure why it wasn't done this way.
Astro Battle - Hacked; Bunkers Removed
 Astro Battle - Bunkers Removed

I disassembled this game using a little bit of my brains, the DZ80 disassembler, the Nutting Manual, and Richard Degler's BallyHVG.LUA dissassembly script (which automatically disassembles the on-board routines-- a true time saver).

I'd like to fix the "bug" when the game ends at the beginning of level 7 because the Invaders automatically land. Of course, this isn't a bug at all-- the game was designed to play this way-- I'm just not sure why the change was made to a game that an excellent player could normally have played nearly forever.

While I think some systems, like the Atari 2600, have too many game mods, there just aren't enough for the Astrocade. Pick a game you like, pour through it, make a few changes and then share it. You just might learn something along the way (I know that I am learning every step of the way). I hope that this article inspires you to have fun making changes and game modifications!

After I made this initial posting to the discussion group, Lance Squire asked me, "[Is there] any chance of seeing the original code? (or modified...)"

I'm still working on it. I've only put in about, hmm, maybe 10-12 good hours. That might seem like a lot, but it's not. It's an especially short amount of time when the game probably took several months to create. My guess is that the game took about six months to make, as that was about the right amount of time to create a game in 1980 or so.

I still have plenty of areas of the "Astro Battle" Z80 disassembly that are just defined as bytes. When it is presentable, then I'll upload the code or at least share it with people.

Lance Squire said to me, "I have always wanted to fix the level 7 end, and am quite willing to help in the effort."

Since I'm actually disassembling the code I'm beginning to figure-out where some stuff is held in RAM. I'm guessing that it's just a matter of finding which byte holds the level number. There is probably a check that drops the invaders lower on each level. I've got to find this check and then figure-out what will work best. I suppose not lowering the invaders anymore than they are on level 6 would be sufficient. Finding information like this isn't too hard when you use the debugger included in MAME. Unfortunately, I'm not an expert with the debugger... but I can usually fumble around enough to get the job done.

A few things got me started on this little project:

  1. I wanted to figure-out how Sentry works (it's a set of On-Board ROM subroutines). I first started disassembling "Seawolf/Missile." It did teach me a lot, but I didn't finish disassembling that game because, quite frankly, it's pretty boring to play (and I was playing it a lot in MAME). "Astro Battle" is much more fun, plus it has some quirks that have always bugged me-- some of which I already fixed in the quick mod I created and posted earlier today.
  2. I want to actually learn to program the Z80. "One of these days" I'd like to make a short little demo, something along the lines of Lance's "Christmas Demo," which is really cool.
Astro Battle 'Lives' Cheat/Hack (Message #10998)

I'm still disassembling "Astro Battle." I found the RAM location for the number of player bases (aka "lives"). The number of player's lives are stored in RAM at $4E6F. However, that isn't too useful to you. In order to change the "Astro Battle" ROM to have more lives when the game starts, then you need to change the ROM location on the cart where the lives are initialized.

Astro Battle in Hex Editor
 Astro Battle - 255 Lives!

The number of Bases is initialized to 3 at the beginning of the game. If you use a hex editor to change byte $2046 of the original unaltered Astro Battle' cartridge ROM image to another number, then that is the number of bases that you will start with. This is a BCD number, so there is no need to convert the number of lives you want to decimal first. If you want 99 lives, then enter $99 at location $2046. Simple...

...except that I guess that the programmers didn't expect anyone to get more than 99 lives. You actually can enter a number up to 255 (entered as $FF), but the display on screen will get "funny" symbols. If you're familiar with "Super Mario Bros" on the NES when you get a lot of lives, then think along those lines... except this was intentional (in a way).

Astro Battle - 255 Lives!
 Astro Battle - 255 Lives!

The number of bases displayed at the top of the screen uses an On-Board subroutine called DISNUM (Display BCD Number). The routine works great for numbers that are 99 or less and it actually doesn't "break" for numbers above that. The original programmers of the Bally ROM actually use displayable characters for numbers 100-255, but you'll have to interpret them. Here's how to understand the number of bases if it is more than 99 (100-255).

The DISNUM routine displays the standard BCD codes 0 through 9. In addition, the codes $A through $F are also defined. The interpretation for these codes are:

          A = *     B = +     C = '
          D = -     E = .     F = /

Let's say that you set you're number of initial lives to 255 ($FF). When $FF is displayed on-screen you will see number of bases displayed as "//". When you lose a life, then you will have 254 left, which is displayed as "/." and on and on down to 99 bases which will then be displayed as normal. Neat, huh?

So, get in there and cheat and get the highest score that you (or maybe anyone) has ever had for "Astro Battle!"

Astro Battle Scoring (Messages #10999 and #11013)

The disassembly of "Astro Battle" has taught me that the max score is 9,999 points before the game flips over. That's not a very high score. The score is stored in RAM at $4E6C and $4E6D. To set points to max of 9,999, use a hex editor and set bytes $2050-$2051 to $9999. You can also set the score above that and the initial display will show a score with the "funny" symbols (as it does with more than 99 "lives").

For instance a score of $AAAA will display as ****. However, as soon as you get more points, then the score returns to normal digits. But not the correct digits. I can't figure-out the math. A score of AAAA + 10 points equals 1,120 points. I don't understand where that screwy score comes from, but the game is consistent about it. When I understand how points are awarded, then maybe I can see why the score is weird.

Also, 9,999 points isn't that low before the game's score flips over. The designer clearly knew that the player could never reach that top score, so it didn't matter if it was 9,999 points or a million points. I think that the max the player can ever truly score is about 8,400 points. That's clearing six levels (for 4,800 points) and destroying two UFOs per level (for 300 points each). At the very beginning of wave 7 the player is totally destroyed by the aliens when they land. No matter how many bases are left, the game is over. It's possible to hit an alien or two before the game is over, but that would only award a few more points.

I had some scoring questions when I originally made this posting. If you read the full thread from August 2011, then you'll see that some people did post some answers to these questions, which were:

  1. When do UFOs appear, and how many appear per level?
  2. UFOs are worth a value of 100, 200 or 300. Is it random or does the player have some control?

Has anyone here scored in the realm of 8,400 points? If so, then you're an elite player!

Ken Lill wrote, "The conversion decimal must be somewhere in the code, that is why the A-F codes don't show up in normal play." I replied:

The DISNUM routine takes care of that code interpretation (see Nutting Manual, page 34).

For those who don't know, "legal" BCD codes are 0-9 and that's it.  You would never normally want any other codes in a BCD byte.  The reason is that BCD stands for Binary Coded Decimal and only work with decimal numbers.  When I count to ten or a hundred or a thousand I only use the ten numbers in our lovely decimal system.  I find it interesting that the DISNUM routine displays anything at all for values A-F.  I've written my own display routines and I've never taken these hex values into account because they are not legal.  That's just another reason why the people at Nutting Associates who wrote the Bally's On-Board ROM were real programmers.  The programmer's choice to display the six symbols *, +, ', -, . and / instead of A, B, C, D, E, F probably have a useful function with Bally/Astrocade programming which may be related to the Astrocade's on-board calculator, but I'm not sure if I'm right.

If you're curious to know more about the subject of BCD, then the Wikipedia article is probably a good overview:

Additional "Astro Battle" Hacking

While I was continuing my disassembly of "Astro Battle" in 2011, I needed some help from Bally/Astrocade programmers with several topics. I figured that many readers of the postings might be a little confused by my questions because I jumped right into the deep-end without many explanations. I figured that most readers needed to have some programming background on the Astrocade to understand what I was talking about when asking specific questions about programming the Astrocade. Rather than re-posting the information here, the original postings that were made to the BallyAlley Yahoo discussion group (which were all purged by Yahoo in 2019) can be read on the Astrocade discussion group at, here:

Lance Squire, an avid Astrocade user, made some hacks of "Astro Battle." His hacks of the game, as well as discussions of them by members of the group, can be downloaded here:

Astro Battle Z80 Disassembly
 Astro Battle Z80 Disassembly

The disassembly of "Astro Battle" that I began on August 1, 2011 continued for about two weeks. A "preliminary release" of the code was made in mid-August 2011. The disassembly is not considered finished and it may contain errors. It was released so that those who were curious could take a look at it and modify it if they wanted to make any of their own changes to the game.

Try playing the original "Astro Battle" and then giving some of these hacked versions of the game a try; you'll be glad that you gave the hacks a chance. Also, if you're so inclined, then try hacking the game yourself. You'll find that it's a fun and rewarding experience. Be sure to share any of your hacks with the Astrocade Bally Alley discussion group, as we would all love to play your modified version of "Astro Battle," or whichever other Astrocade game which you choose to modify.

-- A.T. Version 1.0 - March 3, 2020.

Return to Bally Arcade/Astrocade Machine Language Documentation