diff options
-rw-r--r-- | src/devices/bus/isa/aha1542c.cpp | 69 | ||||
-rw-r--r-- | src/devices/bus/isa/aha1542c.h | 19 |
2 files changed, 73 insertions, 15 deletions
diff --git a/src/devices/bus/isa/aha1542c.cpp b/src/devices/bus/isa/aha1542c.cpp index 2d366fbec95..2f87b0a8821 100644 --- a/src/devices/bus/isa/aha1542c.cpp +++ b/src/devices/bus/isa/aha1542c.cpp @@ -211,13 +211,47 @@ ROM_START( aha1542cp ) ROM_END +u8 aha1542c_device::local_status_r() +{ + return m_eeprom->do_read() << 7; +} + +void aha1542c_device::local_latch_w(u8 data) +{ + m_eeprom->cs_write(BIT(data, 2)); + m_eeprom->clk_write(BIT(data, 1)); + m_eeprom->di_write(BIT(data, 0)); + // TODO: several other bits are used +} + void aha1542c_device::z84c0010_mem(address_map &map) { map(0x0000, 0x7fff).rom().region(Z84C0010_TAG, 0); - map(0x8000, 0x800f).noprw(); // something is mapped there - map(0x9000, 0xafff).ram(); // 2kb RAM chip + map(0x8000, 0x9fff).ram(); // 2kb RAM chip + map(0xa000, 0xa000).r(FUNC(aha1542c_device::local_status_r)); + map(0xb000, 0xb000).w(FUNC(aha1542c_device::local_latch_w)); map(0xe000, 0xe0ff).ram(); // probably PC<->Z80 communication area - map(0xb000, 0xb000).noprw(); // something? + map(0xe003, 0xe003).lr8("e003_r", []() { return 0x20; }); +} + +u8 aha1542cp_device::eeprom_r() +{ + return m_eeprom->do_read(); +} + +void aha1542cp_device::eeprom_w(u8 data) +{ + m_eeprom->cs_write(BIT(data, 2)); + m_eeprom->clk_write(BIT(data, 1)); + m_eeprom->di_write(BIT(data, 0)); +} + +void aha1542cp_device::local_mem(address_map &map) +{ + map(0x0000, 0x7fff).rom().region(Z84C0010_TAG, 0); + map(0x8000, 0x9fff).ram(); + map(0xc001, 0xc001).rw(FUNC(aha1542cp_device::eeprom_r), FUNC(aha1542cp_device::eeprom_w)); + map(0xe003, 0xe003).nopr(); } const tiny_rom_entry *aha1542c_device::device_rom_region() const @@ -239,26 +273,37 @@ void aha1542c_device::device_add_mconfig(machine_config &config) { z80_device &cpu(Z80(config, Z84C0010_TAG, 10'000'000)); cpu.set_addrmap(AS_PROGRAM, &aha1542c_device::z84c0010_mem); + + EEPROM_93C46_16BIT(config, m_eeprom); +} + +void aha1542cp_device::device_add_mconfig(machine_config &config) +{ + z80_device &cpu(Z80(config, Z84C0010_TAG, 10'000'000)); + cpu.set_addrmap(AS_PROGRAM, &aha1542cp_device::local_mem); + + EEPROM_93C46_16BIT(config, m_eeprom); } -aha1542c_device::aha1542c_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, type, tag, owner, clock), - device_isa16_card_interface(mconfig, *this) +aha1542c_device::aha1542c_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, type, tag, owner, clock) + , device_isa16_card_interface(mconfig, *this) + , m_eeprom(*this, "eeprom") { } -aha1542c_device::aha1542c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - aha1542c_device(mconfig, AHA1542C, tag, owner, clock) +aha1542c_device::aha1542c_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : aha1542c_device(mconfig, AHA1542C, tag, owner, clock) { } -aha1542cf_device::aha1542cf_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - aha1542c_device(mconfig, AHA1542CF, tag, owner, clock) +aha1542cf_device::aha1542cf_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : aha1542c_device(mconfig, AHA1542CF, tag, owner, clock) { } -aha1542cp_device::aha1542cp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - aha1542c_device(mconfig, AHA1542CP, tag, owner, clock) +aha1542cp_device::aha1542cp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : aha1542c_device(mconfig, AHA1542CP, tag, owner, clock) { } diff --git a/src/devices/bus/isa/aha1542c.h b/src/devices/bus/isa/aha1542c.h index bc7be3edcf5..2294096bde7 100644 --- a/src/devices/bus/isa/aha1542c.h +++ b/src/devices/bus/isa/aha1542c.h @@ -17,6 +17,7 @@ #include "isa.h" +#include "machine/eepromser.h" //********************************************************************* // TYPE DEFINITIONS @@ -30,7 +31,7 @@ class aha1542c_device : public device_t, public: static constexpr feature_type unemulated_features() { return feature::DISK; } // construction/destruction - aha1542c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + aha1542c_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); DECLARE_READ8_MEMBER( aha1542_r ); DECLARE_WRITE8_MEMBER( aha1542_w ); @@ -38,6 +39,9 @@ public: protected: aha1542c_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + u8 local_status_r(); + void local_latch_w(u8 data); + // device-level overrides virtual void device_start() override; virtual void device_reset() override; @@ -46,6 +50,8 @@ protected: virtual const tiny_rom_entry *device_rom_region() const override; virtual void device_add_mconfig(machine_config &config) override; + required_device<eeprom_serial_93cxx_device> m_eeprom; + private: void z84c0010_mem(address_map &map); }; @@ -56,7 +62,7 @@ class aha1542cf_device : public aha1542c_device { public: // construction/destruction - aha1542cf_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + aha1542cf_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: virtual const tiny_rom_entry *device_rom_region() const override; @@ -68,10 +74,17 @@ class aha1542cp_device : public aha1542c_device { public: // construction/destruction - aha1542cp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + aha1542cp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: + virtual void device_add_mconfig(machine_config &config) override; virtual const tiny_rom_entry *device_rom_region() const override; + +private: + u8 eeprom_r(); + void eeprom_w(u8 data); + + void local_mem(address_map &map); }; // device type definitions |