From 0034b75f16d1e6c18fb4bec180fa054c505f2321 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Fri, 7 Sep 2012 14:43:37 +0000 Subject: [PATCH] (MESS) mos6566: Added VIC-IIe variants. (nw) --- src/emu/sound/mos6560.c | 2 +- src/mess/video/mos6566.c | 59 +++++++++++++++++++++++++-------------- src/mess/video/mos6566.h | 60 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 21 deletions(-) diff --git a/src/emu/sound/mos6560.c b/src/emu/sound/mos6560.c index 50a9d4d8575..73dedc8d81d 100644 --- a/src/emu/sound/mos6560.c +++ b/src/emu/sound/mos6560.c @@ -123,9 +123,9 @@ #define FRAMECOLOR (m_reg[0x0f] & 0x07) +// VICE palette static const rgb_t PALETTE[] = { -/* ripped from vice, a very excellent emulator */ MAKE_RGB(0x00, 0x00, 0x00), MAKE_RGB(0xff, 0xff, 0xff), MAKE_RGB(0xf0, 0x00, 0x00), diff --git a/src/mess/video/mos6566.c b/src/mess/video/mos6566.c index 168fe8c44b3..3e2550b1778 100644 --- a/src/mess/video/mos6566.c +++ b/src/mess/video/mos6566.c @@ -23,7 +23,6 @@ - cleanup - light pen - remove RDY hack - - VIC IIe - http://hitmen.c02.at/temp/palstuff/ */ @@ -91,17 +90,25 @@ enum }; -static const UINT8 PALETTE[] = +// VICE palette +static const rgb_t PALETTE[] = { -// black, white, red, cyan -// purple, green, blue, yellow -// orange, brown, light red, dark gray, -// medium gray, light green, light blue, light gray -// taken from the vice emulator - 0x00, 0x00, 0x00, 0xfd, 0xfe, 0xfc, 0xbe, 0x1a, 0x24, 0x30, 0xe6, 0xc6, - 0xb4, 0x1a, 0xe2, 0x1f, 0xd2, 0x1e, 0x21, 0x1b, 0xae, 0xdf, 0xf6, 0x0a, - 0xb8, 0x41, 0x04, 0x6a, 0x33, 0x04, 0xfe, 0x4a, 0x57, 0x42, 0x45, 0x40, - 0x70, 0x74, 0x6f, 0x59, 0xfe, 0x59, 0x5f, 0x53, 0xfe, 0xa4, 0xa7, 0xa2 + MAKE_RGB(0x00, 0x00, 0x00), + MAKE_RGB(0xfd, 0xfe, 0xfc), + MAKE_RGB(0xbe, 0x1a, 0x24), + MAKE_RGB(0x30, 0xe6, 0xc6), + MAKE_RGB(0xb4, 0x1a, 0xe2), + MAKE_RGB(0x1f, 0xd2, 0x1e), + MAKE_RGB(0x21, 0x1b, 0xae), + MAKE_RGB(0xdf, 0xf6, 0x0a), + MAKE_RGB(0xb8, 0x41, 0x04), + MAKE_RGB(0x6a, 0x33, 0x04), + MAKE_RGB(0xfe, 0x4a, 0x57), + MAKE_RGB(0x42, 0x45, 0x40), + MAKE_RGB(0x70, 0x74, 0x6f), + MAKE_RGB(0x59, 0xfe, 0x59), + MAKE_RGB(0x5f, 0x53, 0xfe), + MAKE_RGB(0xa4, 0xa7, 0xa2) }; @@ -209,8 +216,10 @@ static const UINT8 PALETTE[] = const device_type MOS6566 = &device_creator; const device_type MOS6567 = &device_creator; const device_type MOS8562 = &device_creator; +const device_type MOS8564 = &device_creator; const device_type MOS6569 = &device_creator; const device_type MOS8565 = &device_creator; +const device_type MOS8566 = &device_creator; // default address maps @@ -560,6 +569,9 @@ mos6567_device::mos6567_device(const machine_config &mconfig, device_type type, mos8562_device::mos8562_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :mos6567_device(mconfig, MOS8562, "MOS8562", tag, owner, clock) { m_variant = TYPE_8562; } +mos8564_device::mos8564_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + :mos6567_device(mconfig, MOS8564, "MOS8564", tag, owner, clock) { m_variant = TYPE_8564; } + mos6569_device::mos6569_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :mos6566_device(mconfig, MOS6566, "MOS6569", tag, owner, clock) { m_variant = TYPE_6569; } @@ -569,6 +581,9 @@ mos6569_device::mos6569_device(const machine_config &mconfig, device_type type, mos8565_device::mos8565_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :mos6569_device(mconfig, MOS8565, "MOS8565", tag, owner, clock) { m_variant = TYPE_8565; } +mos8566_device::mos8566_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + :mos6569_device(mconfig, MOS8566, "MOS8566", tag, owner, clock) { m_variant = TYPE_8566; } + //------------------------------------------------- // device_config_complete - perform any @@ -617,14 +632,9 @@ void mos6566_device::device_start() m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); // initialize palette - int i; + palette_set_colors(machine(), 0, PALETTE, ARRAY_LENGTH(PALETTE)); - for (i = 0; i < 16; i++) - { - palette_set_color_rgb(machine(), i, PALETTE[i * 3], PALETTE[i * 3 + 1], PALETTE[i * 3 + 2]); - } - - for (i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) { m_expandx[i] = 0; if (i & 1) @@ -645,7 +655,7 @@ void mos6566_device::device_start() m_expandx[i] |= 0xc000; } - for (i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) { m_expandx_multi[i] = 0; if (i & 1) @@ -717,7 +727,7 @@ void mos6566_device::device_start() save_item(NAME(m_mc_base)); save_item(NAME(m_mc)); - for (i = 0; i < 8; i++) + for (int i = 0; i < 8; i++) { save_item(NAME(m_spr_data[i]), i); save_item(NAME(m_spr_draw_data[i]), i); @@ -2829,3 +2839,12 @@ UINT8 mos6566_device::bus_r() { return m_last_data; } + + +READ_LINE_MEMBER( mos8564_device::k0_r ) { return VIC2E_K0_LEVEL; } +READ_LINE_MEMBER( mos8564_device::k1_r ) { return VIC2E_K1_LEVEL; } +READ_LINE_MEMBER( mos8564_device::k2_r ) { return VIC2E_K2_LEVEL; } + +READ_LINE_MEMBER( mos8566_device::k0_r ) { return VIC2E_K0_LEVEL; } +READ_LINE_MEMBER( mos8566_device::k1_r ) { return VIC2E_K1_LEVEL; } +READ_LINE_MEMBER( mos8566_device::k2_r ) { return VIC2E_K2_LEVEL; } diff --git a/src/mess/video/mos6566.h b/src/mess/video/mos6566.h index d8415b9ab3d..8937fbe27ab 100644 --- a/src/mess/video/mos6566.h +++ b/src/mess/video/mos6566.h @@ -127,6 +127,18 @@ MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8562_device, screen_update) \ MCFG_PALETTE_LENGTH(16) +#define MCFG_MOS8564_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \ + MCFG_DEVICE_ADD(_tag, MOS8564, _clock) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \ + MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \ + MCFG_SCREEN_ADD(_screen_tag, RASTER) \ + MCFG_SCREEN_REFRESH_RATE(VIC6567_VRETRACERATE) \ + MCFG_SCREEN_SIZE(VIC6567_COLUMNS, VIC6567_LINES) \ + MCFG_SCREEN_VISIBLE_AREA(0, VIC6567_VISIBLECOLUMNS - 1, 0, VIC6567_VISIBLELINES - 1) \ + MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8562_device, screen_update) \ + MCFG_PALETTE_LENGTH(16+16) // 16 for VIC, 16 for VDC + #define MCFG_MOS6569_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \ MCFG_DEVICE_ADD(_tag, MOS6569, _clock) \ MCFG_DEVICE_CONFIG(_config) \ @@ -151,6 +163,18 @@ MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8565_device, screen_update) \ MCFG_PALETTE_LENGTH(16) +#define MCFG_MOS8566_ADD(_tag, _screen_tag, _clock, _config, _videoram_map, _colorram_map) \ + MCFG_DEVICE_ADD(_tag, MOS8566, _clock) \ + MCFG_DEVICE_CONFIG(_config) \ + MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \ + MCFG_DEVICE_ADDRESS_MAP(AS_1, _colorram_map) \ + MCFG_SCREEN_ADD(_screen_tag, RASTER) \ + MCFG_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE) \ + MCFG_SCREEN_SIZE(VIC6569_COLUMNS, VIC6569_LINES) \ + MCFG_SCREEN_VISIBLE_AREA(0, VIC6569_VISIBLECOLUMNS - 1, 0, VIC6569_VISIBLELINES - 1) \ + MCFG_SCREEN_UPDATE_DEVICE(_tag, mos8565_device, screen_update) \ + MCFG_PALETTE_LENGTH(16+16) // 16 for VIC, 16 for VDC + #define MOS6566_INTERFACE(_name) \ const mos6566_interface (_name) = @@ -158,9 +182,15 @@ #define MOS6567_INTERFACE(_name) \ const mos6566_interface (_name) = +#define MOS8564_INTERFACE(_name) \ + const mos6566_interface (_name) = + #define MOS6569_INTERFACE(_name) \ const mos6566_interface (_name) = +#define MOS8566_INTERFACE(_name) \ + const mos6566_interface (_name) = + //************************************************************************** @@ -455,6 +485,20 @@ public: }; +// ======================> mos8564_device + +class mos8564_device : public mos6567_device +{ +public: + // construction/destruction + mos8564_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ_LINE_MEMBER( k0_r ); + DECLARE_READ_LINE_MEMBER( k1_r ); + DECLARE_READ_LINE_MEMBER( k2_r ); +}; + + // ======================> mos6569_device class mos6569_device : public mos6566_device @@ -479,12 +523,28 @@ public: }; +// ======================> mos8566_device + +class mos8566_device : public mos6569_device +{ +public: + // construction/destruction + mos8566_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + DECLARE_READ_LINE_MEMBER( k0_r ); + DECLARE_READ_LINE_MEMBER( k1_r ); + DECLARE_READ_LINE_MEMBER( k2_r ); +}; + + // device type definitions extern const device_type MOS6566; extern const device_type MOS6567; extern const device_type MOS8562; +extern const device_type MOS8564; extern const device_type MOS6569; extern const device_type MOS8565; +extern const device_type MOS8566;