start cleaning c65 (nw)

This commit is contained in:
Miodrag Milanovic 2013-04-18 09:12:53 +00:00
parent f30a311780
commit 8ce88f330f
5 changed files with 175 additions and 188 deletions

View File

@ -201,44 +201,43 @@ PALETTE_INIT_MEMBER(c65_state,c65)
*
*************************************/
static int c64_paddle_read( device_t *device, address_space &space, int which )
int c65_state::c64_paddle_read( device_t *device, address_space &space, int which )
{
running_machine &machine = device->machine();
int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp;
UINT8 cia0porta = mos6526_pa_r(machine.device("cia_0"), space, 0);
int controller1 = machine.root_device().ioport("CTRLSEL")->read() & 0x07;
int controller2 = machine.root_device().ioport("CTRLSEL")->read() & 0x70;
UINT8 cia0porta = mos6526_pa_r(machine().device("cia_0"), space, 0);
int controller1 = machine().root_device().ioport("CTRLSEL")->read() & 0x07;
int controller2 = machine().root_device().ioport("CTRLSEL")->read() & 0x70;
/* Notice that only a single input is defined for Mouse & Lightpen in both ports */
switch (controller1)
{
case 0x01:
if (which)
pot2 = machine.root_device().ioport("PADDLE2")->read();
pot2 = machine().root_device().ioport("PADDLE2")->read();
else
pot1 = machine.root_device().ioport("PADDLE1")->read();
pot1 = machine().root_device().ioport("PADDLE1")->read();
break;
case 0x02:
if (which)
pot2 = machine.root_device().ioport("TRACKY")->read();
pot2 = machine().root_device().ioport("TRACKY")->read();
else
pot1 = machine.root_device().ioport("TRACKX")->read();
pot1 = machine().root_device().ioport("TRACKX")->read();
break;
case 0x03:
if (which && (machine.root_device().ioport("JOY1_2B")->read() & 0x20)) /* Joy1 Button 2 */
if (which && (machine().root_device().ioport("JOY1_2B")->read() & 0x20)) /* Joy1 Button 2 */
pot1 = 0x00;
break;
case 0x04:
if (which)
pot2 = machine.root_device().ioport("LIGHTY")->read();
pot2 = machine().root_device().ioport("LIGHTY")->read();
else
pot1 = machine.root_device().ioport("LIGHTX")->read();
pot1 = machine().root_device().ioport("LIGHTX")->read();
break;
case 0x06:
if (which && (machine.root_device().ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */
if (which && (machine().root_device().ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */
pot2 = 0x00;
break;
@ -255,32 +254,32 @@ static int c64_paddle_read( device_t *device, address_space &space, int which )
{
case 0x10:
if (which)
pot4 = machine.root_device().ioport("PADDLE4")->read();
pot4 = machine().root_device().ioport("PADDLE4")->read();
else
pot3 = machine.root_device().ioport("PADDLE3")->read();
pot3 = machine().root_device().ioport("PADDLE3")->read();
break;
case 0x20:
if (which)
pot4 = machine.root_device().ioport("TRACKY")->read();
pot4 = machine().root_device().ioport("TRACKY")->read();
else
pot3 = machine.root_device().ioport("TRACKX")->read();
pot3 = machine().root_device().ioport("TRACKX")->read();
break;
case 0x30:
if (which && (machine.root_device().ioport("JOY2_2B")->read() & 0x20)) /* Joy2 Button 2 */
if (which && (machine().root_device().ioport("JOY2_2B")->read() & 0x20)) /* Joy2 Button 2 */
pot4 = 0x00;
break;
case 0x40:
if (which)
pot4 = machine.root_device().ioport("LIGHTY")->read();
pot4 = machine().root_device().ioport("LIGHTY")->read();
else
pot3 = machine.root_device().ioport("LIGHTX")->read();
pot3 = machine().root_device().ioport("LIGHTX")->read();
break;
case 0x60:
if (which && (machine.root_device().ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */
if (which && (machine().root_device().ioport("OTHER")->read() & 0x04)) /* Lightpen Signal */
pot4 = 0x00;
break;
@ -293,7 +292,7 @@ static int c64_paddle_read( device_t *device, address_space &space, int which )
break;
}
if (machine.root_device().ioport("CTRLSEL")->read() & 0x80) /* Swap */
if (machine().root_device().ioport("CTRLSEL")->read() & 0x80) /* Swap */
{
temp = pot1; pot1 = pot3; pot3 = temp;
temp = pot2; pot2 = pot4; pot4 = temp;
@ -344,53 +343,52 @@ UINT32 c65_state::screen_update_c65(screen_device &screen, bitmap_ind16 &bitmap,
return 0;
}
static UINT8 c65_lightpen_x_cb( running_machine &machine )
READ8_MEMBER(c65_state::c65_lightpen_x_cb)
{
return machine.root_device().ioport("LIGHTX")->read() & ~0x01;
return machine().root_device().ioport("LIGHTX")->read() & ~0x01;
}
static UINT8 c65_lightpen_y_cb( running_machine &machine )
READ8_MEMBER(c65_state::c65_lightpen_y_cb)
{
return machine.root_device().ioport("LIGHTY")->read() & ~0x01;
return machine().root_device().ioport("LIGHTY")->read() & ~0x01;
}
static UINT8 c65_lightpen_button_cb( running_machine &machine )
READ8_MEMBER(c65_state::c65_lightpen_button_cb)
{
return machine.root_device().ioport("OTHER")->read() & 0x04;
return machine().root_device().ioport("OTHER")->read() & 0x04;
}
static UINT8 c65_c64_mem_r( running_machine &machine, int offset )
READ8_MEMBER(c65_state::c65_c64_mem_r)
{
c65_state *state = machine.driver_data<c65_state>();
return state->m_memory[offset];
return m_memory[offset];
}
static const vic3_interface c65_vic3_ntsc_intf = {
"screen",
"maincpu",
VIC4567_NTSC,
c65_lightpen_x_cb,
c65_lightpen_y_cb,
c65_lightpen_button_cb,
c65_dma_read,
c65_dma_read_color,
c65_vic_interrupt,
c65_bankswitch_interface,
c65_c64_mem_r
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 = {
"screen",
"maincpu",
VIC4567_PAL,
c65_lightpen_x_cb,
c65_lightpen_y_cb,
c65_lightpen_button_cb,
c65_dma_read,
c65_dma_read_color,
c65_vic_interrupt,
c65_bankswitch_interface,
c65_c64_mem_r
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)

View File

@ -142,6 +142,16 @@ public:
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( c64_cart );
DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( c64_cart );
DECLARE_WRITE_LINE_MEMBER(c65_cia0_interrupt);
DECLARE_READ8_MEMBER(c65_lightpen_x_cb);
DECLARE_READ8_MEMBER(c65_lightpen_y_cb);
DECLARE_READ8_MEMBER(c65_lightpen_button_cb);
DECLARE_READ8_MEMBER(c65_c64_mem_r);
DECLARE_READ8_MEMBER(c65_dma_read);
DECLARE_READ8_MEMBER(c65_dma_read_color);
DECLARE_WRITE_LINE_MEMBER(c65_vic_interrupt);
DECLARE_WRITE8_MEMBER(c65_bankswitch_interface);
int c64_paddle_read( device_t *device, address_space &space, int which );
required_device<cpu_device> m_maincpu;
};
@ -158,11 +168,6 @@ public:
void c65_bankswitch (running_machine &machine);
//void c65_colorram_write (running_machine &machine, int offset, int value);
int c65_dma_read(running_machine &machine, int offset);
int c65_dma_read_color(running_machine &machine, int offset);
void c65_vic_interrupt(running_machine &machine, int level);
void c65_bankswitch_interface(running_machine &machine, int value);
extern const legacy_mos6526_interface c65_cia0;
extern const legacy_mos6526_interface c65_cia1;

View File

@ -114,15 +114,14 @@ WRITE_LINE_MEMBER(c65_state::c65_cia0_interrupt)
}
/* is this correct for c65 as well as c64? */
void c65_vic_interrupt( running_machine &machine, int level )
WRITE_LINE_MEMBER(c65_state::c65_vic_interrupt)
{
c65_state *state = machine.driver_data<c65_state>();
device_t *cia_0 = machine.device("cia_0");
device_t *cia_0 = machine().device("cia_0");
#if 1
if (level != state->m_vicirq)
if (state != m_vicirq)
{
c65_irq (machine, level || mos6526_irq_r(cia_0));
state->m_vicirq = level;
c65_irq (machine(), state || mos6526_irq_r(cia_0));
m_vicirq = state;
}
#endif
}
@ -777,57 +776,56 @@ d02f:
/* bit 1 external sync enable (genlock)
bit 2 palette enable
bit 6 vic3 c65 character set */
void c65_bankswitch_interface( running_machine &machine, int value )
WRITE8_MEMBER(c65_state::c65_bankswitch_interface)
{
c65_state *state = machine.driver_data<c65_state>();
DBG_LOG(machine, 2, "c65 bankswitch", ("%.2x\n",value));
DBG_LOG(machine(), 2, "c65 bankswitch", ("%.2x\n",data));
if (state->m_io_on)
if (m_io_on)
{
if (value & 1)
if (data & 1)
{
state->membank("bank8")->set_base(state->m_colorram + 0x400);
state->membank("bank9")->set_base(state->m_colorram + 0x400);
state->m_maincpu->space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8");
state->m_maincpu->space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9");
membank("bank8")->set_base(m_colorram + 0x400);
membank("bank9")->set_base(m_colorram + 0x400);
m_maincpu->space(AS_PROGRAM).install_read_bank(0x0dc00, 0x0dfff, "bank8");
m_maincpu->space(AS_PROGRAM).install_write_bank(0x0dc00, 0x0dfff, "bank9");
}
else
{
state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x0dc00, 0x0dfff, FUNC(c65_read_io_dc00));
state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x0dc00, 0x0dfff, FUNC(c65_write_io_dc00));
m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x0dc00, 0x0dfff, FUNC(c65_read_io_dc00));
m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x0dc00, 0x0dfff, FUNC(c65_write_io_dc00));
}
}
state->m_io_dc00_on = !(value & 1);
m_io_dc00_on = !(data & 1);
#if 0
/* cartridge roms !?*/
if (value & 0x08)
state->membank("bank1")->set_base(state->m_roml);
if (data & 0x08)
membank("bank1")->set_base(m_roml);
else
state->membank("bank1")->set_base(state->m_memory + 0x8000);
membank("bank1")->set_base(m_memory + 0x8000);
if (value & 0x10)
state->membank("bank2")->set_base(state->m_basic);
if (data & 0x10)
membank("bank2")->set_base(m_basic);
else
state->membank("bank2")->set_base(state->m_memory + 0xa000);
membank("bank2")->set_base(m_memory + 0xa000);
#endif
if ((state->m_old_value^value) & 0x20)
if ((m_old_value^data) & 0x20)
{
/* bankswitching faulty when doing actual page */
if (value & 0x20)
state->membank("bank3")->set_base(state->m_basic);
if (data & 0x20)
membank("bank3")->set_base(m_basic);
else
state->membank("bank3")->set_base(state->m_memory + 0xc000);
membank("bank3")->set_base(m_memory + 0xc000);
}
state->m_charset_select = value & 0x40;
m_charset_select = data & 0x40;
#if 0
/* cartridge roms !?*/
if (value & 0x80)
state->membank("bank8")->set_base(state->m_kernal);
if (data & 0x80)
membank("bank8")->set_base(m_kernal);
else
state->membank("bank6")->set_base(state->m_memory + 0xe000);
membank("bank6")->set_base(m_memory + 0xe000);
#endif
state->m_old_value = value;
m_old_value = data;
}
void c65_bankswitch( running_machine &machine )
@ -930,36 +928,34 @@ void c65_colorram_write( running_machine &machine, int offset, int value )
* a15 and a14 portlines
* 0x1000-0x1fff, 0x9000-0x9fff char rom
*/
int c65_dma_read( running_machine &machine, int offset )
READ8_MEMBER(c65_state::c65_dma_read)
{
c65_state *state = machine.driver_data<c65_state>();
if (!state->m_game && state->m_exrom)
if (!m_game && m_exrom)
{
if (offset < 0x3000)
return state->m_memory[offset];
return state->m_romh[offset & 0x1fff];
return m_memory[offset];
return m_romh[offset & 0x1fff];
}
if ((state->m_vicaddr == state->m_memory) || (state->m_vicaddr == state->m_memory + 0x8000))
if ((m_vicaddr == m_memory) || (m_vicaddr == m_memory + 0x8000))
{
if (offset < 0x1000)
return state->m_vicaddr[offset & 0x3fff];
return m_vicaddr[offset & 0x3fff];
if (offset < 0x2000) {
if (state->m_charset_select)
return state->m_chargen[offset & 0xfff];
if (m_charset_select)
return m_chargen[offset & 0xfff];
else
return state->m_chargen[offset & 0xfff];
return m_chargen[offset & 0xfff];
}
return state->m_vicaddr[offset & 0x3fff];
return m_vicaddr[offset & 0x3fff];
}
return state->m_vicaddr[offset & 0x3fff];
return m_vicaddr[offset & 0x3fff];
}
int c65_dma_read_color( running_machine &machine, int offset )
READ8_MEMBER(c65_state::c65_dma_read_color)
{
c65_state *state = machine.driver_data<c65_state>();
if (state->m_c64mode)
return state->m_colorram[offset & 0x3ff] & 0xf;
return state->m_colorram[offset & 0x7ff];
if (m_c64mode)
return m_colorram[offset & 0x3ff] & 0xf;
return m_colorram[offset & 0x7ff];
}
static void c65_common_driver_init( running_machine &machine )
@ -1013,7 +1009,7 @@ MACHINE_START_MEMBER(c65_state,c65)
m_c64mode = 0;
c65_bankswitch_interface(machine(), 0xff);
c65_bankswitch_interface(m_maincpu->space(AS_PROGRAM),0,0xff);
c65_bankswitch (machine());
}

View File

@ -71,22 +71,22 @@ struct vic3_state
vic3_sprite sprites[8];
/* DMA */
vic3_dma_read dma_read;
vic3_dma_read_color dma_read_color;
devcb_resolved_read8 dma_read;
devcb_resolved_read8 dma_read_color;
/* IRQ */
vic3_irq interrupt;
devcb_resolved_write_line interrupt;
/* Port Changed */
vic3_port_changed_callback port_changed;
devcb_resolved_write8 port_changed;
/* lightpen */
vic3_lightpen_button_callback lightpen_button_cb;
vic3_lightpen_x_callback lightpen_x_cb;
vic3_lightpen_y_callback lightpen_y_cb;
devcb_resolved_read8 lightpen_button_cb;
devcb_resolved_read8 lightpen_x_cb;
devcb_resolved_read8 lightpen_y_cb;
/* C64 memory access */
vic3_c64mem_callback c64_mem_r;
devcb_resolved_read8 c64_mem_r;
/* palette - vic3 specific items (the ones above are used for VIC II as well) */
UINT8 palette_red[0x100];
@ -122,9 +122,9 @@ struct vic3_state
/* 2008-05 FP: lightpen code needs to read input port from c64.c and cbmb.c */
#define LIGHTPEN_BUTTON (vic3->lightpen_button_cb(machine))
#define LIGHTPEN_X_VALUE (vic3->lightpen_x_cb(machine))
#define LIGHTPEN_Y_VALUE (vic3->lightpen_y_cb(machine))
#define LIGHTPEN_BUTTON (vic3->lightpen_button_cb(0))
#define LIGHTPEN_X_VALUE (vic3->lightpen_x_cb(0))
#define LIGHTPEN_Y_VALUE (vic3->lightpen_y_cb(0))
/* lightpen delivers values from internal counters; they do not start with the visual area or frame area */
#define VIC2_MAME_XPOS 0
@ -262,7 +262,7 @@ static void vic3_set_interrupt( running_machine &machine, int mask, vic3_state *
{
//DBG_LOG(2, "vic2", ("irq start %.2x\n", mask));
vic3->reg[0x19] |= 0x80;
vic3->interrupt(machine, 1);
vic3->interrupt(1);
}
}
vic3->reg[0x19] |= mask;
@ -275,7 +275,7 @@ static void vic3_clear_interrupt( running_machine &machine, int mask, vic3_state
{
//DBG_LOG(2, "vic2", ("irq end %.2x\n", mask));
vic3->reg[0x19] &= ~0x80;
vic3->interrupt(machine, 0);
vic3->interrupt(0);
}
}
@ -304,7 +304,7 @@ static void vic3_draw_character( device_t *device, int ybegin, int yend, int ch,
for (y = ybegin; y <= yend; y++)
{
code = vic3->dma_read(device->machine(), vic3->chargenaddr + ch * 8 + y);
code = vic3->dma_read(vic3->chargenaddr + ch * 8 + y);
vic3->screen[y + yoff][xoff >> 3] = code;
if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) vic3->bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = color[code >> 7];
if ((xoff + 1 > start_x) && (xoff + 0 < end_x)) vic3->bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = color[(code >> 6) & 1];
@ -324,7 +324,7 @@ static void vic3_draw_character_multi( device_t *device, int ybegin, int yend, i
for (y = ybegin; y <= yend; y++)
{
code = vic3->dma_read(device->machine(), vic3->chargenaddr + ch * 8 + y);
code = vic3->dma_read(vic3->chargenaddr + ch * 8 + y);
vic3->screen[y + yoff][xoff >> 3] = vic3->foreground[code];
if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) vic3->bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = vic3->multi[code >> 6];
if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) vic3->bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = vic3->multi[code >> 6];
@ -344,7 +344,7 @@ static void vic3_draw_bitmap( device_t *device, int ybegin, int yend, int ch, in
for (y = ybegin; y <= yend; y++)
{
code = vic3->dma_read(device->machine(), (vic3->chargenaddr & 0x2000) + ch * 8 + y);
code = vic3->dma_read((vic3->chargenaddr & 0x2000) + ch * 8 + y);
vic3->screen[y + yoff][xoff >> 3] = code;
if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) vic3->bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = vic3->c64_bitmap[code >> 7];
if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) vic3->bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = vic3->c64_bitmap[(code >> 6) & 1];
@ -364,7 +364,7 @@ static void vic3_draw_bitmap_multi( device_t *device, int ybegin, int yend, int
for (y = ybegin; y <= yend; y++)
{
code = vic3->dma_read(device->machine(), (vic3->chargenaddr & 0x2000) + ch * 8 + y);
code = vic3->dma_read((vic3->chargenaddr & 0x2000) + ch * 8 + y);
vic3->screen[y + yoff][xoff >> 3] = vic3->foreground[code];
if ((xoff + 0 > start_x) && (xoff + 0 < end_x)) vic3->bitmap->pix16(y + yoff + FIRSTLINE, xoff + 0) = vic3->bitmapmulti[code >> 6];
if ((xoff + 1 > start_x) && (xoff + 1 < end_x)) vic3->bitmap->pix16(y + yoff + FIRSTLINE, xoff + 1) = vic3->bitmapmulti[code >> 6];
@ -470,7 +470,7 @@ static void vic3_draw_sprite( device_t *device, int nr, int yoff, int ybegin, in
int value, value3 = 0;
xbegin = SPRITE_X_POS(nr);
addr = vic3->dma_read(device->machine(), SPRITE_ADDR(nr)) << 6;
addr = vic3->dma_read(SPRITE_ADDR(nr)) << 6;
color = SPRITE_COLOR(nr);
prior = SPRITE_PRIORITY(nr);
collision = SPRITE_BG_COLLISION(nr);
@ -482,7 +482,7 @@ static void vic3_draw_sprite( device_t *device, int nr, int yoff, int ybegin, in
vic3->sprites[nr].paintedline[y] = 1;
for (i = 0; i < 3; i++)
{
value = vic3->expandx[vic3->dma_read(device->machine(), addr + vic3->sprites[nr].line * 3 + i)];
value = vic3->expandx[vic3->dma_read(addr + vic3->sprites[nr].line * 3 + i)];
vic3->sprites[nr].bitmap[y][i * 2] = value >> 8;
vic3->sprites[nr].bitmap[y][i * 2 + 1] = value & 0xff;
vic3_sprite_collision(device, nr, y, xbegin + i * 16, value >> 8);
@ -524,7 +524,7 @@ static void vic3_draw_sprite( device_t *device, int nr, int yoff, int ybegin, in
vic3->sprites[nr].paintedline[y] = 1;
for (i = 0; i < 3; i++)
{
value = vic3->dma_read(device->machine(), addr + vic3->sprites[nr].line * 3 + i);
value = vic3->dma_read(addr + vic3->sprites[nr].line * 3 + i);
vic3->sprites[nr].bitmap[y][i] = value;
vic3_sprite_collision(device, nr, y, xbegin + i * 8, value);
if (prior || !collision)
@ -565,7 +565,7 @@ static void vic3_draw_sprite_multi( device_t *device, int nr, int yoff, int ybeg
int value, value2, value3 = 0, bg/*, color[2]*/;
xbegin = SPRITE_X_POS(nr);
addr = vic3->dma_read(device->machine(), SPRITE_ADDR(nr)) << 6;
addr = vic3->dma_read(SPRITE_ADDR(nr)) << 6;
vic3->spritemulti[2] = SPRITE_COLOR(nr);
prior = SPRITE_PRIORITY(nr);
collision = SPRITE_BG_COLLISION(nr);
@ -579,7 +579,7 @@ static void vic3_draw_sprite_multi( device_t *device, int nr, int yoff, int ybeg
vic3->sprites[nr].paintedline[y] = 1;
for (i = 0; i < 3; i++)
{
value = vic3->expandx_multi[bg = vic3->dma_read(device->machine(), addr + vic3->sprites[nr].line * 3 + i)];
value = vic3->expandx_multi[bg = vic3->dma_read(addr + vic3->sprites[nr].line * 3 + i)];
value2 = vic3->expandx[vic3->multi_collision[bg]];
vic3->sprites[nr].bitmap[y][i * 2] = value2 >> 8;
vic3->sprites[nr].bitmap[y][i * 2 + 1] = value2 & 0xff;
@ -630,7 +630,7 @@ static void vic3_draw_sprite_multi( device_t *device, int nr, int yoff, int ybeg
vic3->sprites[nr].paintedline[y] = 1;
for (i = 0; i < 3; i++)
{
value = vic3->dma_read(device->machine(), addr + vic3->sprites[nr].line * 3 + i);
value = vic3->dma_read(addr + vic3->sprites[nr].line * 3 + i);
vic3->sprites[nr].bitmap[y][i] = value2 = vic3->multi_collision[value];
vic3_sprite_collision(device, nr, y, xbegin + i * 8, value2);
if (prior || !collision)
@ -756,8 +756,8 @@ static void vic3_drawlines( device_t *device, int first, int last, int start_x,
for (xoff = vic3->x_begin + XPOS; xoff < x_end2 + XPOS; xoff += 8, offs++)
{
ch = vic3->dma_read(device->machine(), vic3->videoaddr + offs);
attr = vic3->dma_read_color(device->machine(), vic3->videoaddr + offs);
ch = vic3->dma_read(vic3->videoaddr + offs);
attr = vic3->dma_read_color(vic3->videoaddr + offs);
if (HIRESON)
{
vic3->bitmapmulti[1] = vic3->c64_bitmap[1] = ch >> 4;
@ -996,12 +996,12 @@ static void vic2_drawlines( device_t *device, int first, int last, int start_x,
vic3->shift[line] = HORIZONTALPOS;
for (xoff = vic3->x_begin + XPOS; xoff < vic3->x_end + XPOS; xoff += 8, offs++)
{
ch = vic3->dma_read(device->machine(), vic3->videoaddr + offs);
ch = vic3->dma_read(vic3->videoaddr + offs);
#if 0
attr = vic3->dma_read_color(device->machine(), vic3->videoaddr + offs);
attr = vic3->dma_read_color(vic3->videoaddr + offs);
#else
/* temporaery until vic3 finished */
attr = vic3->dma_read_color(device->machine(), (vic3->videoaddr + offs)&0x3ff)&0x0f;
attr = vic3->dma_read_color((vic3->videoaddr + offs)&0x3ff)&0x0f;
#endif
if (HIRESON)
{
@ -1377,10 +1377,10 @@ WRITE8_DEVICE_HANDLER( vic3_port_w )
break;
case 0x30:
vic3->reg[offset] = data;
if (vic3->port_changed!=NULL) {
if (!vic3->port_changed.isnull()) {
DBG_LOG(2, "vic write", ("%.2x:%.2x\n", offset, data));
vic3->reg[offset] = data;
vic3->port_changed(space.machine(), data);
vic3->port_changed(0,data);
}
break;
case 0x31:
@ -1555,21 +1555,21 @@ READ8_DEVICE_HANDLER( vic3_port_r )
if (M) \
{ \
if (M & 0x01) \
colors[0] = vic3->c64_mem_r(device->machine(), VIC3_ADDR(0) + offset); \
colors[0] = vic3->c64_mem_r(VIC3_ADDR(0) + offset); \
if (M & 0x02) \
colors[1] = vic3->c64_mem_r(device->machine(), VIC3_ADDR(1) + offset) << 1; \
colors[1] = vic3->c64_mem_r(VIC3_ADDR(1) + offset) << 1; \
if (M & 0x04) \
colors[2] = vic3->c64_mem_r(device->machine(), VIC3_ADDR(2) + offset) << 2; \
colors[2] = vic3->c64_mem_r(VIC3_ADDR(2) + offset) << 2; \
if (M & 0x08) \
colors[3] = vic3->c64_mem_r(device->machine(), VIC3_ADDR(3) + offset) << 3; \
colors[3] = vic3->c64_mem_r(VIC3_ADDR(3) + offset) << 3; \
if (M & 0x10) \
colors[4] = vic3->c64_mem_r(device->machine(), VIC3_ADDR(4) + offset) << 4; \
colors[4] = vic3->c64_mem_r(VIC3_ADDR(4) + offset) << 4; \
if (M & 0x20) \
colors[5] = vic3->c64_mem_r(device->machine(), VIC3_ADDR(5) + offset) << 5; \
if (M & 0x40) \
colors[6] = vic3->c64_mem_r(device->machine(), VIC3_ADDR(6) + offset) << 6; \
if (M & 0x80) \
colors[7] = vic3->c64_mem_r(device->machine(), VIC3_ADDR(7) + offset) << 7; \
colors[5] = vic3->c64_mem_r(VIC3_ADDR(5) + offset) << 5; \
if (M & 0x40) \
colors[6] = vic3->c64_mem_r(VIC3_ADDR(6) + offset) << 6; \
if (M & 0x80) \
colors[7] = vic3->c64_mem_r(VIC3_ADDR(7) + offset) << 7; \
for (i = 7; i >= 0; i--) \
{ \
p = 0; \
@ -1646,28 +1646,28 @@ static void vic3_interlace_draw_block( device_t *device, int x, int y, int offse
break;
default:
if (VIC3_BITPLANES_MASK & 0x01)
colors[0] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_IADDR(0) + offset);
colors[0] = vic3->c64_mem_r(VIC3_BITPLANE_IADDR(0) + offset);
if (VIC3_BITPLANES_MASK & 0x02)
colors[1] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_IADDR(1) + offset) << 1;
colors[1] = vic3->c64_mem_r(VIC3_BITPLANE_IADDR(1) + offset) << 1;
if (VIC3_BITPLANES_MASK & 0x04)
colors[2] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_IADDR(2) + offset) << 2;
colors[2] = vic3->c64_mem_r(VIC3_BITPLANE_IADDR(2) + offset) << 2;
if (VIC3_BITPLANES_MASK & 0x08)
colors[3] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_IADDR(3) + offset) << 3;
colors[3] = vic3->c64_mem_r(VIC3_BITPLANE_IADDR(3) + offset) << 3;
if (VIC3_BITPLANES_MASK & 0x10)
colors[4] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_IADDR(4) + offset) << 4;
colors[4] = vic3->c64_mem_r(VIC3_BITPLANE_IADDR(4) + offset) << 4;
if (VIC3_BITPLANES_MASK & 0x20)
colors[5] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_IADDR(5) + offset) << 5;
colors[5] = vic3->c64_mem_r(VIC3_BITPLANE_IADDR(5) + offset) << 5;
if (VIC3_BITPLANES_MASK & 0x40)
colors[6] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_IADDR(6) + offset) << 6;
colors[6] = vic3->c64_mem_r(VIC3_BITPLANE_IADDR(6) + offset) << 6;
if (VIC3_BITPLANES_MASK & 0x80)
colors[7] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_IADDR(7) + offset) << 7;
colors[7] = vic3->c64_mem_r(VIC3_BITPLANE_IADDR(7) + offset) << 7;
for (i = 7; i >= 0; i--)
{
@ -1718,28 +1718,28 @@ static void vic3_draw_block( device_t *device, int x, int y, int offset )
break;
default:
if (VIC3_BITPLANES_MASK & 0x01)
colors[0] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_ADDR(0) + offset);
colors[0] = vic3->c64_mem_r(VIC3_BITPLANE_ADDR(0) + offset);
if (VIC3_BITPLANES_MASK & 0x02)
colors[1] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_ADDR(1) + offset) << 1;
colors[1] = vic3->c64_mem_r(VIC3_BITPLANE_ADDR(1) + offset) << 1;
if (VIC3_BITPLANES_MASK & 0x04)
colors[2] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_ADDR(2) + offset) << 2;
colors[2] = vic3->c64_mem_r(VIC3_BITPLANE_ADDR(2) + offset) << 2;
if (VIC3_BITPLANES_MASK & 0x08)
colors[3] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_ADDR(3) + offset) << 3;
colors[3] = vic3->c64_mem_r(VIC3_BITPLANE_ADDR(3) + offset) << 3;
if (VIC3_BITPLANES_MASK & 0x10)
colors[4] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_ADDR(4) + offset) << 4;
colors[4] = vic3->c64_mem_r(VIC3_BITPLANE_ADDR(4) + offset) << 4;
if (VIC3_BITPLANES_MASK & 0x20)
colors[5] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_ADDR(5) + offset) << 5;
colors[5] = vic3->c64_mem_r(VIC3_BITPLANE_ADDR(5) + offset) << 5;
if (VIC3_BITPLANES_MASK & 0x40)
colors[6] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_ADDR(6) + offset) << 6;
colors[6] = vic3->c64_mem_r(VIC3_BITPLANE_ADDR(6) + offset) << 6;
if (VIC3_BITPLANES_MASK & 0x80)
colors[7] = vic3->c64_mem_r(device->machine(), VIC3_BITPLANE_ADDR(7) + offset) << 7;
colors[7] = vic3->c64_mem_r(VIC3_BITPLANE_ADDR(7) + offset) << 7;
for (i = 7; i >= 0; i--)
{
@ -1965,17 +1965,17 @@ static DEVICE_START( vic3 )
vic3->type = intf->type;
vic3->dma_read = intf->dma_read;
vic3->dma_read_color = intf->dma_read_color;
vic3->interrupt = intf->irq;
vic3->dma_read.resolve(intf->dma_read, *device);
vic3->dma_read_color.resolve(intf->dma_read_color, *device);
vic3->interrupt.resolve(intf->irq, *device);
vic3->port_changed = intf->port_changed;
vic3->port_changed.resolve(intf->port_changed, *device);
vic3->c64_mem_r = intf->c64_mem_r;
vic3->c64_mem_r.resolve(intf->c64_mem_r, *device);
vic3->lightpen_button_cb = intf->button_cb;
vic3->lightpen_x_cb = intf->x_cb;
vic3->lightpen_y_cb = intf->y_cb;
vic3->lightpen_button_cb.resolve(intf->button_cb, *device);
vic3->lightpen_x_cb.resolve(intf->x_cb, *device);
vic3->lightpen_y_cb.resolve(intf->y_cb, *device);
vic3->screen[0] = auto_alloc_array(device->machine(), UINT8, 216 * 656 / 8);

View File

@ -14,18 +14,6 @@
TYPE DEFINITIONS
***************************************************************************/
typedef UINT8 (*vic3_lightpen_x_callback)(running_machine &machine);
typedef UINT8 (*vic3_lightpen_y_callback)(running_machine &machine);
typedef UINT8 (*vic3_lightpen_button_callback)(running_machine &machine);
typedef int (*vic3_dma_read)(running_machine &machine, int);
typedef int (*vic3_dma_read_color)(running_machine &machine, int);
typedef void (*vic3_irq) (running_machine &, int);
typedef void (*vic3_port_changed_callback) (running_machine &, int);
typedef UINT8 (*vic3_c64mem_callback)(running_machine &machine, int offset);
enum vic3_type
{
VIC4567_NTSC,
@ -37,19 +25,19 @@ struct vic3_interface
const char *screen;
const char *cpu;
vic3_type type;
vic3_type type;
vic3_lightpen_x_callback x_cb;
vic3_lightpen_y_callback y_cb;
vic3_lightpen_button_callback button_cb;
devcb_read8 x_cb;
devcb_read8 y_cb;
devcb_read8 button_cb;
vic3_dma_read dma_read;
vic3_dma_read_color dma_read_color;
vic3_irq irq;
devcb_read8 dma_read;
devcb_read8 dma_read_color;
devcb_write_line irq;
vic3_port_changed_callback port_changed;
devcb_write8 port_changed;
vic3_c64mem_callback c64_mem_r;
devcb_read8 c64_mem_r;
};
/***************************************************************************