Repair Notes‎ > ‎

After Burner II Silent Attract Mode

posted Dec 28, 2010, 2:07 PM by super technoboy   [ updated Jan 19, 2011, 5:05 PM ]
Call me strange, but I like to have all of my games set for a silent attract mode. I really like having the machines running when I’m there to see them, but sometimes I listen to music or watch TV, and the attract sounds become annoying pretty fast.

Most games have settings through the DIP switches to allow the attract mode sounds to be turned off. In fact, the original Afterburner did have this option. Somewhere between Afterburner I and II the option was lost, and now the attract sounds are permanent. Unless you write a ROM hack!

The most important part of this process for me was becoming familiar with MAME’s debug mode. When MAME is started with the -debug option, a screen like the one below will appear. I’ve annotated some of the important parts of the window. The debugger allows real-time analysis of the code as the game is running, allowing you to pinpoint sections of code fairly quickly.



Finding what you’re looking for requires the use of breakpoints and watchpoints. Breakpoints are used to halt execution at a certain line. Entering the debugger command bp 7e4e, for instance, will stop the code whenever it attempts to execute line 7e4e. Watchpoints are used to determine when specific memory locations are written to or read from. Entering the command wp ff890,1,rw will look at the memory range ff890-ff891 for any data read or written, and will halt execution at the command after the read or write occurs.

For the Afterburner II Silent Attract Mode, I started with the Afterburner’s sound diagnostic screen to locate the sound routines. I could see one of the data registers change when I pressed the key to generate a sound. Looking for program instructions that read that register led me to the memory location that stores the sound command, which is passed to the Z80 that handles the sound on Afterburner. The memory location is ff890c-ff892c, so I can enter wp ff890c,20,w to create a watchpoint that will halt execution whenever the program writes to this location. Now I can run the attract mode to find all of the lines that pass sound data.

After a little digging, I found out that the memory location 29c09c stores a value that corresponds to the state the game is in. Some of the states are shown below.

State
Description
0
attract reset
1
attract plane flying
2-3
attract best fighters
4-5
attract photos/instructions
6-B
attract planes shooting logo
C-D
credit
E-F
takeoff
10
gameplay
17-18
game over
19-1Abest fighters
 
In the sound routine, there is an instruction that mutes the game during the attract plane flying sequence that looks like this:

Line
Instruction
Hex Encoding
00b854
cmpi.w #$1, $29c09c.l
0c79 0001 0029 c09c
00b85c
beq $b884
6700 0026

Line b854 says compare the value from 29c09c (the game state) to 1, and line b85c says if they’re equal goto (branch to) line b884, which skips loading the sound to memory.

What I want to do is mute the sound for game states 0 through B from the table above, so I want it to read:

Line
Instruction
Hex Encoding
00b854
cmpi.w #$b, $29c09c.l
0c79 000b 0029 c09c
00b85c
ble $b884
6f00 0026

Now line b854 says compare the value from 29c09c (the game state) to b, and line b85c says if it’s less than or equal, goto line b884.

So all I need to do is change a 1 to a b and a 7 to an f, but there is one final complication. The 68000 uses two ROMS that are interleaved to store the program. The beq command shown above encodes into the two ROMs like this:

ROM 11107
                    67 00 00 26
ROM 11108

In order to find the correct line to modify in the ROM, the line numbers need to be divided by two with a hex calculator. A table showing the locations is below.

ROM
Program Line
ROM Line
Old Hex 
New Hex
11108
b854
5c2a 
79 01
79 0b 
11107
b85c
5c2e 
67 00 
6f 00 

That’s it! The modified ROMs can be burned with an EPROM programmer or by a service like hobbyroms.com, and then installed in place of the originals (the chip type is NEC 27C1000).  Now Afterburner II is nice and quiet, until you drop a quarter! Download ROM patch files for Silent Attract Mode.
Comments