mirror of
https://github.com/holub/mame
synced 2025-05-22 21:58:57 +03:00
From: Duke [mailto:startaq@gmail.com]
Sent: Wednesday, February 25, 2009 5:20 AM To: submit@mamedev.org Subject: CIA update Hello, this patch adds support for the /PC output pin to the CIA emulation. From the datasheet "/PC will go low for one cycle following a read or write of PORT B.". This is needed for centronics printer emulation on the MESS side, but I imagine it would simplify/correct the emulation in some MAME amiga drivers as well (mquake.c for example). --Dirk
This commit is contained in:
parent
500f71495c
commit
26dd96003f
@ -67,6 +67,7 @@ struct _cia_state
|
||||
{
|
||||
const device_config *device;
|
||||
devcb_resolved_write_line irq_func;
|
||||
devcb_resolved_write_line pc_func;
|
||||
|
||||
cia_port port[2];
|
||||
cia_timer timer[2];
|
||||
@ -141,6 +142,7 @@ static DEVICE_START( cia )
|
||||
memset(cia, 0, sizeof(*cia));
|
||||
cia->device = device;
|
||||
devcb_resolve_write_line(&cia->irq_func, &intf->irq_func, device);
|
||||
devcb_resolve_write_line(&cia->pc_func, &intf->pc_func, device);
|
||||
|
||||
/* setup ports */
|
||||
for (p = 0; p < (sizeof(cia->port) / sizeof(cia->port[0])); p++)
|
||||
@ -272,6 +274,20 @@ static DEVICE_VALIDITY_CHECK( cia )
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
cia_update_pc - pulse /pc output
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void cia_update_pc(const device_config *device)
|
||||
{
|
||||
cia_state *cia = get_token(device);
|
||||
|
||||
/* this should really be one cycle long */
|
||||
devcb_call_write_line(&cia->pc_func, 0);
|
||||
devcb_call_write_line(&cia->pc_func, 1);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
cia_update_interrupts
|
||||
-------------------------------------------------*/
|
||||
@ -651,6 +667,9 @@ READ8_DEVICE_HANDLER( cia_r )
|
||||
else
|
||||
data &= ~0x80;
|
||||
}
|
||||
|
||||
/* pulse /PC following the read */
|
||||
cia_update_pc(device);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -742,6 +761,11 @@ WRITE8_DEVICE_HANDLER( cia_w )
|
||||
port->latch = data;
|
||||
port->out = (data & port->ddr) | (port->in & ~port->ddr);
|
||||
devcb_call_write8(&port->write, 0, port->out);
|
||||
|
||||
/* pulse /PC following the write */
|
||||
if (offset == CIA_PRB)
|
||||
cia_update_pc(device);
|
||||
|
||||
break;
|
||||
|
||||
/* port A/B direction */
|
||||
|
@ -45,6 +45,8 @@ typedef struct _cia6526_interface cia6526_interface;
|
||||
struct _cia6526_interface
|
||||
{
|
||||
devcb_write_line irq_func;
|
||||
devcb_write_line pc_func;
|
||||
|
||||
int tod_clock;
|
||||
|
||||
struct
|
||||
|
@ -378,6 +378,7 @@ INPUT_PORTS_END
|
||||
static const cia6526_interface cia_0_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_0_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_HANDLER(alg_cia_0_porta_r), DEVCB_HANDLER(alg_cia_0_porta_w) }, /* port A */
|
||||
@ -388,6 +389,7 @@ static const cia6526_interface cia_0_intf =
|
||||
static const cia6526_interface cia_1_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_1_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_HANDLER(alg_cia_1_porta_r), DEVCB_HANDLER(alg_cia_1_porta_w), }, /* port A */
|
||||
|
@ -260,6 +260,7 @@ INPUT_PORTS_END
|
||||
static const cia6526_interface cia_0_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_0_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("CIA0PORTA"), DEVCB_HANDLER(arcadia_cia_0_porta_w) }, /* port A */
|
||||
@ -270,6 +271,7 @@ static const cia6526_interface cia_0_intf =
|
||||
static const cia6526_interface cia_1_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_1_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_NULL, DEVCB_NULL }, /* port A */
|
||||
|
@ -212,6 +212,7 @@ INPUT_PORTS_END
|
||||
static const cia6526_interface cia_0_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_0_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("CIA0PORTA"), DEVCB_HANDLER(cd32_cia_0_porta_w) }, /* port A */
|
||||
@ -222,6 +223,7 @@ static const cia6526_interface cia_0_intf =
|
||||
static const cia6526_interface cia_1_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_1_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_NULL, DEVCB_NULL }, /* port A */
|
||||
|
@ -333,6 +333,7 @@ static MACHINE_RESET(mquake)
|
||||
static const cia6526_interface cia_0_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_0_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_INPUT_PORT("CIA0PORTA"), DEVCB_HANDLER(mquake_cia_0_porta_w) }, /* port A */
|
||||
@ -343,6 +344,7 @@ static const cia6526_interface cia_0_intf =
|
||||
static const cia6526_interface cia_1_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_1_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_NULL, DEVCB_NULL }, /* port A */
|
||||
|
@ -277,6 +277,7 @@ INPUT_PORTS_END
|
||||
static const cia6526_interface cia_0_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_0_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_NULL, DEVCB_HANDLER(upscope_cia_0_porta_w) }, /* port A */
|
||||
@ -287,6 +288,7 @@ static const cia6526_interface cia_0_intf =
|
||||
static const cia6526_interface cia_1_intf =
|
||||
{
|
||||
DEVCB_LINE(amiga_cia_1_irq), /* irq_func */
|
||||
DEVCB_NULL, /* pc_func */
|
||||
0, /* tod_clock */
|
||||
{
|
||||
{ DEVCB_HANDLER(upscope_cia_1_porta_r), DEVCB_HANDLER(upscope_cia_1_porta_w), }, /* port A */
|
||||
|
Loading…
Reference in New Issue
Block a user