vic3_device: converted to devcb2 (nw)

This is untestable at the moment, since c65 shows nothing but a black screen
This commit is contained in:
Ivan Vangelista 2014-04-18 07:44:39 +00:00
parent 5c8ee3b2a0
commit 169ad0268f
3 changed files with 125 additions and 149 deletions

View File

@ -145,39 +145,20 @@ const device_type VIC3 = &device_creator<vic3_device>;
vic3_device::vic3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, VIC3, "4567 VIC III", tag, owner, clock, "vic3", __FILE__),
device_video_interface(mconfig, *this),
m_type(VIC4567_NTSC),
m_cpu(*this),
m_dma_read_cb(*this),
m_dma_read_color_cb(*this),
m_interrupt_cb(*this),
m_port_changed_cb(*this),
m_lightpen_button_cb(*this),
m_lightpen_x_cb(*this),
m_lightpen_y_cb(*this),
m_c64_mem_r_cb(*this),
m_palette(*this, "palette")
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void vic3_device::device_config_complete()
{
// inherit a copy of the static data
const vic3_interface *intf = reinterpret_cast<const vic3_interface *>(static_config());
if (intf != NULL)
*static_cast<vic3_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
memset(&x_cb, 0, sizeof(x_cb));
memset(&y_cb, 0, sizeof(y_cb));
memset(&button_cb, 0, sizeof(button_cb));
memset(&dma_read, 0, sizeof(dma_read));
memset(&dma_read_color, 0, sizeof(dma_read_color));
memset(&irq, 0, sizeof(irq));
memset(&port_changed, 0, sizeof(port_changed));
memset(&c64_mem_r, 0, sizeof(c64_mem_r));
cpu_tag = "";
vic_type = VIC4567_NTSC;
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
@ -186,25 +167,22 @@ void vic3_device::device_start()
{
int width, height;
m_cpu = machine().device(cpu_tag);
width = m_screen->width();
height = m_screen->height();
m_bitmap = auto_bitmap_ind16_alloc(machine(), width, height);
m_type = vic_type;
m_dma_read_cb.resolve_safe(0);
m_dma_read_color_cb.resolve_safe(0);
m_interrupt_cb.resolve_safe();
m_dma_read.resolve(dma_read, *this);
m_dma_read_color.resolve(dma_read_color, *this);
m_interrupt.resolve(irq, *this);
m_port_changed_cb.resolve();
m_port_changed.resolve(port_changed, *this);
m_c64_mem_r_cb.resolve_safe(0);
m_c64_mem_r.resolve(c64_mem_r, *this);
m_lightpen_button_cb.resolve(button_cb, *this);
m_lightpen_x_cb.resolve(x_cb, *this);
m_lightpen_y_cb.resolve(y_cb, *this);
m_lightpen_button_cb.resolve_safe(0);
m_lightpen_x_cb.resolve_safe(0);
m_lightpen_y_cb.resolve_safe(0);
m_screenptr[0] = auto_alloc_array(machine(), UINT8, 216 * 656 / 8);
@ -401,7 +379,7 @@ void vic3_device::set_interrupt( int mask )
{
//DBG_LOG(2, "vic2", ("irq start %.2x\n", mask));
m_reg[0x19] |= 0x80;
m_interrupt(1);
m_interrupt_cb(1);
}
}
m_reg[0x19] |= mask;
@ -414,7 +392,7 @@ void vic3_device::clear_interrupt( int mask )
{
//DBG_LOG(2, "vic2", ("irq end %.2x\n", mask));
m_reg[0x19] &= ~0x80;
m_interrupt(0);
m_interrupt_cb(0);
}
}
@ -442,7 +420,7 @@ void vic3_device::draw_character( int ybegin, int yend, int ch, int yoff, int xo
for (int y = ybegin; y <= yend; y++)
{
code = m_dma_read(m_chargenaddr + ch * 8 + y);
code = m_dma_read_cb(m_chargenaddr + ch * 8 + y);
m_screenptr[y + yoff][xoff >> 3] = code;
if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = color[code >> 7];
if ((xoff + 1 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = color[(code >> 6) & 1];
@ -461,7 +439,7 @@ void vic3_device::draw_character_multi( int ybegin, int yend, int ch, int yoff,
for (int y = ybegin; y <= yend; y++)
{
code = m_dma_read(m_chargenaddr + ch * 8 + y);
code = m_dma_read_cb(m_chargenaddr + ch * 8 + y);
m_screenptr[y + yoff][xoff >> 3] = m_foreground[code];
if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = m_multi[code >> 6];
if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = m_multi[code >> 6];
@ -480,7 +458,7 @@ void vic3_device::draw_bitmap( int ybegin, int yend, int ch, int yoff, int xoff,
for (int y = ybegin; y <= yend; y++)
{
code = m_dma_read((m_chargenaddr & 0x2000) + ch * 8 + y);
code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y);
m_screenptr[y + yoff][xoff >> 3] = code;
if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = m_c64_bitmap[code >> 7];
if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = m_c64_bitmap[(code >> 6) & 1];
@ -499,7 +477,7 @@ void vic3_device::draw_bitmap_multi( int ybegin, int yend, int ch, int yoff, int
for (int y = ybegin; y <= yend; y++)
{
code = m_dma_read((m_chargenaddr & 0x2000) + ch * 8 + y);
code = m_dma_read_cb((m_chargenaddr & 0x2000) + ch * 8 + y);
m_screenptr[y + yoff][xoff >> 3] = m_foreground[code];
if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = m_bitmapmulti[code >> 6];
if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) m_bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = m_bitmapmulti[code >> 6];
@ -599,7 +577,7 @@ void vic3_device::draw_sprite( int nr, int yoff, int ybegin, int yend, int start
int value, value3 = 0;
xbegin = SPRITE_X_POS(nr);
addr = m_dma_read(SPRITE_ADDR(nr)) << 6;
addr = m_dma_read_cb(SPRITE_ADDR(nr)) << 6;
color = SPRITE_COLOR(nr);
prior = SPRITE_PRIORITY(nr);
collision = SPRITE_BG_COLLISION(nr);
@ -611,7 +589,7 @@ void vic3_device::draw_sprite( int nr, int yoff, int ybegin, int yend, int start
m_sprites[nr].paintedline[y] = 1;
for (i = 0; i < 3; i++)
{
value = m_expandx[m_dma_read(addr + m_sprites[nr].line * 3 + i)];
value = m_expandx[m_dma_read_cb(addr + m_sprites[nr].line * 3 + i)];
m_sprites[nr].bitmap[y][i * 2] = value >> 8;
m_sprites[nr].bitmap[y][i * 2 + 1] = value & 0xff;
sprite_collision(nr, y, xbegin + i * 16, value >> 8);
@ -653,7 +631,7 @@ void vic3_device::draw_sprite( int nr, int yoff, int ybegin, int yend, int start
m_sprites[nr].paintedline[y] = 1;
for (i = 0; i < 3; i++)
{
value = m_dma_read(addr + m_sprites[nr].line * 3 + i);
value = m_dma_read_cb(addr + m_sprites[nr].line * 3 + i);
m_sprites[nr].bitmap[y][i] = value;
sprite_collision(nr, y, xbegin + i * 8, value);
if (prior || !collision)
@ -693,7 +671,7 @@ void vic3_device::draw_sprite_multi( int nr, int yoff, int ybegin, int yend, int
int value, value2, value3 = 0, bg/*, color[2]*/;
xbegin = SPRITE_X_POS(nr);
addr = m_dma_read(SPRITE_ADDR(nr)) << 6;
addr = m_dma_read_cb(SPRITE_ADDR(nr)) << 6;
m_spritemulti[2] = SPRITE_COLOR(nr);
prior = SPRITE_PRIORITY(nr);
collision = SPRITE_BG_COLLISION(nr);
@ -707,7 +685,7 @@ void vic3_device::draw_sprite_multi( int nr, int yoff, int ybegin, int yend, int
m_sprites[nr].paintedline[y] = 1;
for (i = 0; i < 3; i++)
{
value = m_expandx_multi[bg = m_dma_read(addr + m_sprites[nr].line * 3 + i)];
value = m_expandx_multi[bg = m_dma_read_cb(addr + m_sprites[nr].line * 3 + i)];
value2 = m_expandx[m_multi_collision[bg]];
m_sprites[nr].bitmap[y][i * 2] = value2 >> 8;
m_sprites[nr].bitmap[y][i * 2 + 1] = value2 & 0xff;
@ -758,7 +736,7 @@ void vic3_device::draw_sprite_multi( int nr, int yoff, int ybegin, int yend, int
m_sprites[nr].paintedline[y] = 1;
for (i = 0; i < 3; i++)
{
value = m_dma_read(addr + m_sprites[nr].line * 3 + i);
value = m_dma_read_cb(addr + m_sprites[nr].line * 3 + i);
m_sprites[nr].bitmap[y][i] = value2 = m_multi_collision[value];
sprite_collision(nr, y, xbegin + i * 8, value2);
if (prior || !collision)
@ -883,8 +861,8 @@ void vic3_device::drawlines( int first, int last, int start_x, int end_x )
for (xoff = m_x_begin + XPOS; xoff < x_end2 + XPOS; xoff += 8, offs++)
{
ch = m_dma_read(m_videoaddr + offs);
attr = m_dma_read_color(m_videoaddr + offs);
ch = m_dma_read_cb(m_videoaddr + offs);
attr = m_dma_read_color_cb(m_videoaddr + offs);
if (HIRESON)
{
m_bitmapmulti[1] = m_c64_bitmap[1] = ch >> 4;
@ -1122,12 +1100,12 @@ void vic3_device::vic2_drawlines( int first, int last, int start_x, int end_x )
m_shift[line] = HORIZONTALPOS;
for (xoff = m_x_begin + XPOS; xoff < m_x_end + XPOS; xoff += 8, offs++)
{
ch = m_dma_read(m_videoaddr + offs);
ch = m_dma_read_cb(m_videoaddr + offs);
#if 0
attr = m_dma_read_color(m_videoaddr + offs);
attr = m_dma_read_color_cb(m_videoaddr + offs);
#else
/* temporaery until vic3 finished */
attr = m_dma_read_color((m_videoaddr + offs)&0x3ff)&0x0f;
/* temporary until vic3 finished */
attr = m_dma_read_color_cb((m_videoaddr + offs)&0x3ff)&0x0f;
#endif
if (HIRESON)
{
@ -1499,11 +1477,11 @@ WRITE8_MEMBER( vic3_device::port_w )
break;
case 0x30:
m_reg[offset] = data;
if (!m_port_changed.isnull())
if (!m_port_changed_cb.isnull())
{
DBG_LOG(2, "vic write", ("%.2x:%.2x\n", offset, data));
m_reg[offset] = data;
m_port_changed(0,data);
m_port_changed_cb((offs_t)0,data);
}
break;
case 0x31:
@ -1677,21 +1655,21 @@ READ8_MEMBER( vic3_device::port_r )
if (M) \
{ \
if (M & 0x01) \
colors[0] = m_c64_mem_r(VIC3_ADDR(0) + offset); \
colors[0] = m_c64_mem_r_cb(VIC3_ADDR(0) + offset); \
if (M & 0x02) \
colors[1] = m_c64_mem_r(VIC3_ADDR(1) + offset) << 1; \
colors[1] = m_c64_mem_r_cb(VIC3_ADDR(1) + offset) << 1; \
if (M & 0x04) \
colors[2] = m_c64_mem_r(VIC3_ADDR(2) + offset) << 2; \
colors[2] = m_c64_mem_r_cb(VIC3_ADDR(2) + offset) << 2; \
if (M & 0x08) \
colors[3] = m_c64_mem_r(VIC3_ADDR(3) + offset) << 3; \
colors[3] = m_c64_mem_r_cb(VIC3_ADDR(3) + offset) << 3; \
if (M & 0x10) \
colors[4] = m_c64_mem_r(VIC3_ADDR(4) + offset) << 4; \
colors[4] = m_c64_mem_r_cb(VIC3_ADDR(4) + offset) << 4; \
if (M & 0x20) \
colors[5] = m_c64_mem_r(VIC3_ADDR(5) + offset) << 5; \
colors[5] = m_c64_mem_r_cb(VIC3_ADDR(5) + offset) << 5; \
if (M & 0x40) \
colors[6] = m_c64_mem_r(VIC3_ADDR(6) + offset) << 6; \
colors[6] = m_c64_mem_r_cb(VIC3_ADDR(6) + offset) << 6; \
if (M & 0x80) \
colors[7] = m_c64_mem_r(VIC3_ADDR(7) + offset) << 7; \
colors[7] = m_c64_mem_r_cb(VIC3_ADDR(7) + offset) << 7; \
for (i = 7; i >= 0; i--) \
{ \
p = 0; \
@ -1767,28 +1745,28 @@ void vic3_device::interlace_draw_block( int x, int y, int offset )
break;
default:
if (VIC3_BITPLANES_MASK & 0x01)
colors[0] = m_c64_mem_r(VIC3_BITPLANE_IADDR(0) + offset);
colors[0] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(0) + offset);
if (VIC3_BITPLANES_MASK & 0x02)
colors[1] = m_c64_mem_r(VIC3_BITPLANE_IADDR(1) + offset) << 1;
colors[1] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(1) + offset) << 1;
if (VIC3_BITPLANES_MASK & 0x04)
colors[2] = m_c64_mem_r(VIC3_BITPLANE_IADDR(2) + offset) << 2;
colors[2] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(2) + offset) << 2;
if (VIC3_BITPLANES_MASK & 0x08)
colors[3] = m_c64_mem_r(VIC3_BITPLANE_IADDR(3) + offset) << 3;
colors[3] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(3) + offset) << 3;
if (VIC3_BITPLANES_MASK & 0x10)
colors[4] = m_c64_mem_r(VIC3_BITPLANE_IADDR(4) + offset) << 4;
colors[4] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(4) + offset) << 4;
if (VIC3_BITPLANES_MASK & 0x20)
colors[5] = m_c64_mem_r(VIC3_BITPLANE_IADDR(5) + offset) << 5;
colors[5] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(5) + offset) << 5;
if (VIC3_BITPLANES_MASK & 0x40)
colors[6] = m_c64_mem_r(VIC3_BITPLANE_IADDR(6) + offset) << 6;
colors[6] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(6) + offset) << 6;
if (VIC3_BITPLANES_MASK & 0x80)
colors[7] = m_c64_mem_r(VIC3_BITPLANE_IADDR(7) + offset) << 7;
colors[7] = m_c64_mem_r_cb(VIC3_BITPLANE_IADDR(7) + offset) << 7;
for (i = 7; i >= 0; i--)
{
@ -1838,28 +1816,28 @@ void vic3_device::draw_block( int x, int y, int offset )
break;
default:
if (VIC3_BITPLANES_MASK & 0x01)
colors[0] = m_c64_mem_r(VIC3_BITPLANE_ADDR(0) + offset);
colors[0] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(0) + offset);
if (VIC3_BITPLANES_MASK & 0x02)
colors[1] = m_c64_mem_r(VIC3_BITPLANE_ADDR(1) + offset) << 1;
colors[1] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(1) + offset) << 1;
if (VIC3_BITPLANES_MASK & 0x04)
colors[2] = m_c64_mem_r(VIC3_BITPLANE_ADDR(2) + offset) << 2;
colors[2] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(2) + offset) << 2;
if (VIC3_BITPLANES_MASK & 0x08)
colors[3] = m_c64_mem_r(VIC3_BITPLANE_ADDR(3) + offset) << 3;
colors[3] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(3) + offset) << 3;
if (VIC3_BITPLANES_MASK & 0x10)
colors[4] = m_c64_mem_r(VIC3_BITPLANE_ADDR(4) + offset) << 4;
colors[4] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(4) + offset) << 4;
if (VIC3_BITPLANES_MASK & 0x20)
colors[5] = m_c64_mem_r(VIC3_BITPLANE_ADDR(5) + offset) << 5;
colors[5] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(5) + offset) << 5;
if (VIC3_BITPLANES_MASK & 0x40)
colors[6] = m_c64_mem_r(VIC3_BITPLANE_ADDR(6) + offset) << 6;
colors[6] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(6) + offset) << 6;
if (VIC3_BITPLANES_MASK & 0x80)
colors[7] = m_c64_mem_r(VIC3_BITPLANE_ADDR(7) + offset) << 7;
colors[7] = m_c64_mem_r_cb(VIC3_BITPLANE_ADDR(7) + offset) << 7;
for (i = 7; i >= 0; i--)
{

View File

@ -18,26 +18,6 @@ enum vic3_type
VIC4567_PAL
};
struct vic3_interface
{
const char *cpu_tag;
vic3_type vic_type;
devcb_read8 x_cb;
devcb_read8 y_cb;
devcb_read8 button_cb;
devcb_read8 dma_read;
devcb_read8 dma_read_color;
devcb_write_line irq;
devcb_write8 port_changed;
devcb_read8 c64_mem_r;
};
#define SPRITE_BASE_X_SIZE 24
#define SPRITE_BASE_Y_SIZE 21
@ -139,13 +119,23 @@ struct vic3_sprite
***************************************************************************/
class vic3_device : public device_t,
public device_video_interface,
public vic3_interface
public device_video_interface
{
public:
vic3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~vic3_device() {}
static void static_set_cpu_tag(device_t &device, const char *tag) { downcast<vic3_device &>(device).m_cpu.set_tag(tag); }
static void set_vic3_type(device_t &device, vic3_type type) { downcast<vic3_device &>(device).m_type = type; }
template<class _Object> static devcb2_base &set_dma_read_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_dma_read_cb.set_callback(object); }
template<class _Object> static devcb2_base &set_dma_read_color_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_dma_read_color_cb.set_callback(object); }
template<class _Object> static devcb2_base &set_interrupt_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_interrupt_cb.set_callback(object); }
template<class _Object> static devcb2_base &set_port_changed_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_port_changed_cb.set_callback(object); }
template<class _Object> static devcb2_base &set_lightpen_button_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_lightpen_button_cb.set_callback(object); }
template<class _Object> static devcb2_base &set_lightpen_x_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_lightpen_x_cb.set_callback(object); }
template<class _Object> static devcb2_base &set_lightpen_y_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_lightpen_y_cb.set_callback(object); }
template<class _Object> static devcb2_base &set_c64_mem_r_callback(device_t &device, _Object object) { return downcast<vic3_device &>(device).m_c64_mem_r_cb.set_callback(object); }
DECLARE_WRITE8_MEMBER(port_w);
DECLARE_WRITE8_MEMBER(palette_w);
DECLARE_READ8_MEMBER(port_r);
@ -155,7 +145,6 @@ public:
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual machine_config_constructor device_mconfig_additions() const;
@ -185,7 +174,7 @@ private:
vic3_type m_type;
device_t *m_cpu;
required_device<cpu_device> m_cpu;
UINT8 m_reg[0x80];
int m_on; /* rastering of the screen */
@ -219,22 +208,22 @@ private:
vic3_sprite m_sprites[8];
/* DMA */
devcb_resolved_read8 m_dma_read;
devcb_resolved_read8 m_dma_read_color;
devcb2_read8 m_dma_read_cb;
devcb2_read8 m_dma_read_color_cb;
/* IRQ */
devcb_resolved_write_line m_interrupt;
devcb2_write_line m_interrupt_cb;
/* Port Changed */
devcb_resolved_write8 m_port_changed;
devcb2_write8 m_port_changed_cb;
/* lightpen */
devcb_resolved_read8 m_lightpen_button_cb;
devcb_resolved_read8 m_lightpen_x_cb;
devcb_resolved_read8 m_lightpen_y_cb;
devcb2_read8 m_lightpen_button_cb;
devcb2_read8 m_lightpen_x_cb;
devcb2_read8 m_lightpen_y_cb;
/* C64 memory access */
devcb_resolved_read8 m_c64_mem_r;
devcb2_read8 m_c64_mem_r_cb;
/* palette - vic3 specific items (the ones above are used for VIC II as well) */
UINT8 m_palette_red[0x100];
@ -248,10 +237,35 @@ private:
extern const device_type VIC3;
#define MCFG_VIC3_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, VIC3, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_VIC3_CPU(_tag) \
vic3_device::static_set_cpu_tag(*device, "^"_tag);
#define MCFG_VIC3_TYPE(_type) \
vic3_device::set_vic3_type(*device, _type);
#define MCFG_VIC3_DMA_READ_CB(_devcb) \
devcb = &vic3_device::set_dma_read_callback(*device, DEVCB2_##_devcb);
#define MCFG_VIC3_DMA_READ_COLOR_CB(_devcb) \
devcb = &vic3_device::set_dma_read_color_callback(*device, DEVCB2_##_devcb);
#define MCFG_VIC3_INTERRUPT_CB(_devcb) \
devcb = &vic3_device::set_interrupt_callback(*device, DEVCB2_##_devcb);
#define MCFG_VIC3_PORT_CHANGED_CB(_devcb) \
devcb = &vic3_device::set_port_changed_callback(*device, DEVCB2_##_devcb);
#define MCFG_VIC3_LIGHTPEN_BUTTON_CB(_devcb) \
devcb = &vic3_device::set_lightpen_button_callback(*device, DEVCB2_##_devcb);
#define MCFG_VIC3_LIGHTPEN_X_CB(_devcb) \
devcb = &vic3_device::set_lightpen_x_callback(*device, DEVCB2_##_devcb);
#define MCFG_VIC3_LIGHTPEN_Y_CB(_devcb) \
devcb = &vic3_device::set_lightpen_y_callback(*device, DEVCB2_##_devcb);
#define MCFG_VIC3_C64_MEM_R_CB(_devcb) \
devcb = &vic3_device::set_c64_mem_r_callback(*device, DEVCB2_##_devcb);
#endif /* __VIC4567_H__ */

View File

@ -505,32 +505,6 @@ READ8_MEMBER(c65_state::c65_c64_mem_r)
return m_memory[offset];
}
static const vic3_interface c65_vic3_ntsc_intf = {
"maincpu",
VIC4567_NTSC,
DEVCB_DRIVER_MEMBER(c65_state,c65_lightpen_x_cb),
DEVCB_DRIVER_MEMBER(c65_state,c65_lightpen_y_cb),
DEVCB_DRIVER_MEMBER(c65_state,c65_lightpen_button_cb),
DEVCB_DRIVER_MEMBER(c65_state,c65_dma_read),
DEVCB_DRIVER_MEMBER(c65_state,c65_dma_read_color),
DEVCB_DRIVER_LINE_MEMBER(c65_state,c65_vic_interrupt),
DEVCB_DRIVER_MEMBER(c65_state,c65_bankswitch_interface),
DEVCB_DRIVER_MEMBER(c65_state,c65_c64_mem_r)
};
static const vic3_interface c65_vic3_pal_intf = {
"maincpu",
VIC4567_PAL,
DEVCB_DRIVER_MEMBER(c65_state,c65_lightpen_x_cb),
DEVCB_DRIVER_MEMBER(c65_state,c65_lightpen_y_cb),
DEVCB_DRIVER_MEMBER(c65_state,c65_lightpen_button_cb),
DEVCB_DRIVER_MEMBER(c65_state,c65_dma_read),
DEVCB_DRIVER_MEMBER(c65_state,c65_dma_read_color),
DEVCB_DRIVER_LINE_MEMBER(c65_state,c65_vic_interrupt),
DEVCB_DRIVER_MEMBER(c65_state,c65_bankswitch_interface),
DEVCB_DRIVER_MEMBER(c65_state,c65_c64_mem_r)
};
INTERRUPT_GEN_MEMBER(c65_state::vic3_raster_irq)
{
m_vic->raster_interrupt_gen();
@ -560,7 +534,17 @@ static MACHINE_CONFIG_START( c65, c65_state )
MCFG_SCREEN_UPDATE_DRIVER(c65_state, screen_update_c65)
MCFG_SCREEN_PALETTE("vic3:palette")
MCFG_VIC3_ADD("vic3", c65_vic3_ntsc_intf)
MCFG_DEVICE_ADD("vic3", VIC3, 0)
MCFG_VIC3_CPU("maincpu")
MCFG_VIC3_TYPE(VIC4567_NTSC)
MCFG_VIC3_LIGHTPEN_X_CB(READ8(c65_state, c65_lightpen_x_cb))
MCFG_VIC3_LIGHTPEN_Y_CB(READ8(c65_state, c65_lightpen_y_cb))
MCFG_VIC3_LIGHTPEN_BUTTON_CB(READ8(c65_state, c65_lightpen_button_cb))
MCFG_VIC3_DMA_READ_CB(READ8(c65_state, c65_dma_read))
MCFG_VIC3_DMA_READ_COLOR_CB(READ8(c65_state, c65_dma_read_color))
MCFG_VIC3_INTERRUPT_CB(WRITELINE(c65_state, c65_vic_interrupt))
MCFG_VIC3_PORT_CHANGED_CB(WRITE8(c65_state, c65_bankswitch_interface))
MCFG_VIC3_C64_MEM_R_CB(READ8(c65_state, c65_c64_mem_r))
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
@ -604,8 +588,8 @@ static MACHINE_CONFIG_DERIVED( c65pal, c65 )
MCFG_SCREEN_VISIBLE_AREA(VIC6569_STARTVISIBLECOLUMNS, (VIC6569_STARTVISIBLECOLUMNS + VIC6569_VISIBLECOLUMNS - 1) * 2, VIC6569_STARTVISIBLELINES, VIC6569_STARTVISIBLELINES + VIC6569_VISIBLELINES - 1)
MCFG_SCREEN_PALETTE("vic3:palette")
MCFG_DEVICE_REMOVE("vic3")
MCFG_VIC3_ADD("vic3", c65_vic3_pal_intf)
MCFG_DEVICE_MODIFY("vic3")
MCFG_VIC3_TYPE(VIC4567_PAL)
/* sound hardware */
MCFG_SOUND_REPLACE("sid_r", MOS8580, 1022727)