common scramble (nw)

This commit is contained in:
David Haywood 2015-09-20 18:05:55 +01:00
parent 999ed27b7b
commit 74ceaefbe0
3 changed files with 25 additions and 0 deletions

View File

@ -354,6 +354,7 @@ static MACHINE_CONFIG_START( igs_majhong, igs_m027_state )
MCFG_DEVICE_ADD("igs017_igs031", IGS017_IGS031, 0)
MCFG_GFX_PALETTE("palette")
MCFG_REVERSE_TEXT_BITS
// 82C55? (accessed through igs017/igs031 area like igs017.c?)
@ -388,6 +389,7 @@ static MACHINE_CONFIG_START( amazonia, igs_m027_state )
MCFG_DEVICE_ADD("igs017_igs031", IGS017_IGS031, 0)
MCFG_GFX_PALETTE("palette")
MCFG_REVERSE_TEXT_BITS
// 82C55? (accessed through igs017/igs031 area like igs017.c?)

View File

@ -89,6 +89,7 @@ igs017_igs031_device::igs017_igs031_device(const machine_config &mconfig, const
m_palette(*this, "^palette")
{
m_palette_scramble_cb = igs017_igs031_palette_scramble_delegate(FUNC(igs017_igs031_device::palette_callback_straight), this);
m_revbits = 0;
}
const address_space_config *igs017_igs031_device::memory_space_config(address_spacenum spacenum) const
@ -133,6 +134,19 @@ void igs017_igs031_device::video_start()
{
// make sure thie happens AFTER driver init, or things won't work
expand_sprites();
if (m_revbits)
{
UINT8 *rom = memregion("^tilemaps")->base();
int size = memregion("^tilemaps")->bytes();
int i;
for (i = 0; i < size ; i++)
{
rom[i] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
// rom[i^1] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
}
}
}

View File

@ -8,6 +8,8 @@ typedef device_delegate<UINT16 (UINT16)> igs017_igs031_palette_scramble_delegate
#define MCFG_PALETTE_SCRAMBLE_CB( _class, _method) \
igs017_igs031_device::set_palette_scramble_cb(*device, igs017_igs031_palette_scramble_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0));
#define MCFG_REVERSE_TEXT_BITS \
igs017_igs031_device::static_set_text_reverse_bits(*device);
class igs017_igs031_device : public device_t,
public device_gfx_interface,
@ -23,6 +25,11 @@ public:
static void set_palette_scramble_cb(device_t &device,igs017_igs031_palette_scramble_delegate newtilecb);
static void static_set_text_reverse_bits(device_t &device)
{
igs017_igs031_device &dev = downcast<igs017_igs031_device &>(device);
dev.m_revbits = 1;
}
UINT16 palette_callback_straight(UINT16 bgr);
@ -33,6 +40,8 @@ public:
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
// the gfx roms were often hooked up with the bits backwards, allow us to handle it here to save doing it in every driver.
int m_revbits;
int m_toggle;
int m_debug_addr;