diff options
Diffstat (limited to 'src/mame/drivers/supdrapo.cpp')
-rw-r--r-- | src/mame/drivers/supdrapo.cpp | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/src/mame/drivers/supdrapo.cpp b/src/mame/drivers/supdrapo.cpp index e3f1bf12962..26335c0787b 100644 --- a/src/mame/drivers/supdrapo.cpp +++ b/src/mame/drivers/supdrapo.cpp @@ -74,15 +74,16 @@ class supdrapo_state : public driver_device { public: - supdrapo_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + supdrapo_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_watchdog(*this, "watchdog"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_col_line(*this, "col_line"), m_videoram(*this, "videoram"), - m_char_bank(*this, "char_bank") { } + m_char_bank(*this, "char_bank") + { } void supdrapo(machine_config &config); @@ -110,7 +111,7 @@ private: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - DECLARE_PALETTE_INIT(supdrapo); + void supdrapo_palette(palette_device &palette) const; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void sdpoker_mem(address_map &map); @@ -128,19 +129,14 @@ void supdrapo_state::video_start() uint32_t supdrapo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - int count; - int color; - - count = 0; - - for(y = 0; y < 32; y++) + int count = 0; + for (int y = 0; y < 32; y++) { - for(x = 0; x < 32; x++) + for (int x = 0; x < 32; x++) { - int tile = m_videoram[count] + m_char_bank[count] * 0x100; - /* Global Column Coloring, GUESS! */ - color = m_col_line[(x*2) + 1] ? (m_col_line[(x*2) + 1] - 1) & 7 : 0; + int const tile = m_videoram[count] + m_char_bank[count] * 0x100; + // Global Column Coloring, GUESS! + int const color = m_col_line[(x*2) + 1] ? (m_col_line[(x*2) + 1] - 1) & 7 : 0; m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile,color, 0, 0, x*8, y*8); @@ -152,29 +148,29 @@ uint32_t supdrapo_state::screen_update(screen_device &screen, bitmap_ind16 &bitm } -/*Maybe bit 2 & 3 of the second color prom are intensity bits? */ -PALETTE_INIT_MEMBER(supdrapo_state, supdrapo) +// Maybe bit 2 & 3 of the second color prom are intensity bits? +void supdrapo_state::supdrapo_palette(palette_device &palette) const { const uint8_t *color_prom = memregion("proms")->base(); - int bit0, bit1, bit2 , r, g, b; - int i; - for (i = 0; i < 0x100; ++i) + for (int i = 0; i < 0x100; ++i) { - bit0 = 0;//(color_prom[0] >> 0) & 0x01; - bit1 = (color_prom[0] >> 0) & 0x01; - bit2 = (color_prom[0] >> 1) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + int bit0, bit1, bit2; + + bit0 = 0; // BIT(color_prom[0], 0); + bit1 = BIT(color_prom[0], 0); + bit2 = BIT(color_prom[0], 1); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - bit0 = 0;//(color_prom[0] >> 3) & 0x01; - bit1 = (color_prom[0] >> 2) & 0x01; - bit2 = (color_prom[0] >> 3) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + bit0 = 0; // BIT(color_prom[0], 3); + bit1 = BIT(color_prom[0], 2); + bit2 = BIT(color_prom[0], 3); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - bit0 = 0;//(color_prom[0] >> 0) & 0x01; - bit1 = (color_prom[0x100] >> 0) & 0x01; - bit2 = (color_prom[0x100] >> 1) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + bit0 = 0; // BIT(color_prom[0], 0); + bit1 = BIT(color_prom[0x100], 0); + bit2 = BIT(color_prom[0x100], 1); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; palette.set_pen_color(i, rgb_t(r, g, b)); color_prom++; @@ -472,11 +468,10 @@ MACHINE_CONFIG_START(supdrapo_state::supdrapo) MCFG_SCREEN_SIZE(256, 256) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) MCFG_SCREEN_UPDATE_DRIVER(supdrapo_state, screen_update) - MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_PALETTE(m_palette) - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_supdrapo) - MCFG_PALETTE_ADD("palette", 0x100) - MCFG_PALETTE_INIT_OWNER(supdrapo_state, supdrapo) + GFXDECODE(config, m_gfxdecode, m_palette, gfx_supdrapo); + PALETTE(config, m_palette, FUNC(supdrapo_state::supdrapo_palette), 0x100); SPEAKER(config, "mono").front_center(); |