Under the Microscope: Battle Garegga

It’s well known that Battle Garegga, the innovative shoot-em-up from Eighting/Raizing, recognizes a cheat code. Here’s how GameFAQs describes it:

Access a Mahou Daisakusen character: At the title screen press Up, Up, Down, Down, Left, Right, Left, Right, A, B, C, Start.

This works — putting in that code makes the extra four ships from Mahou Daisakusen (a previous Raizing game) available:

The ship select screen after entering the code.


However, you don’t need a cheat code for this! You can turn on Guest Players in the Option menu to achieve the same goal.

The English options menu.

This code isn’t useless, however. It has another effect, one that’s gone unnoticed for nearly 30 years…


Special formations

In Battle Garegga, some enemies will drop a green “Options” item when they’re defeated:

The Options item

If you collect these items, smaller planes will start flying alongside your ship, shooting at enemies for you. You can adjust where these planes fly by pressing C — this changes their formation.

There are four special formations that aren’t normally accessible. To activate them, you have to “miss” items — avoid collecting them by letting them fall to the bottom of the screen. Do this five times for a particular item type, and you’ll get one of the extra formations when you pick up Options item.

The cheat code above allows you to skip all this “missing” business. Pause the game and press A, B, A, B, X, A, B. The next Option item you collect will activate the special Wide formation.

Here’s how shmups.wiki describes that formation:

Options in the wide formation provide wider coverage than the standard spread formation, being aimed nearly horizontally.

Left: The standard formation. Right: The Wide formation.

Pause the game and press A, B, A, B, Y, A, B to make your next Option item activate the special Homing formation.

Options in the homing formation will automatically fly across the screen to shoot enemies from point-blank range.

The Homing formation in action.

Pause and enter A, B, A, B, Z, A, B to make the next Option item activate the Search formation.

Options in the search formation will automatically rotate in place to aim at enemies on screen.

The Search formation in action.

The last code is A, B, A, B, R, A, B. Enter that on the pause screen to make the next Option item activate the Shadow formation.

Options in the shadow formation will follow the player ship while shooting straight up, similar to the options in Gradius.

The Shadow formation in action.

There are two more special formations: Chain and Rolling. These are exclusive to multiplayer mode, and there aren’t shortcut codes for them.


Technical details

Like many games, Battle Garegga detects cheat codes by keeping a log of recent button presses. When you’re on the title screen, pressing buttons updates the buffer at 060b0092. Each button is represented by a 1 byte value: Up is 0x01, Down is 0x02, etc.

It’s first-in-first-out — each new entry pushes the previous ones toward the end of the buffer. The buffer holds 11 items, just enough for the Guest Players code above.

The Mednafen emulator’s debugger showing the cheat code buffer. The earliest button press is in the last position.

The function at 06040b24 reads this buffer and compares it to the Guest Players code. Because of the first-in-first-out ordering, the code is stored backward:

| Address  | Value | Button |
|----------|-------|--------|
| 06040b9c | 0x40  | C      |
| 06040b9d | 0x20  | B      |
| 06040b9e | 0x10  | A      |
| 06040b9f | 0x08  | Right  |
| 06040ba0 | 0x04  | Left   |
| 06040ba1 | 0x08  | Right  |
| 06040ba2 | 0x04  | Left   |
| 06040ba3 | 0x02  | Down   |
| 06040ba4 | 0x02  | Down   |
| 06040ba5 | 0x01  | Up     |
| 06040ba6 | 0x01  | Up     |

If it detects a match, the value at 0601ad34 winds up getting changed from 0 to -1. Call this the “cheat gate.”

When the code that handles input on the pause screen runs, it checks this cheat gate. If it’s 0, it returns early. If it’s not, it calls the function at 0602bb0c four times. This function reads the button buffer described above, and compares it to the additional button sequences.

Entering the one of the A, B, A, B, ?, A, B codes sets the “missed” counter for each item type to 5. This makes it so that the next Option item you collect activates a special formation.


Outro

Many thanks to trap15 for pointing me toward the special Option formations. Thanks also to CryingBaron, who wrote the shmups.wiki descriptions of the formations.

I’ll be back again next week. In the meantime, you can read more Under the Microscope articles in the archive.

About the author

Bo Bayles

Rings of Saturn: 32bits.substack.com

Be the first to comment

Leave a comment

Your email address will not be published.


*