raiden2cop.cpp: Fixed BCD overflow score bug in Godzilla [Angelo Salese]

(marked as working until otherwise proven, nw)
This commit is contained in:
angelosa 2016-06-15 22:58:15 +02:00
parent 9f214108eb
commit 48cc7ac304
4 changed files with 26 additions and 18 deletions

View File

@ -441,7 +441,7 @@ ROM_START( esha )
ROM_LOAD( "v.c6", 0x300, 0x100, CRC(7157ba22) SHA1(07355f30efe46196d216356eda48a59fc622e43f) ) ROM_LOAD( "v.c6", 0x300, 0x100, CRC(7157ba22) SHA1(07355f30efe46196d216356eda48a59fc622e43f) )
DISK_REGION( "laserdisc" ) DISK_REGION( "laserdisc" )
DISK_IMAGE_READONLY( "esh", 0, NO_DUMP ) DISK_IMAGE_READONLY( "esh_ver2_en", 0, SHA1(c04709d95fd92259f013ec1cd28e3e36a163abe1) )
ROM_END ROM_END
ROM_START( eshb ) ROM_START( eshb )
@ -465,7 +465,7 @@ ROM_START( eshb )
ROM_LOAD( "v.c6", 0x300, 0x100, CRC(7157ba22) SHA1(07355f30efe46196d216356eda48a59fc622e43f) ) ROM_LOAD( "v.c6", 0x300, 0x100, CRC(7157ba22) SHA1(07355f30efe46196d216356eda48a59fc622e43f) )
DISK_REGION( "laserdisc" ) DISK_REGION( "laserdisc" )
DISK_IMAGE_READONLY( "esh", 0, NO_DUMP ) DISK_IMAGE_READONLY( "esh_ver2_en", 0, SHA1(c04709d95fd92259f013ec1cd28e3e36a163abe1) )
ROM_END ROM_END

View File

@ -2769,7 +2769,7 @@ GAME( 1992, heatbrlo, heatbrl, heatbrl, heatbrl, driver_device, 0, RO
GAME( 1992, heatbrlu, heatbrl, heatbrl, heatbrl, driver_device, 0, ROT0, "TAD Corporation", "Heated Barrel (US)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) GAME( 1992, heatbrlu, heatbrl, heatbrl, heatbrl, driver_device, 0, ROT0, "TAD Corporation", "Heated Barrel (US)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING )
GAME( 1992, heatbrle, heatbrl, heatbrl, heatbrl, driver_device, 0, ROT0, "TAD Corporation (Electronic Devices license)", "Heated Barrel (Electronic Devices license)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) GAME( 1992, heatbrle, heatbrl, heatbrl, heatbrl, driver_device, 0, ROT0, "TAD Corporation (Electronic Devices license)", "Heated Barrel (Electronic Devices license)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING )
GAME( 1993, godzilla, 0, godzilla, godzilla, driver_device, 0, ROT0, "Banpresto", "Godzilla (Japan)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) GAME( 1993, godzilla, 0, godzilla, godzilla, driver_device, 0, ROT0, "Banpresto", "Godzilla (Japan)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1993, grainbow, 0, grainbow, grainbow, driver_device, 0, ROT0, "Banpresto", "SD Gundam Sangokushi Rainbow Tairiku Senki", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING ) GAME( 1993, grainbow, 0, grainbow, grainbow, driver_device, 0, ROT0, "Banpresto", "SD Gundam Sangokushi Rainbow Tairiku Senki", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING )
GAME( 1993, denjinmk, 0, denjinmk, denjinmk, legionna_state,denjinmk, ROT0, "Winkysoft (Banpresto license)", "Denjin Makai", MACHINE_IMPERFECT_GRAPHICS ) GAME( 1993, denjinmk, 0, denjinmk, denjinmk, legionna_state,denjinmk, ROT0, "Winkysoft (Banpresto license)", "Denjin Makai", MACHINE_IMPERFECT_GRAPHICS )

View File

@ -185,30 +185,28 @@ void raiden2cop_device::device_start()
save_item(NAME(m_LEGACY_r1)); save_item(NAME(m_LEGACY_r1));
m_videoramout_cb.resolve_safe(); m_videoramout_cb.resolve_safe();
m_byte_endian_val = m_cpu_is_68k ? 3 : 0;
m_word_endian_val = m_cpu_is_68k ? 2 : 0;
} }
UINT16 raiden2cop_device::cop_read_word(address_space &space, int address) UINT16 raiden2cop_device::cop_read_word(address_space &space, int address)
{ {
if (m_cpu_is_68k) return space.read_word(address ^ 2); return space.read_word(address ^ m_word_endian_val);
else return space.read_word(address);
} }
UINT8 raiden2cop_device::cop_read_byte(address_space &space, int address) UINT8 raiden2cop_device::cop_read_byte(address_space &space, int address)
{ {
if (m_cpu_is_68k) return space.read_byte(address ^ 3); return space.read_byte(address ^ m_byte_endian_val);
else return space.read_byte(address);
} }
void raiden2cop_device::cop_write_word(address_space &space, int address, UINT16 data) void raiden2cop_device::cop_write_word(address_space &space, int address, UINT16 data)
{ {
if (m_cpu_is_68k) space.write_word(address ^ 2, data); space.write_word(address ^ m_word_endian_val, data);
else space.write_word(address, data);
} }
void raiden2cop_device::cop_write_byte(address_space &space, int address, UINT8 data) void raiden2cop_device::cop_write_byte(address_space &space, int address, UINT8 data)
{ {
if (m_cpu_is_68k) space.write_byte(address ^ 3, data); space.write_byte(address ^ m_byte_endian_val, data);
else space.write_byte(address, data);
} }
@ -887,12 +885,9 @@ WRITE16_MEMBER(raiden2cop_device::cop_dma_trigger_w)
} }
/* Number Conversion */ /* Number Conversion */
void raiden2cop_device::bcd_update()
WRITE16_MEMBER(raiden2cop_device::cop_itoa_low_w)
{ {
cop_itoa = (cop_itoa & ~UINT32(mem_mask)) | (data & mem_mask); //int digits = 1 << cop_itoa_mode*2;
//int digits = 1 << cop_itoa_mode*2;
UINT32 val = cop_itoa; UINT32 val = cop_itoa;
//if(digits > 9) //if(digits > 9)
@ -918,9 +913,19 @@ WRITE16_MEMBER(raiden2cop_device::cop_itoa_low_w)
cop_itoa_digits[9] = 0; cop_itoa_digits[9] = 0;
} }
WRITE16_MEMBER(raiden2cop_device::cop_itoa_low_w)
{
cop_itoa = (cop_itoa & ~UINT32(mem_mask)) | (data & mem_mask);
bcd_update();
}
WRITE16_MEMBER(raiden2cop_device::cop_itoa_high_w) WRITE16_MEMBER(raiden2cop_device::cop_itoa_high_w)
{ {
cop_itoa = (cop_itoa & ~(mem_mask << 16)) | ((data & mem_mask) << 16); cop_itoa = (cop_itoa & ~(mem_mask << 16)) | ((data & mem_mask) << 16);
// Godzilla cares, otherwise you get 2p score overflow in 1p vs 2p, TODO: might actually be HW endianness dependant?
bcd_update();
} }
WRITE16_MEMBER(raiden2cop_device::cop_itoa_mode_w) WRITE16_MEMBER(raiden2cop_device::cop_itoa_mode_w)

View File

@ -240,10 +240,13 @@ public:
DECLARE_WRITE16_MEMBER(LEGACY_cop_cmd_w); DECLARE_WRITE16_MEMBER(LEGACY_cop_cmd_w);
void cop_collision_update_hitbox(address_space &space, UINT16 data, int slot, UINT32 hitadr); void cop_collision_update_hitbox(address_space &space, UINT16 data, int slot, UINT32 hitadr);
void bcd_update();
// endian stuff? // endian stuff?
int m_cpu_is_68k; int m_cpu_is_68k;
UINT8 m_byte_endian_val;
UINT8 m_word_endian_val;
static void set_cpu_is_68k(device_t &device, int value) { downcast<raiden2cop_device &>(device).m_cpu_is_68k = value; } static void set_cpu_is_68k(device_t &device, int value) { downcast<raiden2cop_device &>(device).m_cpu_is_68k = value; }
UINT16 cop_read_word(address_space &space, int address); UINT16 cop_read_word(address_space &space, int address);
UINT8 cop_read_byte(address_space &space, int address); UINT8 cop_read_byte(address_space &space, int address);