Fix colours in Crude Buster (verified against real hardware)

This commit is contained in:
Bryan McPhail 2017-06-28 12:02:14 -04:00
parent 09a0e206ec
commit e6f83e9e74
3 changed files with 50 additions and 2 deletions

View File

@ -137,8 +137,8 @@ static ADDRESS_MAP_START( twocrude_map, AS_PROGRAM, 16, cbuster_state )
AM_RANGE(0x0b4000, 0x0b4001) AM_WRITENOP
AM_RANGE(0x0b5000, 0x0b500f) AM_DEVWRITE("tilegen1", deco16ic_device, pf_control_w)
AM_RANGE(0x0b6000, 0x0b600f) AM_DEVWRITE("tilegen2", deco16ic_device, pf_control_w)
AM_RANGE(0x0b8000, 0x0b8fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0b9000, 0x0b9fff) AM_RAM_DEVWRITE("palette", palette_device, write_ext) AM_SHARE("palette_ext")
AM_RANGE(0x0b8000, 0x0b8fff) AM_RAM_WRITE(cbuster_palette_w) AM_SHARE("palette")
AM_RANGE(0x0b9000, 0x0b9fff) AM_RAM_WRITE(cbuster_palette_ext_w) AM_SHARE("palette_ext")
AM_RANGE(0x0bc000, 0x0bc00f) AM_READWRITE(twocrude_control_r, twocrude_control_w)
ADDRESS_MAP_END

View File

@ -21,6 +21,8 @@ public:
m_pf3_rowscroll(*this, "pf3_rowscroll"),
m_pf4_rowscroll(*this, "pf4_rowscroll"),
m_spriteram16(*this, "spriteram16"),
m_paletteram(*this, "palette"),
m_paletteram_ext(*this, "palette_ext"),
m_sprgen(*this, "spritegen"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
@ -37,6 +39,8 @@ public:
required_shared_ptr<uint16_t> m_pf3_rowscroll;
required_shared_ptr<uint16_t> m_pf4_rowscroll;
required_shared_ptr<uint16_t> m_spriteram16;
required_shared_ptr<uint16_t> m_paletteram;
required_shared_ptr<uint16_t> m_paletteram_ext;
optional_device<decospr_device> m_sprgen;
uint16_t m_spriteram16_buffer[0x400];
@ -61,4 +65,7 @@ public:
virtual void video_start() override;
uint32_t screen_update_twocrude(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECO16IC_BANK_CB_MEMBER(bank_callback);
DECLARE_WRITE16_MEMBER(cbuster_palette_w);
DECLARE_WRITE16_MEMBER(cbuster_palette_ext_w);
void update_palette(int offset);
};

View File

@ -22,6 +22,47 @@ void cbuster_state::video_start()
m_sprgen->alloc_sprite_bitmap();
}
/*
Crude Buster palette is a little strange compared to other Data East games
of this period. Although the digital palette is 8 bits per channel, the
analog 'white' level is set at 0x8e. In hardware this is done at the
final resistors before the JAMMA connector. It also suggests that if the
game were to use any values above 0x8e (it doesn't) then the final output
voltage would be out of spec.
I suspect this setup is actually software compensating for a hardware
design problem.
*/
void cbuster_state::update_palette(int offset)
{
int r = m_paletteram[offset]&0xff;
int g = m_paletteram[offset]>>8;
int b = m_paletteram_ext[offset]&0xff;
if (r>0x8e) r=0x8e;
if (g>0x8e) g=0x8e;
if (b>0x8e) b=0x8e;
r = (r * 255) / 0x8e;
g = (g * 255) / 0x8e;
b = (b * 255) / 0x8e;
m_palette->set_pen_color(offset,rgb_t(r,g,b));
}
WRITE16_MEMBER(cbuster_state::cbuster_palette_w)
{
COMBINE_DATA(&m_paletteram[offset]);
update_palette(offset);
}
WRITE16_MEMBER(cbuster_state::cbuster_palette_ext_w)
{
COMBINE_DATA(&m_paletteram_ext[offset]);
update_palette(offset);
}
uint32_t cbuster_state::screen_update_twocrude(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
address_space &space = machine().dummy_space();