summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/esh.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-12-29 05:53:50 +1100
committer Vas Crabb <vas@vastheman.com>2018-12-29 05:53:50 +1100
commitf1f0591f43f381123e8d9ec20c52eb7c0c332c79 (patch)
tree97c8dd30a6ea292c3189f372b8103a2e303c0b2d /src/mame/drivers/esh.cpp
parent65bfb2654f0c73235f114e9145c766245bed9790 (diff)
Start cleaning up palette configuration:
* Basically, initialisers go in the constructor arguments, and things for setting format go in set_format. * Initialisation patterns can be specified with an enum discriminator or with a FUNC and optionally a tag. * Formats can be specified with an enum discriminator or a size and function pointer. * You must always supply the number of entries when setting the format. * When initislising with a paletter initialisation member, you can specify the entries and indirecte entries together. * The palette_device now has a standard constructor, so use .set_entries if you are specifying entry count with no format/initialisation. * Also killed an overload on delegates that wasn't being useful.
Diffstat (limited to 'src/mame/drivers/esh.cpp')
-rw-r--r--src/mame/drivers/esh.cpp83
1 files changed, 40 insertions, 43 deletions
diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp
index 3205ce6a38a..4137a8e7b12 100644
--- a/src/mame/drivers/esh.cpp
+++ b/src/mame/drivers/esh.cpp
@@ -38,21 +38,25 @@ class esh_state : public driver_device
{
public:
esh_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_laserdisc(*this, "laserdisc"),
- m_screen(*this, "screen"),
- m_tile_ram(*this, "tile_ram"),
- m_tile_control_ram(*this, "tile_ctrl_ram"),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_beep(*this, "beeper"),
- m_palette(*this, "palette") { }
-
+ : driver_device(mconfig, type, tag)
+ , m_laserdisc(*this, "laserdisc")
+ , m_screen(*this, "screen")
+ , m_tile_ram(*this, "tile_ram")
+ , m_tile_control_ram(*this, "tile_ctrl_ram")
+ , m_maincpu(*this, "maincpu")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_beep(*this, "beeper")
+ , m_palette(*this, "palette")
+ { }
void esh(machine_config &config);
void init_esh();
+protected:
+ virtual void machine_start() override;
+ //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
private:
required_device<pioneer_ldv1000_device> m_laserdisc;
required_device<screen_device> m_screen;
@@ -65,8 +69,7 @@ private:
DECLARE_WRITE8_MEMBER(led_writes);
DECLARE_WRITE8_MEMBER(nmi_line_w);
bool m_nmi_enable;
- virtual void machine_start() override;
- DECLARE_PALETTE_INIT(esh);
+ void esh_palette(palette_device &palette) const;
uint32_t screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_callback_esh);
DECLARE_WRITE_LINE_MEMBER(ld_command_strobe_cb);
@@ -77,8 +80,6 @@ private:
void z80_0_io(address_map &map);
void z80_0_mem(address_map &map);
-protected:
- //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
};
@@ -283,46 +284,44 @@ static INPUT_PORTS_START( esh )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(esh_state, esh)
+void esh_state::esh_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* Oddly enough, the top 4 bits of each byte is 0 <- ??? */
- for (i = 0; i < palette.entries(); i++)
+ // Oddly enough, the top 4 bits of each byte is 0 <- ???
+ for (int i = 0; i < palette.entries(); i++)
{
- int r,g,b;
- int bit0,bit1,bit2;
+ int bit0, bit1, bit2;
- /* Presumably resistor values would help here */
+ // Presumably resistor values would help here
- /* red component */
- bit0 = (color_prom[i+0x100] >> 0) & 0x01;
- bit1 = (color_prom[i+0x100] >> 1) & 0x01;
- bit2 = (color_prom[i+0x100] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i+0x100], 0);
+ bit1 = BIT(color_prom[i+0x100], 1);
+ bit2 = BIT(color_prom[i+0x100], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = 0; //(color_prom[i+0x100] >> 0) & 0x01;
- bit1 = (color_prom[i+0x100] >> 3) & 0x01;
- bit2 = (color_prom[i+0x100] >> 4) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = 0; //BIT(color_prom[i+0x100], 0);
+ bit1 = BIT(color_prom[i+0x100], 3);
+ bit2 = BIT(color_prom[i+0x100], 4);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
// TODO: actually opaque flag
+ int b;
if((color_prom[i+0x100] >> 7) & 1)
b = 0xff;
else
{
- bit0 = 0; //(color_prom[i+0x100] >> 5) & 0x01;
- bit1 = (color_prom[i+0x100] >> 5) & 0x01;
- bit2 = (color_prom[i+0x100] >> 6) & 0x01;
+ bit0 = 0; //BIT(color_prom[i+0x100], 5);
+ bit1 = BIT(color_prom[i+0x100], 5);
+ bit2 = BIT(color_prom[i+0x100], 6);
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
}
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
-
}
static const gfx_layout esh_gfx_layout =
@@ -372,15 +371,13 @@ MACHINE_CONFIG_START(esh_state::esh)
MCFG_LASERDISC_LDV1000_ADD("laserdisc")
MCFG_LASERDISC_LDV1000_COMMAND_STROBE_CB(WRITELINE(*this, esh_state, ld_command_strobe_cb))
MCFG_LASERDISC_OVERLAY_DRIVER(256, 256, esh_state, screen_update_esh)
- MCFG_LASERDISC_OVERLAY_PALETTE("palette")
+ MCFG_LASERDISC_OVERLAY_PALETTE(m_palette)
/* video hardware */
MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(esh_state, esh)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_esh)
+ PALETTE(config, m_palette, FUNC(esh_state::esh_palette), 256);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_esh);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();