mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +03:00
4enlinea, k7_olym: Add I2C EEPROMs (nw)
This commit is contained in:
parent
6792672fd0
commit
e736ed9f05
@ -190,6 +190,7 @@
|
||||
#include "bus/isa/cga.h"
|
||||
#include "bus/isa/isa.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "machine/i2cmem.h"
|
||||
#include "machine/nvram.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "video/cgapal.h"
|
||||
@ -212,7 +213,8 @@ public:
|
||||
_4enlinea_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_ay(*this, "aysnd"),
|
||||
m_maincpu(*this, "maincpu")
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_eeprom(*this, "eeprom")
|
||||
{ }
|
||||
|
||||
void _4enlinea(machine_config &config);
|
||||
@ -229,6 +231,15 @@ private:
|
||||
INTERRUPT_GEN_MEMBER(_4enlinea_irq);
|
||||
INTERRUPT_GEN_MEMBER(_4enlinea_audio_irq);
|
||||
|
||||
uint8_t eeprom_data_r();
|
||||
void eeprom_data_w(uint8_t data);
|
||||
void eeprom_control_w(uint8_t data);
|
||||
void eeprom_clock_w(uint8_t data);
|
||||
|
||||
uint8_t k7_in_r();
|
||||
void k7_out0_w(uint8_t data);
|
||||
void k7_out1_w(uint8_t data);
|
||||
|
||||
uint8_t m_irq_count;
|
||||
uint8_t m_serial_flags;
|
||||
uint8_t m_serial_data[2];
|
||||
@ -236,9 +247,9 @@ private:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<i2cmem_device> m_eeprom;
|
||||
|
||||
void audio_map(address_map &map);
|
||||
void audio_portmap(address_map &map);
|
||||
void main_map(address_map &map);
|
||||
void main_portmap(address_map &map);
|
||||
|
||||
@ -391,6 +402,27 @@ WRITE8_MEMBER(_4enlinea_state::serial_w)
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI,ASSERT_LINE);
|
||||
}
|
||||
|
||||
uint8_t _4enlinea_state::eeprom_data_r()
|
||||
{
|
||||
return m_eeprom->read_sda();
|
||||
}
|
||||
|
||||
void _4enlinea_state::eeprom_data_w(uint8_t data)
|
||||
{
|
||||
m_eeprom->write_sda(BIT(data, 0));
|
||||
}
|
||||
|
||||
void _4enlinea_state::eeprom_control_w(uint8_t data)
|
||||
{
|
||||
if (BIT(data, 0))
|
||||
m_eeprom->write_sda(1);
|
||||
}
|
||||
|
||||
void _4enlinea_state::eeprom_clock_w(uint8_t data)
|
||||
{
|
||||
m_eeprom->write_scl(BIT(data, 6));
|
||||
}
|
||||
|
||||
READ8_MEMBER(_4enlinea_state::hack_r)
|
||||
{
|
||||
return machine().rand();
|
||||
@ -400,19 +432,31 @@ void _4enlinea_state::audio_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x7fff).rom();
|
||||
map(0xf800, 0xfbff).ram();
|
||||
map(0xfc24, 0xfc24).r(FUNC(_4enlinea_state::hack_r));
|
||||
map(0xfc24, 0xfc24).rw(FUNC(_4enlinea_state::eeprom_data_r), FUNC(_4enlinea_state::eeprom_data_w));
|
||||
map(0xfc25, 0xfc25).w(FUNC(_4enlinea_state::eeprom_control_w));
|
||||
map(0xfc26, 0xfc26).w(FUNC(_4enlinea_state::eeprom_clock_w));
|
||||
map(0xfc28, 0xfc28).r(FUNC(_4enlinea_state::hack_r));
|
||||
map(0xfc30, 0xfc31).w(FUNC(_4enlinea_state::serial_w));
|
||||
map(0xfc32, 0xfc32).rw(FUNC(_4enlinea_state::serial_status_r), FUNC(_4enlinea_state::serial_status_w));
|
||||
map(0xfc48, 0xfc49).rw(m_ay, FUNC(ay8910_device::data_r), FUNC(ay8910_device::address_data_w));
|
||||
|
||||
map(0xfc48, 0xfc48).w(m_ay, FUNC(ay8910_device::address_w));
|
||||
map(0xfc49, 0xfc49).r(m_ay, FUNC(ay8910_device::data_r));
|
||||
map(0xfc4a, 0xfc4a).w(m_ay, FUNC(ay8910_device::data_w));
|
||||
}
|
||||
|
||||
void _4enlinea_state::audio_portmap(address_map &map)
|
||||
uint8_t _4enlinea_state::k7_in_r()
|
||||
{
|
||||
map.global_mask(0xff);
|
||||
return m_eeprom->read_sda() << 4;
|
||||
}
|
||||
|
||||
void _4enlinea_state::k7_out0_w(uint8_t data)
|
||||
{
|
||||
m_eeprom->write_sda(!BIT(data, 3));
|
||||
m_eeprom->write_scl(BIT(data, 2));
|
||||
}
|
||||
|
||||
void _4enlinea_state::k7_out1_w(uint8_t data)
|
||||
{
|
||||
}
|
||||
|
||||
void _4enlinea_state::k7_mem_map(address_map &map)
|
||||
{
|
||||
@ -423,6 +467,8 @@ void _4enlinea_state::k7_mem_map(address_map &map)
|
||||
|
||||
void _4enlinea_state::k7_io_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x0000).mirror(0xfc00).w(FUNC(_4enlinea_state::k7_out0_w));
|
||||
map(0x0001, 0x0001).mirror(0xfc00).rw(FUNC(_4enlinea_state::k7_in_r), FUNC(_4enlinea_state::k7_out1_w));
|
||||
map(0x0100, 0x0100).w(m_ay, FUNC(ay8910_device::address_w));
|
||||
map(0x0101, 0x0101).r(m_ay, FUNC(ay8910_device::data_r));
|
||||
map(0x0102, 0x0102).w(m_ay, FUNC(ay8910_device::data_w));
|
||||
@ -556,9 +602,10 @@ void _4enlinea_state::_4enlinea(machine_config &config)
|
||||
|
||||
z80_device &audiocpu(Z80(config, "audiocpu", SND_CPU_CLOCK));
|
||||
audiocpu.set_addrmap(AS_PROGRAM, &_4enlinea_state::audio_map);
|
||||
audiocpu.set_addrmap(AS_IO, &_4enlinea_state::audio_portmap);
|
||||
audiocpu.set_periodic_int(FUNC(_4enlinea_state::_4enlinea_audio_irq), attotime::from_hz(60)); //TODO
|
||||
|
||||
I2CMEM(config, m_eeprom).set_page_size(16).set_data_size(0x800); // X24C16P
|
||||
|
||||
// FIXME: determine ISA bus clock
|
||||
isa8_device &isa(ISA8(config, "isa", 0));
|
||||
isa.set_memspace("maincpu", AS_PROGRAM);
|
||||
@ -593,6 +640,8 @@ void _4enlinea_state::k7_olym(machine_config &config)
|
||||
|
||||
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // D4464C-15L (6264) + battery
|
||||
|
||||
I2CMEM(config, m_eeprom).set_page_size(16).set_data_size(0x800); // X24C16P
|
||||
|
||||
isa8_device &isa(ISA8(config, "isa", 0));
|
||||
isa.set_memspace("maincpu", AS_PROGRAM);
|
||||
isa.set_iospace("maincpu", AS_IO);
|
||||
|
Loading…
Reference in New Issue
Block a user