summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/epos.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/video/epos.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/video/epos.cpp')
-rw-r--r--src/mame/video/epos.cpp47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/mame/video/epos.cpp b/src/mame/video/epos.cpp
index a73baff8ea3..731f22ac437 100644
--- a/src/mame/video/epos.cpp
+++ b/src/mame/video/epos.cpp
@@ -24,41 +24,40 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(epos_state,epos)
+void epos_state::epos_palette(palette_device &palette) const
{
- offs_t i;
- const uint8_t *color_prom = memregion("proms")->base();
- int len = memregion("proms")->bytes();
+ uint8_t const *const color_prom = memregion("proms")->base();
+ int const len = memregion("proms")->bytes();
- for (i = 0; i < len; i++)
- set_pal_color(i, color_prom[i]);
+ for (offs_t i = 0; i < len; i++)
+ set_pal_color(palette, i, color_prom[i]);
}
-void epos_state::set_pal_color( uint8_t offset, uint8_t data )
+void epos_state::set_pal_color(palette_device &palette, uint8_t offset, uint8_t data)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- bit0 = (data >> 7) & 0x01;
- bit1 = (data >> 6) & 0x01;
- bit2 = (data >> 5) & 0x01;
- r = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2;
+ bit0 = BIT(data, 7);
+ bit1 = BIT(data, 6);
+ bit2 = BIT(data, 5);
+ int const r = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2;
- bit0 = (data >> 4) & 0x01;
- bit1 = (data >> 3) & 0x01;
- bit2 = (data >> 2) & 0x01;
- g = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2;
+ bit0 = BIT(data, 4);
+ bit1 = BIT(data, 3);
+ bit2 = BIT(data, 2);
+ int const g = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2;
- bit0 = (data >> 1) & 0x01;
- bit1 = (data >> 0) & 0x01;
- b = 0xad * bit0 + 0x52 * bit1;
+ bit0 = BIT(data, 1);
+ bit1 = BIT(data, 0);
+ int const b = 0xad * bit0 + 0x52 * bit1;
- m_palette->set_pen_color(offset, rgb_t(r,g,b));
+ palette.set_pen_color(offset, rgb_t(r, g, b));
}
// later (tristar 9000) games uses a dynamic palette instead of prom
WRITE8_MEMBER(epos_state::dealer_pal_w)
{
- set_pal_color(offset,data);
+ set_pal_color(*m_palette, offset, data);
}
WRITE8_MEMBER(epos_state::port_1_w)
@@ -81,11 +80,9 @@ WRITE8_MEMBER(epos_state::port_1_w)
uint32_t epos_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- offs_t offs;
-
- for (offs = 0; offs < m_videoram.bytes(); offs++)
+ for (offs_t offs = 0; offs < m_videoram.bytes(); offs++)
{
- uint8_t data = m_videoram[offs];
+ uint8_t const data = m_videoram[offs];
int x = (offs % 136) * 2;
int y = (offs / 136);