diff options
Diffstat (limited to 'src/mame/drivers/adp.cpp')
-rw-r--r-- | src/mame/drivers/adp.cpp | 54 |
1 files changed, 18 insertions, 36 deletions
diff --git a/src/mame/drivers/adp.cpp b/src/mame/drivers/adp.cpp index 65eacd3364b..0c5317b7b0f 100644 --- a/src/mame/drivers/adp.cpp +++ b/src/mame/drivers/adp.cpp @@ -172,8 +172,8 @@ Quick Jack administration/service mode: class adp_state : public driver_device { public: - adp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + adp_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_microtouch(*this, "microtouch"), m_maincpu(*this, "maincpu"), m_duart(*this, "duart"), @@ -207,8 +207,8 @@ private: DECLARE_WRITE16_MEMBER(input_w); DECLARE_MACHINE_START(skattv); DECLARE_MACHINE_RESET(skattv); - DECLARE_PALETTE_INIT(adp); - DECLARE_PALETTE_INIT(fstation); + void adp_palette(palette_device &device) const; + void fstation_palette(palette_device &device) const; IRQ_CALLBACK_MEMBER(duart_iack_handler); //INTERRUPT_GEN_MEMBER(adp_int); void skattva_nvram_init(nvram_device &nvram, void *base, size_t size); @@ -263,35 +263,19 @@ MACHINE_RESET_MEMBER(adp_state,skattv) m_mux_data = 0; } -PALETTE_INIT_MEMBER(adp_state,adp) +void adp_state::adp_palette(palette_device &palette) const { - int i; - - for (i = 0; i < palette.entries(); i++) + for (int i = 0; i < palette.entries(); i++) { - int bit0, bit1, bit2, r, g, b; - - // red component - bit0 = (i >> 0) & 0x01; - bit1 = (i >> 3) & 0x01; - bit2 = (i >> 0) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // green component - bit0 = (i >> 1) & 0x01; - bit1 = (i >> 3) & 0x01; - bit2 = (i >> 1) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // blue component - bit0 = (i >> 2) & 0x01; - bit1 = (i >> 3) & 0x01; - bit2 = (i >> 2) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - palette.set_pen_color(i, rgb_t(r,g,b)); + int const r = 0x21 * BIT(i, 0) + 0x47 * BIT(i, 3) + 0x97 * BIT(i, 0); + int const g = 0x21 * BIT(i, 1) + 0x47 * BIT(i, 3) + 0x97 * BIT(i, 1); + int const b = 0x21 * BIT(i, 2) + 0x47 * BIT(i, 3) + 0x97 * BIT(i, 2); + + palette.set_pen_color(i, rgb_t(r, g, b)); } } -PALETTE_INIT_MEMBER(adp_state,fstation) +void adp_state::fstation_palette(palette_device &palette) const { for (int i = 0; i < palette.entries(); i++) palette.set_pen_color(i, rgb_t(pal3bit(i>>5), pal3bit(i>>2), pal2bit(i>>0))); @@ -583,11 +567,9 @@ MACHINE_CONFIG_START(adp_state::quickjac) MCFG_SCREEN_SIZE(384, 280) MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 280-1) MCFG_SCREEN_UPDATE_DEVICE("acrtc", hd63484_device, update_screen) - MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_PALETTE(m_palette) - MCFG_PALETTE_ADD("palette", 0x10) - - MCFG_PALETTE_INIT_OWNER(adp_state,adp) + PALETTE(config, m_palette, FUNC(adp_state::adp_palette), 0x10); HD63484(config, m_acrtc, 0).set_addrmap(0, &adp_state::adp_hd63484_map); @@ -624,11 +606,11 @@ void adp_state::ramdac_map(address_map &map) MACHINE_CONFIG_START(adp_state::funland) quickjac(config); + MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(funland_mem) - MCFG_DEVICE_REMOVE("palette") - MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x100) + PALETTE(config.replace(), m_palette, palette_device::BLACK, 0x100); ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, m_palette)); ramdac.set_addrmap(0, &adp_state::ramdac_map); @@ -638,6 +620,7 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(adp_state::fstation) funland(config); + MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(fstation_mem) @@ -645,8 +628,7 @@ MACHINE_CONFIG_START(adp_state::fstation) MCFG_SCREEN_SIZE(640, 480) MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) - MCFG_PALETTE_MODIFY("palette") - MCFG_PALETTE_INIT_OWNER(adp_state, fstation) + m_palette->set_init(FUNC(adp_state::fstation_palette)); MACHINE_CONFIG_END |