diff options
Diffstat (limited to 'src/mame/drivers/cardline.cpp')
-rw-r--r-- | src/mame/drivers/cardline.cpp | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/src/mame/drivers/cardline.cpp b/src/mame/drivers/cardline.cpp index f120bd28803..2b41aedbbf6 100644 --- a/src/mame/drivers/cardline.cpp +++ b/src/mame/drivers/cardline.cpp @@ -20,7 +20,6 @@ ***********************************/ - #include "emu.h" #include "cpu/mcs51/mcs51.h" #include "sound/okim6295.h" @@ -48,6 +47,12 @@ public: m_lamps(*this, "lamp%u", 0U) { } + void cardline(machine_config &config); + +protected: + virtual void machine_start() override; + +private: DECLARE_WRITE8_MEMBER(vram_w); DECLARE_WRITE8_MEMBER(attr_w); DECLARE_WRITE8_MEMBER(video_w); @@ -58,20 +63,16 @@ public: DECLARE_WRITE8_MEMBER(asic_w); DECLARE_WRITE8_MEMBER(a3003_w); - DECLARE_PALETTE_INIT(cardline); + void cardline_palette(palette_device &palette) const; DECLARE_WRITE_LINE_MEMBER(hsync_changed); DECLARE_WRITE_LINE_MEMBER(vsync_changed); MC6845_BEGIN_UPDATE(crtc_begin_update); MC6845_UPDATE_ROW(crtc_update_row); - void cardline(machine_config &config); void mem_io(address_map &map); void mem_prg(address_map &map); -protected: - virtual void machine_start() override; - required_shared_ptr<uint8_t> m_videoram; required_shared_ptr<uint8_t> m_colorram; @@ -295,30 +296,33 @@ static GFXDECODE_START( gfx_cardline ) GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 2 ) GFXDECODE_END -PALETTE_INIT_MEMBER(cardline_state, cardline) +void cardline_state::cardline_palette(palette_device &palette) const { - const uint8_t *color_prom = memregion("proms")->base(); - int i,r,g,b,data; - int bit0,bit1,bit2; - for (i = 0;i < palette.entries();i++) + uint8_t const *const color_prom = memregion("proms")->base(); + + for (int i = 0; i < palette.entries(); i++) { - data=color_prom[i]; - - /* red component */ - bit0 = (data >> 5) & 0x01; - bit1 = (data >> 6) & 0x01; - bit2 = (data >> 7) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - /* green component */ - bit0 = (data >> 2) & 0x01; - bit1 = (data >> 3) & 0x01; - bit2 = (data >> 4) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - /* blue component */ - bit0 = (data >> 0) & 0x01; - bit1 = (data >> 1) & 0x01; - b = 0x55 * bit0 + 0xaa * bit1; - palette.set_pen_color(i,rgb_t(r,g,b)); + int const data = color_prom[i]; + int bit0, bit1, bit2; + + // red component + bit0 = BIT(data, 5); + bit1 = BIT(data, 6); + bit2 = BIT(data, 7); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // green component + bit0 = BIT(data, 2); + bit1 = BIT(data, 3); + bit2 = BIT(data, 4); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // blue component + bit0 = BIT(data, 0); + bit1 = BIT(data, 1); + int const b = 0x55 * bit0 + 0xaa * bit1; + + palette.set_pen_color(i, rgb_t(r, g, b)); } } @@ -340,12 +344,11 @@ MACHINE_CONFIG_START(cardline_state::cardline) MCFG_SCREEN_SIZE(64*8, 35*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1) //MCFG_SCREEN_UPDATE_DRIVER(cardline_state, screen_update_cardline) - //MCFG_SCREEN_PALETTE("palette") + //MCFG_SCREEN_PALETTE(m_palette) MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cardline) - MCFG_PALETTE_ADD("palette", 512) - MCFG_PALETTE_INIT_OWNER(cardline_state, cardline) + GFXDECODE(config, m_gfxdecode, m_palette, gfx_cardline); + PALETTE(config, m_palette, FUNC(cardline_state::cardline_palette), 512); mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/8)); /* divisor guessed - result is 56 Hz */ crtc.set_screen("screen"); |