diff options
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 |
commit | f1f0591f43f381123e8d9ec20c52eb7c0c332c79 (patch) | |
tree | 97c8dd30a6ea292c3189f372b8103a2e303c0b2d /src/mame/drivers/efdt.cpp | |
parent | 65bfb2654f0c73235f114e9145c766245bed9790 (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/efdt.cpp')
-rw-r--r-- | src/mame/drivers/efdt.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/mame/drivers/efdt.cpp b/src/mame/drivers/efdt.cpp index 05cce9d1eec..df5618971ac 100644 --- a/src/mame/drivers/efdt.cpp +++ b/src/mame/drivers/efdt.cpp @@ -157,9 +157,9 @@ **********************************************************************************/ - #include "emu.h" #include "includes/efdt.h" + #include "cpu/z80/z80.h" #include "cpu/m6800/m6800.h" #include "machine/watchdog.h" @@ -179,21 +179,19 @@ * Video Hardware * *********************************************/ -PALETTE_INIT_MEMBER(efdt_state, efdt) +void efdt_state::efdt_palette(palette_device &palette) const { - const uint8_t *color_prom = memregion("prom")->base(); + uint8_t const *const color_prom = memregion("prom")->base(); for (int i = 0; i < 256; ++i) { - uint8_t r, g, b; - - uint8_t v = color_prom[i]; + uint8_t const v = color_prom[i]; - g = (v & 7) << 5; - r = ((v >> 3) & 7) << 5; - b = ((v >> 6) & 3) << 6; + uint8_t const g = (v & 7) << 5; + uint8_t const r = ((v >> 3) & 7) << 5; + uint8_t const b = ((v >> 6) & 3) << 6; - if((i & 7) == 0) + if ((i & 7) == 0) palette.set_pen_color(i, 0); else palette.set_pen_color(i, rgb_t(r, g, b)); @@ -570,12 +568,11 @@ MACHINE_CONFIG_START( efdt_state::efdt ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) MCFG_SCREEN_VISIBLE_AREA(0, 32*8 - 1, 16, 30*8 - 1) MCFG_SCREEN_UPDATE_DRIVER(efdt_state, screen_update_efdt) - MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_PALETTE(m_palette) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, efdt_state, vblank_nmi_w)) - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_efdt) - MCFG_PALETTE_ADD("palette", 256) - MCFG_PALETTE_INIT_OWNER(efdt_state, efdt) + GFXDECODE(config, m_gfxdecode, m_palette, gfx_efdt); + PALETTE(config, m_palette, FUNC(efdt_state::efdt_palette), 256); /* sound hardware */ SPEAKER(config, "mono").front_center(); |