mirror of
https://github.com/holub/mame
synced 2025-10-05 16:50:57 +03:00
mc146818: support direct-access bus hookup method. [R. Belmont]
This chip has 8 address/data lines and an address/data strobe. Most users hooked it up so the low-order address bit is the address/data strobe, allowing you to write an address and then read/write data at an adjacent address. But if you don't mind using a few more gates you can latch the low-order address bits from the CPU into the chip then latch the data in or out of it so it works just like a RAM. The MIPS DECstations did this in their I/O ASICs.
This commit is contained in:
parent
7eff013f87
commit
16336848af
@ -520,7 +520,18 @@ READ8_MEMBER( mc146818_device::read )
|
||||
break;
|
||||
|
||||
case 1:
|
||||
switch (m_index)
|
||||
data = read_direct(space, m_index);
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
READ8_MEMBER( mc146818_device::read_direct )
|
||||
{
|
||||
uint8_t data = 0;
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case REG_A:
|
||||
data = m_data[REG_A];
|
||||
@ -548,23 +559,18 @@ READ8_MEMBER( mc146818_device::read )
|
||||
data = m_data[m_index];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
LOG("mc146818_port_r(): index=0x%02x data=0x%02x\n", m_index, data);
|
||||
LOG("mc146818_port_r(): offset=0x%02x data=0x%02x\n", offset, data);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// write - I/O handler for writing
|
||||
//-------------------------------------------------
|
||||
|
||||
WRITE8_MEMBER( mc146818_device::write )
|
||||
{
|
||||
LOG("mc146818_port_w(): index=0x%02x data=0x%02x\n", m_index, data);
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case 0:
|
||||
@ -572,7 +578,16 @@ WRITE8_MEMBER( mc146818_device::write )
|
||||
break;
|
||||
|
||||
case 1:
|
||||
switch (m_index)
|
||||
write_direct(space, m_index, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( mc146818_device::write_direct )
|
||||
{
|
||||
LOG("mc146818_port_w(): offset=0x%02x data=0x%02x\n", offset, data);
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case REG_SECONDS:
|
||||
// top bit of SECONDS is read only
|
||||
@ -605,6 +620,4 @@ WRITE8_MEMBER( mc146818_device::write )
|
||||
m_data[m_index] = data;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
@ -72,6 +72,10 @@ public:
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
|
||||
// direct-mapped read/write access
|
||||
DECLARE_READ8_MEMBER( read_direct );
|
||||
DECLARE_WRITE8_MEMBER( write_direct );
|
||||
|
||||
protected:
|
||||
mc146818_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user