[VIA6522] Read port A/B only if some pins are inputs.

This commit is contained in:
Curt Coder 2010-02-11 11:44:17 +00:00
parent f058d3f6e0
commit 11232428dc

View File

@ -517,12 +517,15 @@ READ8_DEVICE_HANDLER(via_r)
case VIA_PB:
/* update the input */
if (PB_LATCH_ENABLE(v->acr) == 0)
{
if (v->ddr_b != 0xff)
{
if (v->in_b_func.read != NULL)
v->in_b = devcb_call_read8(&v->in_b_func, 0);
else
logerror("%s:6522VIA chip %s: Port B is being read but has no handler\n", cpuexec_describe_context(device->machine), device->tag.cstr());
}
}
CLR_PB_INT(device);
@ -536,12 +539,15 @@ READ8_DEVICE_HANDLER(via_r)
case VIA_PA:
/* update the input */
if (PA_LATCH_ENABLE(v->acr) == 0)
{
if (v->ddr_a != 0xff)
{
if (v->in_a_func.read != NULL)
v->in_a = devcb_call_read8(&v->in_a_func, 0);
else
logerror("%s:6522VIA chip %s: Port A is being read but has no handler\n", cpuexec_describe_context(device->machine), device->tag.cstr());
}
}
/* combine input and output values */
val = (v->out_a & v->ddr_a) + (v->in_a & ~v->ddr_a);