summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/kontest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/kontest.cpp')
-rw-r--r--src/mame/drivers/kontest.cpp46
1 files changed, 22 insertions, 24 deletions
diff --git a/src/mame/drivers/kontest.cpp b/src/mame/drivers/kontest.cpp
index 5b23ce7827e..bc01ab4fe74 100644
--- a/src/mame/drivers/kontest.cpp
+++ b/src/mame/drivers/kontest.cpp
@@ -32,11 +32,11 @@
class kontest_state : public driver_device
{
public:
- kontest_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_ram(*this, "ram"),
- m_palette(*this, "palette")
+ kontest_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_ram(*this, "ram"),
+ m_palette(*this, "palette")
{ }
void kontest(machine_config &config);
@@ -65,7 +65,7 @@ private:
virtual void video_start() override;
- DECLARE_PALETTE_INIT(kontest);
+ void kontest_palette(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(kontest_interrupt);
};
@@ -76,26 +76,25 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(kontest_state, kontest)
+void kontest_state::kontest_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 < 0x20; ++i)
+ for (int i = 0; i < 0x20; ++i)
{
+ int bit0, bit1, bit2;
+
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -271,8 +270,7 @@ MACHINE_CONFIG_START(kontest_state::kontest)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(kontest_state, kontest)
+ PALETTE(config, m_palette, FUNC(kontest_state::kontest_palette), 32);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();