Gauntlet II BUGFIX submission
Posted: Tue Dec 01, 2026 8:29 pm
To whom it may concern:
I have emailed the mame team (code@mamedev.org) about an "unofficial" bugfix submission to fix two very serious and longstanding bugs in Gauntlet 2. I am Falkentyne, the author of the Gauntlet 2 FAQ on gamefaqs, and have had contact with Eric Crabill (EE, AMD, Standford etc), who was the first person who dumped the ROMS into the wild in the early 1990's. He is aware of this effort (just reached out to him last week!), although obviously no longer has a machine (was sold many years ago), he suggested I post here for the MAME team, and on atariage, which I have now done.
Before this, I contacted original programmer Bob Flanagan (I could not find how to reach Ed Logg anywhere) several years back, asking if he could look into the (Fight power) bug, but he said he doesn't have the rights to the game anymore and the compiler and disassembler enviroment is no longer available. Now thanks to that useful tool called Claude, I was able to get the two serious bugs fixed and fully playtested. I would like them to be considered to be released into a "Hack" entry for Gauntlet 2, which would pass MAME's sha hash verification (although obviously the machine would complain about a ROM error before launching to attract mode). Of course, MAME works fine with these replaced roms as is, although the warning appears, and MAMEUI won't load with any ROM that does not pass verification (CMD line version is needed).
--------------------------------------------------
I already emailed mamedev with the 4 patched ROMS that are changed for this bugfix.
=====================================================================
PART A - THE TWO "OFFICIAL" BUG FIXES (Gauntlet II, MAME set gaunt2)
=====================================================================
1. FIGHT POWER DEPENDS ON PLAYER COLOR (should depend on character)
-------------------------------------------------------------------
How a melee hit works: damage = base[class, potion] + random(range)
Base value (table at CPU 0x5B7D4, index = class, +4 with Extra Fight Power):
normal with Extra Fight Power
Warrior 2 3
Valkyrie 2 3
Wizard 1 2
Elf 1 2
Random extra: the "range" value 2 means the hit adds 0 or 1 on top of the base.
A range of 0 means no random extra.
The bug: the range value was looked up by player SLOT (color) instead of by
class. Stock table (originally at 0x5B7E4): Red 0, Blue 0, Yellow 0, Green 2,
and the Extra Fight Power state did not change it. Result in the stock ROM:
- The Green player always gets the random extra, whatever the character is
(even Valkyrie and Wizard).
- Red, Blue and Yellow never get it, whatever the character is (even Warrior
and Elf).
Intended values (as reported by Falkentyne), the same on every color:
normal with Extra Fight Power
Warrior 2x to 3x 3x
Valkyrie 2x 3x
Wizard 1x 2x
Elf 1x to 2x 2x to 3x
The fix: the range lookup now uses the class index (class, +4 with the potion)
that the routine already computed for the base table (register D4) instead of
the player slot (D3), and the table was moved to unused ROM space at CPU 0x55620.
New table, 8 words, index = class (+4 with Extra Fight Power):
index: 0 Warrior 1 Valkyrie 2 Wizard 3 Elf
normal: 2 0 0 2
with potion: 0 0 0 2
(index 4..7 = Warrior, Valkyrie, Wizard, Elf with Extra Fight Power)
Resulting damage = base + random(range):
Warrior normal 2 + (0..1) = 2-3 potion 3 + 0 = 3
Valkyrie normal 2 + 0 = 2 potion 3 + 0 = 3
Wizard normal 1 + 0 = 1 potion 2 + 0 = 2
Elf normal 1 + (0..1) = 1-2 potion 2 + (0..1) = 2-3
Patched bytes (CPU address, old -> new), chips 136043-1121.6a / 136043-1122.6b:
0x523E5 03 -> 04 (move.w d3,d0 -> move.w d4,d0)
0x523EC B7 -> 56 and 0x523ED E4 -> 20 (table address 0x5B7E4 -> 0x55620)
0x55620-0x5562F FF x16 -> 00 02 00 00 00 00 00 02 00 00 00 00 00 00 00 02
Only one place in the ROM uses each of the two tables. (19 bytes changed.)
Found by comparing an instruction trace of a melee hit (green Wizard vs a level
3 grunt) with RAM from MAME save states; the routine is near 0x52192.
2. SECRET ROOM: THE INVENTORY SAVE SLOTS OVERLAP OTHER VARIABLES
-----------------------------------------------------------------
Symptoms (Falkentyne):
a) After leaving a secret room the key count equals the keys carried in plus
the game's rank value (rank 128 gives +128 keys, rank 255 gives +255).
b) A player who joins later, especially Red, sometimes starts with keys that
were never picked up.
c) The rank value is destroyed (it later recovers in some cases).
d) The potions the player carried were not restored correctly, and Red's key
count could be overwritten.
Cause: when a player enters the room (routine near 0x482BC) the game copies that
player's keys, potions and a third per-player byte into three save slots and
clears the player's own entries; on leaving (near 0x4D870) it adds the saved
values back. The three arrays are per player slot, 5 bytes apart:
potions 0x904055 keys 0x90405A third array 0x905F68
but the save slots were read and written at index 5 of each array:
keys -> 0x90405F = the RANK variable
potions -> 0x90405A = Red's (slot 0's) KEY count
third -> 0x905F6D
So (1) the saved key count lived in the rank variable, and the rank routine at
0x48B58 (called when a room is entered) then added the rank into it; (2) the
saved potion count overwrote Red's key count and was never restored, so Red ended
up with keys equal to another player's potions, and if Red was the one entering,
his potions were lost and replaced by his key total.
The fix has two parts:
Part 1 (rank): the add into the rank byte at CPU 0x48BA6
(D1 39 00 90 40 5F = add.b d0,$90405F) is replaced by a call
(4E B9 00 05 56 40 = jsr $055640) to a small routine in unused ROM at
0x55640. The routine skips the add only while the "performed trick" byte
at 0x904063 holds 0-3 (a secret room being entered). Routine bytes:
4A39 00904063 6B0C 0C39 0004 00904063 6C02 4E75 D139 0090405F 4E75
Part 2 (save slots): the three save slots move to the unused byte at index 4
of each array: 0x90405E (keys), 0x904059 (potions), 0x905F6C (third).
Six single-byte operand changes in 136043-1110.7b:
CPU 0x482ED 5F->5E, 0x482FD 5A->59, 0x4830D 6D->6C,
0x4D87B 5F->5E, 0x4D88D 5A->59, 0x4D89F 6D->6C.
Bytes changed in total: 0x48BA6-0x48BAB (6 bytes, chips 1109.7a / 1110.7b),
the six operand bytes above, and the routine at 0x55640 (1121.6a / 1122.6b).
Nothing else in the ROM refers to those three bytes by address; indexed
accesses were not exhaustively checked.
Notes:
- In the stock ROM the "bonus keys" seen after a room were the rank value
added to the saved key count (symptom a). With the fix there is no such
bonus: a player who enters with 2 keys and 1 potion and picks up nothing
leaves with 2 keys and 1 potion (seen in play). Keys and potions picked up
inside the room are still kept.
- How to test any player without waiting for the trick (debugger, game
paused): set the byte at 0x904063 to the player slot (00 Red, 01 Blue,
02 Yellow, 03 Green) on a level above 6, resume and leave the level
normally. The game then sends that player to a secret room. This was
seen working for Green.
- Room time limit comes from the room type (0x50-0x5D, random): base time
in 1/60 s units from a table at 0x57360 plus a random 0 to (n-1) seconds
(table at 0x5737C). Base times range from 11 s to 22 s, so a short room
such as 12 s is normal.
- The third array (0x905F68) is saved and restored by the fix like the other
two. Its purpose is not confirmed. One use seen in the shot power routine
(near 0x4B002): if a player's entry in it is non-zero, shot power is set
to 3. This is a reading of the code, not tested.
- The HUD shows at most 12 icons (keys and potions combined). Potions beyond
that are held but not drawn. Seen in testing: 3 keys + 9 potions shown while
the real potion count was 12 (byte 0x904056 read 0x0C).
- During a secret room the rank byte reads 04 (a Wizard's base) and returns to
base + score rank after leaving. Why it reads 04 inside the room is not fully
understood; the guard is intended to block only the rank add.
*EDIT*. Claude raged at me for posting patched rom files so I am posting the IPS files for manual patching ONLY.
I have emailed the mame team (code@mamedev.org) about an "unofficial" bugfix submission to fix two very serious and longstanding bugs in Gauntlet 2. I am Falkentyne, the author of the Gauntlet 2 FAQ on gamefaqs, and have had contact with Eric Crabill (EE, AMD, Standford etc), who was the first person who dumped the ROMS into the wild in the early 1990's. He is aware of this effort (just reached out to him last week!), although obviously no longer has a machine (was sold many years ago), he suggested I post here for the MAME team, and on atariage, which I have now done.
Before this, I contacted original programmer Bob Flanagan (I could not find how to reach Ed Logg anywhere) several years back, asking if he could look into the (Fight power) bug, but he said he doesn't have the rights to the game anymore and the compiler and disassembler enviroment is no longer available. Now thanks to that useful tool called Claude, I was able to get the two serious bugs fixed and fully playtested. I would like them to be considered to be released into a "Hack" entry for Gauntlet 2, which would pass MAME's sha hash verification (although obviously the machine would complain about a ROM error before launching to attract mode). Of course, MAME works fine with these replaced roms as is, although the warning appears, and MAMEUI won't load with any ROM that does not pass verification (CMD line version is needed).
--------------------------------------------------
I already emailed mamedev with the 4 patched ROMS that are changed for this bugfix.
=====================================================================
PART A - THE TWO "OFFICIAL" BUG FIXES (Gauntlet II, MAME set gaunt2)
=====================================================================
1. FIGHT POWER DEPENDS ON PLAYER COLOR (should depend on character)
-------------------------------------------------------------------
How a melee hit works: damage = base[class, potion] + random(range)
Base value (table at CPU 0x5B7D4, index = class, +4 with Extra Fight Power):
normal with Extra Fight Power
Warrior 2 3
Valkyrie 2 3
Wizard 1 2
Elf 1 2
Random extra: the "range" value 2 means the hit adds 0 or 1 on top of the base.
A range of 0 means no random extra.
The bug: the range value was looked up by player SLOT (color) instead of by
class. Stock table (originally at 0x5B7E4): Red 0, Blue 0, Yellow 0, Green 2,
and the Extra Fight Power state did not change it. Result in the stock ROM:
- The Green player always gets the random extra, whatever the character is
(even Valkyrie and Wizard).
- Red, Blue and Yellow never get it, whatever the character is (even Warrior
and Elf).
Intended values (as reported by Falkentyne), the same on every color:
normal with Extra Fight Power
Warrior 2x to 3x 3x
Valkyrie 2x 3x
Wizard 1x 2x
Elf 1x to 2x 2x to 3x
The fix: the range lookup now uses the class index (class, +4 with the potion)
that the routine already computed for the base table (register D4) instead of
the player slot (D3), and the table was moved to unused ROM space at CPU 0x55620.
New table, 8 words, index = class (+4 with Extra Fight Power):
index: 0 Warrior 1 Valkyrie 2 Wizard 3 Elf
normal: 2 0 0 2
with potion: 0 0 0 2
(index 4..7 = Warrior, Valkyrie, Wizard, Elf with Extra Fight Power)
Resulting damage = base + random(range):
Warrior normal 2 + (0..1) = 2-3 potion 3 + 0 = 3
Valkyrie normal 2 + 0 = 2 potion 3 + 0 = 3
Wizard normal 1 + 0 = 1 potion 2 + 0 = 2
Elf normal 1 + (0..1) = 1-2 potion 2 + (0..1) = 2-3
Patched bytes (CPU address, old -> new), chips 136043-1121.6a / 136043-1122.6b:
0x523E5 03 -> 04 (move.w d3,d0 -> move.w d4,d0)
0x523EC B7 -> 56 and 0x523ED E4 -> 20 (table address 0x5B7E4 -> 0x55620)
0x55620-0x5562F FF x16 -> 00 02 00 00 00 00 00 02 00 00 00 00 00 00 00 02
Only one place in the ROM uses each of the two tables. (19 bytes changed.)
Found by comparing an instruction trace of a melee hit (green Wizard vs a level
3 grunt) with RAM from MAME save states; the routine is near 0x52192.
2. SECRET ROOM: THE INVENTORY SAVE SLOTS OVERLAP OTHER VARIABLES
-----------------------------------------------------------------
Symptoms (Falkentyne):
a) After leaving a secret room the key count equals the keys carried in plus
the game's rank value (rank 128 gives +128 keys, rank 255 gives +255).
b) A player who joins later, especially Red, sometimes starts with keys that
were never picked up.
c) The rank value is destroyed (it later recovers in some cases).
d) The potions the player carried were not restored correctly, and Red's key
count could be overwritten.
Cause: when a player enters the room (routine near 0x482BC) the game copies that
player's keys, potions and a third per-player byte into three save slots and
clears the player's own entries; on leaving (near 0x4D870) it adds the saved
values back. The three arrays are per player slot, 5 bytes apart:
potions 0x904055 keys 0x90405A third array 0x905F68
but the save slots were read and written at index 5 of each array:
keys -> 0x90405F = the RANK variable
potions -> 0x90405A = Red's (slot 0's) KEY count
third -> 0x905F6D
So (1) the saved key count lived in the rank variable, and the rank routine at
0x48B58 (called when a room is entered) then added the rank into it; (2) the
saved potion count overwrote Red's key count and was never restored, so Red ended
up with keys equal to another player's potions, and if Red was the one entering,
his potions were lost and replaced by his key total.
The fix has two parts:
Part 1 (rank): the add into the rank byte at CPU 0x48BA6
(D1 39 00 90 40 5F = add.b d0,$90405F) is replaced by a call
(4E B9 00 05 56 40 = jsr $055640) to a small routine in unused ROM at
0x55640. The routine skips the add only while the "performed trick" byte
at 0x904063 holds 0-3 (a secret room being entered). Routine bytes:
4A39 00904063 6B0C 0C39 0004 00904063 6C02 4E75 D139 0090405F 4E75
Part 2 (save slots): the three save slots move to the unused byte at index 4
of each array: 0x90405E (keys), 0x904059 (potions), 0x905F6C (third).
Six single-byte operand changes in 136043-1110.7b:
CPU 0x482ED 5F->5E, 0x482FD 5A->59, 0x4830D 6D->6C,
0x4D87B 5F->5E, 0x4D88D 5A->59, 0x4D89F 6D->6C.
Bytes changed in total: 0x48BA6-0x48BAB (6 bytes, chips 1109.7a / 1110.7b),
the six operand bytes above, and the routine at 0x55640 (1121.6a / 1122.6b).
Nothing else in the ROM refers to those three bytes by address; indexed
accesses were not exhaustively checked.
Notes:
- In the stock ROM the "bonus keys" seen after a room were the rank value
added to the saved key count (symptom a). With the fix there is no such
bonus: a player who enters with 2 keys and 1 potion and picks up nothing
leaves with 2 keys and 1 potion (seen in play). Keys and potions picked up
inside the room are still kept.
- How to test any player without waiting for the trick (debugger, game
paused): set the byte at 0x904063 to the player slot (00 Red, 01 Blue,
02 Yellow, 03 Green) on a level above 6, resume and leave the level
normally. The game then sends that player to a secret room. This was
seen working for Green.
- Room time limit comes from the room type (0x50-0x5D, random): base time
in 1/60 s units from a table at 0x57360 plus a random 0 to (n-1) seconds
(table at 0x5737C). Base times range from 11 s to 22 s, so a short room
such as 12 s is normal.
- The third array (0x905F68) is saved and restored by the fix like the other
two. Its purpose is not confirmed. One use seen in the shot power routine
(near 0x4B002): if a player's entry in it is non-zero, shot power is set
to 3. This is a reading of the code, not tested.
- The HUD shows at most 12 icons (keys and potions combined). Potions beyond
that are held but not drawn. Seen in testing: 3 keys + 9 potions shown while
the real potion count was 12 (byte 0x904056 read 0x0C).
- During a secret room the rank byte reads 04 (a Wizard's base) and returns to
base + score rank after leaving. Why it reads 04 inside the room is not fully
understood; the guard is intended to block only the rank add.
*EDIT*. Claude raged at me for posting patched rom files so I am posting the IPS files for manual patching ONLY.