mirror of
https://github.com/holub/mame
synced 2025-07-02 16:49:22 +03:00
mos8563: Use device_palette_interface instead of creating palette subdevice (nw)
This commit is contained in:
parent
08973c15a3
commit
bbb25639e8
@ -1352,6 +1352,24 @@ void mos8563_device::device_start()
|
|||||||
data ^= 0xff;
|
data ^= 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VICE palette
|
||||||
|
set_pen_color(0, rgb_t::black());
|
||||||
|
set_pen_color(1, rgb_t(0x55, 0x55, 0x55));
|
||||||
|
set_pen_color(2, rgb_t(0x00, 0x00, 0xaa));
|
||||||
|
set_pen_color(3, rgb_t(0x55, 0x55, 0xff));
|
||||||
|
set_pen_color(4, rgb_t(0x00, 0xaa, 0x00));
|
||||||
|
set_pen_color(5, rgb_t(0x55, 0xff, 0x55));
|
||||||
|
set_pen_color(6, rgb_t(0x00, 0xaa, 0xaa));
|
||||||
|
set_pen_color(7, rgb_t(0x55, 0xff, 0xff));
|
||||||
|
set_pen_color(8, rgb_t(0xaa, 0x00, 0x00));
|
||||||
|
set_pen_color(9, rgb_t(0xff, 0x55, 0x55));
|
||||||
|
set_pen_color(10, rgb_t(0xaa, 0x00, 0xaa));
|
||||||
|
set_pen_color(11, rgb_t(0xff, 0x55, 0xff));
|
||||||
|
set_pen_color(12, rgb_t(0xaa, 0x55, 0x00));
|
||||||
|
set_pen_color(13, rgb_t(0xff, 0xff, 0x55));
|
||||||
|
set_pen_color(14, rgb_t(0xaa, 0xaa, 0xaa));
|
||||||
|
set_pen_color(15, rgb_t::white());
|
||||||
|
|
||||||
save_item(NAME(m_char_buffer));
|
save_item(NAME(m_char_buffer));
|
||||||
save_item(NAME(m_attr_buffer));
|
save_item(NAME(m_attr_buffer));
|
||||||
save_item(NAME(m_attribute_addr));
|
save_item(NAME(m_attribute_addr));
|
||||||
@ -1506,8 +1524,8 @@ ams40489_device::ams40489_device(const machine_config &mconfig, const char *tag,
|
|||||||
mos8563_device::mos8563_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
mos8563_device::mos8563_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: mc6845_device(mconfig, type, tag, owner, clock),
|
: mc6845_device(mconfig, type, tag, owner, clock),
|
||||||
device_memory_interface(mconfig, *this),
|
device_memory_interface(mconfig, *this),
|
||||||
m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(), address_map_constructor(FUNC(mos8563_device::mos8563_videoram_map), this)),
|
device_palette_interface(mconfig, *this),
|
||||||
m_palette(*this, "palette")
|
m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(), address_map_constructor(FUNC(mos8563_device::mos8563_videoram_map), this))
|
||||||
{
|
{
|
||||||
set_clock_scale(1.0/8);
|
set_clock_scale(1.0/8);
|
||||||
}
|
}
|
||||||
@ -1525,34 +1543,6 @@ mos8568_device::mos8568_device(const machine_config &mconfig, const char *tag, d
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MACHINE_CONFIG_START(mos8563_device::device_add_mconfig)
|
|
||||||
MCFG_PALETTE_ADD("palette", 16)
|
|
||||||
MCFG_PALETTE_INIT_OWNER(mos8563_device, mos8563)
|
|
||||||
MACHINE_CONFIG_END
|
|
||||||
|
|
||||||
|
|
||||||
// VICE palette
|
|
||||||
PALETTE_INIT_MEMBER(mos8563_device, mos8563)
|
|
||||||
{
|
|
||||||
palette.set_pen_color(0, rgb_t::black());
|
|
||||||
palette.set_pen_color(1, rgb_t(0x55, 0x55, 0x55));
|
|
||||||
palette.set_pen_color(2, rgb_t(0x00, 0x00, 0xaa));
|
|
||||||
palette.set_pen_color(3, rgb_t(0x55, 0x55, 0xff));
|
|
||||||
palette.set_pen_color(4, rgb_t(0x00, 0xaa, 0x00));
|
|
||||||
palette.set_pen_color(5, rgb_t(0x55, 0xff, 0x55));
|
|
||||||
palette.set_pen_color(6, rgb_t(0x00, 0xaa, 0xaa));
|
|
||||||
palette.set_pen_color(7, rgb_t(0x55, 0xff, 0xff));
|
|
||||||
palette.set_pen_color(8, rgb_t(0xaa, 0x00, 0x00));
|
|
||||||
palette.set_pen_color(9, rgb_t(0xff, 0x55, 0x55));
|
|
||||||
palette.set_pen_color(10, rgb_t(0xaa, 0x00, 0xaa));
|
|
||||||
palette.set_pen_color(11, rgb_t(0xff, 0x55, 0xff));
|
|
||||||
palette.set_pen_color(12, rgb_t(0xaa, 0x55, 0x00));
|
|
||||||
palette.set_pen_color(13, rgb_t(0xff, 0xff, 0x55));
|
|
||||||
palette.set_pen_color(14, rgb_t(0xaa, 0xaa, 0xaa));
|
|
||||||
palette.set_pen_color(15, rgb_t::white());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void mos8563_device::update_cursor_state()
|
void mos8563_device::update_cursor_state()
|
||||||
{
|
{
|
||||||
mc6845_device::update_cursor_state();
|
mc6845_device::update_cursor_state();
|
||||||
@ -1588,8 +1578,6 @@ uint8_t mos8563_device::draw_scanline(int y, bitmap_rgb32 &bitmap, const rectang
|
|||||||
|
|
||||||
MC6845_UPDATE_ROW( mos8563_device::vdc_update_row )
|
MC6845_UPDATE_ROW( mos8563_device::vdc_update_row )
|
||||||
{
|
{
|
||||||
const pen_t *pen = m_palette->pens();
|
|
||||||
|
|
||||||
ra += (m_vert_scroll & 0x0f);
|
ra += (m_vert_scroll & 0x0f);
|
||||||
ra &= 0x0f;
|
ra &= 0x0f;
|
||||||
|
|
||||||
@ -1627,7 +1615,7 @@ MC6845_UPDATE_ROW( mos8563_device::vdc_update_row )
|
|||||||
if (x < 0) x = 0;
|
if (x < 0) x = 0;
|
||||||
int color = BIT(code, 7) ? fg : bg;
|
int color = BIT(code, 7) ? fg : bg;
|
||||||
|
|
||||||
bitmap.pix32(vbp + y, hbp + x) = pen[de ? color : 0];
|
bitmap.pix32(vbp + y, hbp + x) = pen(de ? color : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1663,7 +1651,7 @@ MC6845_UPDATE_ROW( mos8563_device::vdc_update_row )
|
|||||||
if (x < 0) x = 0;
|
if (x < 0) x = 0;
|
||||||
int color = BIT(data, 7) ? fg : bg;
|
int color = BIT(data, 7) ? fg : bg;
|
||||||
|
|
||||||
bitmap.pix32(vbp + y, hbp + x) = pen[de ? color : 0];
|
bitmap.pix32(vbp + y, hbp + x) = pen(de ? color : 0);
|
||||||
|
|
||||||
if ((bit < 8) || !HSS_SEMI) data <<= 1;
|
if ((bit < 8) || !HSS_SEMI) data <<= 1;
|
||||||
}
|
}
|
||||||
|
@ -429,13 +429,12 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class mos8563_device : public mc6845_device,
|
class mos8563_device : public mc6845_device,
|
||||||
public device_memory_interface
|
public device_memory_interface,
|
||||||
|
public device_palette_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
mos8563_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
mos8563_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
virtual space_config_vector memory_space_config() const override;
|
|
||||||
|
|
||||||
DECLARE_WRITE8_MEMBER( address_w );
|
DECLARE_WRITE8_MEMBER( address_w );
|
||||||
DECLARE_READ8_MEMBER( status_r );
|
DECLARE_READ8_MEMBER( status_r );
|
||||||
DECLARE_READ8_MEMBER( register_r );
|
DECLARE_READ8_MEMBER( register_r );
|
||||||
@ -450,13 +449,17 @@ protected:
|
|||||||
mos8563_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
mos8563_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
// device-level overrides
|
// device-level overrides
|
||||||
virtual void device_add_mconfig(machine_config &config) override;
|
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual void device_reset() 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_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||||
|
|
||||||
|
// device_memory_interface overrides
|
||||||
|
virtual space_config_vector memory_space_config() const override;
|
||||||
|
|
||||||
|
// device_palette_interface overrides
|
||||||
|
virtual uint32_t palette_entries() const override { return 16; }
|
||||||
|
|
||||||
const address_space_config m_videoram_space_config;
|
const address_space_config m_videoram_space_config;
|
||||||
required_device<palette_device> m_palette;
|
|
||||||
|
|
||||||
uint8_t m_char_buffer[80];
|
uint8_t m_char_buffer[80];
|
||||||
uint8_t m_attr_buffer[80];
|
uint8_t m_attr_buffer[80];
|
||||||
@ -490,8 +493,6 @@ protected:
|
|||||||
|
|
||||||
emu_timer *m_block_copy_timer;
|
emu_timer *m_block_copy_timer;
|
||||||
|
|
||||||
DECLARE_PALETTE_INIT(mos8563);
|
|
||||||
|
|
||||||
void mos8563_videoram_map(address_map &map);
|
void mos8563_videoram_map(address_map &map);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1730,7 +1730,7 @@ MACHINE_CONFIG_START(c128_state::ntsc)
|
|||||||
MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1)
|
MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1)
|
||||||
MCFG_SCREEN_UPDATE_DEVICE(MOS8564_TAG, mos8564_device, screen_update)
|
MCFG_SCREEN_UPDATE_DEVICE(MOS8564_TAG, mos8564_device, screen_update)
|
||||||
|
|
||||||
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, MOS8563_TAG":palette", gfx_c128)
|
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, MOS8563_TAG, gfx_c128)
|
||||||
|
|
||||||
// sound hardware
|
// sound hardware
|
||||||
SPEAKER(config, "speaker").front_center();
|
SPEAKER(config, "speaker").front_center();
|
||||||
@ -1904,7 +1904,7 @@ MACHINE_CONFIG_START(c128_state::pal)
|
|||||||
MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1)
|
MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1)
|
||||||
MCFG_SCREEN_UPDATE_DEVICE(MOS8566_TAG, mos8566_device, screen_update)
|
MCFG_SCREEN_UPDATE_DEVICE(MOS8566_TAG, mos8566_device, screen_update)
|
||||||
|
|
||||||
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, MOS8563_TAG":palette", gfx_c128)
|
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, MOS8563_TAG, gfx_c128)
|
||||||
|
|
||||||
// sound hardware
|
// sound hardware
|
||||||
SPEAKER(config, "speaker").front_center();
|
SPEAKER(config, "speaker").front_center();
|
||||||
|
Loading…
Reference in New Issue
Block a user