From 7a3fd3f102d4f07be692c70ce1fc5a879ad63c74 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Fri, 22 Feb 2013 19:43:35 +0000 Subject: [PATCH] (MESS) cbm8096: Emulated the 64KB memory expansion card, and promoted driver to working. [Curt Coder] --- src/mess/drivers/pet.c | 8 +++++--- src/mess/machine/pet_64k.c | 9 ++++++--- src/mess/machine/pet_64k.h | 4 ++-- src/mess/machine/petexp.c | 4 ++-- src/mess/machine/petexp.h | 9 +++++---- src/mess/machine/superpet.c | 4 ++-- src/mess/machine/superpet.h | 4 ++-- 7 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/mess/drivers/pet.c b/src/mess/drivers/pet.c index f0da109f363..4c70c967a00 100644 --- a/src/mess/drivers/pet.c +++ b/src/mess/drivers/pet.c @@ -213,6 +213,8 @@ READ8_MEMBER( pet_state::read ) int norom = m_exp->norom_r(space, offset, sel); UINT8 data = 0; + data = m_exp->read(space, offset, data, sel); + switch (sel) { case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7: @@ -260,7 +262,7 @@ READ8_MEMBER( pet_state::read ) break; } - return m_exp->read(space, offset, data, sel); + return data; } @@ -272,6 +274,8 @@ WRITE8_MEMBER( pet_state::write ) { int sel = offset >> 12; + m_exp->write(space, offset, data, sel); + switch (sel) { case SEL0: case SEL1: case SEL2: case SEL3: case SEL4: case SEL5: case SEL6: case SEL7: @@ -314,8 +318,6 @@ WRITE8_MEMBER( pet_state::write ) } break; } - - m_exp->write(space, offset, data, sel); } diff --git a/src/mess/machine/pet_64k.c b/src/mess/machine/pet_64k.c index e037a3ae0e4..1b9b1c4f9fa 100644 --- a/src/mess/machine/pet_64k.c +++ b/src/mess/machine/pet_64k.c @@ -123,7 +123,7 @@ int pet_64k_expansion_device::pet_norom_r(address_space &space, offs_t offset, i // pet_bd_r - buffered data read //------------------------------------------------- -UINT8 pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel) +UINT8 pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel) { if (BIT(m_ctrl, 7)) { @@ -133,6 +133,7 @@ UINT8 pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, UI if (!BIT(m_ctrl, 5)) { data = read_ram(offset); + sel = pet_expansion_slot_device::SEL_NONE; } break; @@ -140,6 +141,7 @@ UINT8 pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, UI if (!BIT(m_ctrl, 6) || !BIT(offset, 11)) { data = read_ram(offset); + sel = pet_expansion_slot_device::SEL_NONE; } break; @@ -162,7 +164,7 @@ UINT8 pet_64k_expansion_device::pet_bd_r(address_space &space, offs_t offset, UI // pet_bd_w - buffered data write //------------------------------------------------- -void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel) +void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel) { if (BIT(m_ctrl, 7)) { @@ -172,6 +174,7 @@ void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, UIN if (!BIT(m_ctrl, 5)) { write_ram(offset, data); + sel = pet_expansion_slot_device::SEL_NONE; } break; @@ -179,6 +182,7 @@ void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, UIN if (!BIT(m_ctrl, 6) || !BIT(offset, 11)) { write_ram(offset, data); + sel = pet_expansion_slot_device::SEL_NONE; } break; @@ -195,7 +199,6 @@ void pet_64k_expansion_device::pet_bd_w(address_space &space, offs_t offset, UIN if (offset == 0xfff0) { - printf("CTRL %02x\n", data); m_ctrl = data; } } diff --git a/src/mess/machine/pet_64k.h b/src/mess/machine/pet_64k.h index 6d59a742003..e6992b0153a 100644 --- a/src/mess/machine/pet_64k.h +++ b/src/mess/machine/pet_64k.h @@ -38,8 +38,8 @@ protected: // device_pet_expansion_card_interface overrides virtual int pet_norom_r(address_space &space, offs_t offset, int sel); - virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel); - virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel); + virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel); + virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel); private: inline UINT8 read_ram(offs_t offset); diff --git a/src/mess/machine/petexp.c b/src/mess/machine/petexp.c index 04f9c7fdcc4..5969a438233 100644 --- a/src/mess/machine/petexp.c +++ b/src/mess/machine/petexp.c @@ -114,7 +114,7 @@ int pet_expansion_slot_device::norom_r(address_space &space, offs_t offset, int // read - buffered data read //------------------------------------------------- -UINT8 pet_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 data, int sel) +UINT8 pet_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 data, int &sel) { if (m_card != NULL) { @@ -129,7 +129,7 @@ UINT8 pet_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 // write - buffered data write //------------------------------------------------- -void pet_expansion_slot_device::write(address_space &space, offs_t offset, UINT8 data, int sel) +void pet_expansion_slot_device::write(address_space &space, offs_t offset, UINT8 data, int &sel) { if (m_card != NULL) { diff --git a/src/mess/machine/petexp.h b/src/mess/machine/petexp.h index 1972bb23fb3..e21481ef7bc 100644 --- a/src/mess/machine/petexp.h +++ b/src/mess/machine/petexp.h @@ -63,8 +63,8 @@ public: // computer interface int norom_r(address_space &space, offs_t offset, int sel); - UINT8 read(address_space &space, offs_t offset, UINT8 data, int sel); - void write(address_space &space, offs_t offset, UINT8 data, int sel); + UINT8 read(address_space &space, offs_t offset, UINT8 data, int &sel); + void write(address_space &space, offs_t offset, UINT8 data, int &sel); DECLARE_READ_LINE_MEMBER( diag_r ); DECLARE_WRITE_LINE_MEMBER( irq_w ); @@ -75,6 +75,7 @@ public: enum { + SEL_NONE = -1, SEL0 = 0, SEL1, SEL2, @@ -119,8 +120,8 @@ public: protected: // runtime virtual int pet_norom_r(address_space &space, offs_t offset, int sel) { return 1; } - virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel) { return data; }; - virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel) { }; + virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel) { return data; }; + virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel) { }; virtual int pet_diag_r() { return 1; } virtual void pet_irq_w(int state) { } diff --git a/src/mess/machine/superpet.c b/src/mess/machine/superpet.c index 1c9f7126b29..de7f0281767 100644 --- a/src/mess/machine/superpet.c +++ b/src/mess/machine/superpet.c @@ -250,7 +250,7 @@ int superpet_device::pet_norom_r(address_space &space, offs_t offset, int sel) // pet_bd_r - buffered data read //------------------------------------------------- -UINT8 superpet_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel) +UINT8 superpet_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel) { int norom = pet_norom_r(space, offset, sel); @@ -311,7 +311,7 @@ UINT8 superpet_device::pet_bd_r(address_space &space, offs_t offset, UINT8 data, // pet_bd_w - buffered data write //------------------------------------------------- -void superpet_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel) +void superpet_device::pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel) { switch (sel) { diff --git a/src/mess/machine/superpet.h b/src/mess/machine/superpet.h index e919becae4a..103abba0e40 100644 --- a/src/mess/machine/superpet.h +++ b/src/mess/machine/superpet.h @@ -52,8 +52,8 @@ protected: // device_pet_expansion_card_interface overrides virtual int pet_norom_r(address_space &space, offs_t offset, int sel); - virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int sel); - virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int sel); + virtual UINT8 pet_bd_r(address_space &space, offs_t offset, UINT8 data, int &sel); + virtual void pet_bd_w(address_space &space, offs_t offset, UINT8 data, int &sel); virtual int pet_diag_r(); virtual void pet_irq_w(int state);