diff --git a/src/devices/video/huc6260.cpp b/src/devices/video/huc6260.cpp index a86c3980d2e..51908c181a6 100644 --- a/src/devices/video/huc6260.cpp +++ b/src/devices/video/huc6260.cpp @@ -33,19 +33,17 @@ constexpr unsigned huc6260_device::PALETTE_SIZE; constexpr unsigned huc6260_device::WPF; constexpr unsigned huc6260_device::LPF; -PALETTE_INIT_MEMBER(huc6260_device, huc6260) +void huc6260_device::palette_init() { - int i; - - for ( i = 0; i < 512; i++ ) + for (int i = 0; i < 512; i++) { int r = pal3bit( ( i >> 3 ) & 7 ); int g = pal3bit( ( i >> 6 ) & 7 ); int b = pal3bit( ( i ) & 7 ); int y = ( ( 66 * r + 129 * g + 25 * b + 128 ) >> 8 ) + 16; - palette.set_pen_color( i, r, g, b ); - palette.set_pen_color( 512 + i, y, y, y ); + set_pen_color(i, r, g, b); + set_pen_color(512 + i, y, y, y); } } @@ -55,6 +53,7 @@ DEFINE_DEVICE_TYPE(HUC6260, huc6260_device, "huc6260", "Hudson HuC6260 VCE") huc6260_device::huc6260_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, HUC6260, tag, owner, clock), + device_palette_interface(mconfig, *this), device_video_interface(mconfig, *this), m_next_pixel_data_cb(*this), m_time_til_next_event_cb(*this), @@ -271,6 +270,8 @@ void huc6260_device::device_start() assert( ! m_next_pixel_data_cb.isnull() ); assert( ! m_time_til_next_event_cb.isnull() ); + palette_init(); + save_item(NAME(m_last_h)); save_item(NAME(m_last_v)); save_item(NAME(m_height)); @@ -298,12 +299,3 @@ void huc6260_device::device_reset() m_last_h = screen().hpos(); m_timer->adjust( screen().time_until_pos( ( screen().vpos() + 1 ) % 263, 0 ) ); } - -//------------------------------------------------- -// device_add_mconfig - add device configuration -//------------------------------------------------- - -MACHINE_CONFIG_START(huc6260_device::device_add_mconfig) - MCFG_PALETTE_ADD("palette", huc6260_device::PALETTE_SIZE) - MCFG_PALETTE_INIT_OWNER(huc6260_device, huc6260) -MACHINE_CONFIG_END diff --git a/src/devices/video/huc6260.h b/src/devices/video/huc6260.h index defda4e6841..c3c6159fec7 100644 --- a/src/devices/video/huc6260.h +++ b/src/devices/video/huc6260.h @@ -26,6 +26,7 @@ class huc6260_device : public device_t, + public device_palette_interface, public device_video_interface { public: @@ -56,9 +57,12 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - virtual void device_add_mconfig(machine_config &config) override; + + virtual uint32_t palette_entries() const override { return PALETTE_SIZE; } private: + void palette_init(); + int m_last_h; int m_last_v; int m_height; @@ -86,8 +90,6 @@ private: emu_timer *m_timer; std::unique_ptr m_bmp; - - DECLARE_PALETTE_INIT(huc6260); }; diff --git a/src/mame/drivers/battlera.cpp b/src/mame/drivers/battlera.cpp index 897f077fce9..650c6bbda91 100644 --- a/src/mame/drivers/battlera.cpp +++ b/src/mame/drivers/battlera.cpp @@ -284,7 +284,7 @@ MACHINE_CONFIG_START(battlera_state::battlera) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, huc6260_device::WPF, 64, 64 + 1024 + 64, huc6260_device::LPF, 18, 18 + 242) MCFG_SCREEN_UPDATE_DRIVER( battlera_state, screen_update ) - MCFG_SCREEN_PALETTE("huc6260:palette") + MCFG_SCREEN_PALETTE("huc6260") MCFG_DEVICE_ADD( "huc6260", HUC6260, MAIN_CLOCK ) MCFG_HUC6260_NEXT_PIXEL_DATA_CB(READ16("huc6270", huc6270_device, next_pixel)) diff --git a/src/mame/drivers/ggconnie.cpp b/src/mame/drivers/ggconnie.cpp index ac71b5dfd84..8f9801740f8 100644 --- a/src/mame/drivers/ggconnie.cpp +++ b/src/mame/drivers/ggconnie.cpp @@ -277,7 +277,7 @@ MACHINE_CONFIG_START(ggconnie_state::ggconnie) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK/3, huc6260_device::WPF, 64, 64 + 1024 + 64, huc6260_device::LPF, 18, 18 + 242) MCFG_SCREEN_UPDATE_DRIVER( ggconnie_state, screen_update ) - MCFG_SCREEN_PALETTE("huc6260:palette") + MCFG_SCREEN_PALETTE("huc6260") MCFG_DEVICE_ADD("huc6260", HUC6260, PCE_MAIN_CLOCK/3) MCFG_HUC6260_NEXT_PIXEL_DATA_CB(READ16("huc6202", huc6202_device, next_pixel)) diff --git a/src/mame/drivers/paranoia.cpp b/src/mame/drivers/paranoia.cpp index d15cd6aac89..8375e0ba661 100644 --- a/src/mame/drivers/paranoia.cpp +++ b/src/mame/drivers/paranoia.cpp @@ -193,7 +193,7 @@ MACHINE_CONFIG_START(paranoia_state::paranoia) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK, huc6260_device::WPF, 64, 64 + 1024 + 64, huc6260_device::LPF, 18, 18 + 242) MCFG_SCREEN_UPDATE_DRIVER( pce_common_state, screen_update ) - MCFG_SCREEN_PALETTE("huc6260:palette") + MCFG_SCREEN_PALETTE("huc6260") MCFG_DEVICE_ADD( "huc6260", HUC6260, PCE_MAIN_CLOCK ) MCFG_HUC6260_NEXT_PIXEL_DATA_CB(READ16("huc6270", huc6270_device, next_pixel)) diff --git a/src/mame/drivers/pce.cpp b/src/mame/drivers/pce.cpp index e64b8044a02..38d5ec71e7c 100644 --- a/src/mame/drivers/pce.cpp +++ b/src/mame/drivers/pce.cpp @@ -328,7 +328,7 @@ MACHINE_CONFIG_START(pce_state::pce_common) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, huc6260_device::WPF, 64, 64 + 1024 + 64, huc6260_device::LPF, 18, 18 + 242) MCFG_SCREEN_UPDATE_DRIVER( pce_state, screen_update ) - MCFG_SCREEN_PALETTE("huc6260:palette") + MCFG_SCREEN_PALETTE("huc6260") MCFG_DEVICE_ADD( "huc6260", HUC6260, MAIN_CLOCK ) MCFG_HUC6260_NEXT_PIXEL_DATA_CB(READ16("huc6270", huc6270_device, next_pixel)) @@ -381,7 +381,7 @@ MACHINE_CONFIG_START(pce_state::sgx) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK, huc6260_device::WPF, 64, 64 + 1024 + 64, huc6260_device::LPF, 18, 18 + 242) MCFG_SCREEN_UPDATE_DRIVER( pce_state, screen_update ) - MCFG_SCREEN_PALETTE("huc6260:palette") + MCFG_SCREEN_PALETTE("huc6260") MCFG_DEVICE_ADD( "huc6260", HUC6260, MAIN_CLOCK ) MCFG_HUC6260_NEXT_PIXEL_DATA_CB(READ16("huc6202", huc6202_device, next_pixel)) diff --git a/src/mame/drivers/tourvis.cpp b/src/mame/drivers/tourvis.cpp index efb92d91124..4cd047a4d7c 100644 --- a/src/mame/drivers/tourvis.cpp +++ b/src/mame/drivers/tourvis.cpp @@ -406,7 +406,7 @@ MACHINE_CONFIG_START(tourvision_state::tourvision) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK, huc6260_device::WPF, 64, 64 + 1024 + 64, huc6260_device::LPF, 18, 18 + 242) MCFG_SCREEN_UPDATE_DRIVER( pce_common_state, screen_update ) - MCFG_SCREEN_PALETTE("huc6260:palette") + MCFG_SCREEN_PALETTE("huc6260") MCFG_DEVICE_ADD( "huc6260", HUC6260, PCE_MAIN_CLOCK ) MCFG_HUC6260_NEXT_PIXEL_DATA_CB(READ16("huc6270", huc6270_device, next_pixel)) diff --git a/src/mame/drivers/uapce.cpp b/src/mame/drivers/uapce.cpp index 73cdea326d2..115346972da 100644 --- a/src/mame/drivers/uapce.cpp +++ b/src/mame/drivers/uapce.cpp @@ -320,7 +320,7 @@ MACHINE_CONFIG_START(uapce_state::uapce) MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(PCE_MAIN_CLOCK, huc6260_device::WPF, 64, 64 + 1024 + 64, huc6260_device::LPF, 18, 18 + 242) MCFG_SCREEN_UPDATE_DRIVER( pce_common_state, screen_update ) - MCFG_SCREEN_PALETTE("huc6260:palette") + MCFG_SCREEN_PALETTE("huc6260") MCFG_DEVICE_ADD( "huc6260", HUC6260, PCE_MAIN_CLOCK ) MCFG_HUC6260_NEXT_PIXEL_DATA_CB(READ16("huc6270", huc6270_device, next_pixel))