summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author mahlemiut <bsr@xnet.co.nz>2015-02-24 11:30:48 +1300
committer mahlemiut <bsr@xnet.co.nz>2015-02-24 11:32:42 +1300
commitc1b6c93576e576847a45a41ed34bedce42d23bbb (patch)
tree8206e567b6bce17fa5d1bd6f8fd072850bb31382
parent757335d04813cc85efb3783833d79001b78e461d (diff)
amstrad: added support for the Dobbertin Smart Watch
-rw-r--r--src/emu/bus/bus.mak1
-rw-r--r--src/emu/bus/cpc/smartwatch.c89
-rw-r--r--src/emu/bus/cpc/smartwatch.h46
-rw-r--r--src/mess/drivers/amstrad.c2
-rw-r--r--src/mess/includes/amstrad.h1
-rw-r--r--src/mess/machine/amstrad.c6
6 files changed, 142 insertions, 3 deletions
diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak
index efc2cd80804..152ffa26890 100644
--- a/src/emu/bus/bus.mak
+++ b/src/emu/bus/bus.mak
@@ -1371,6 +1371,7 @@ BUSOBJS += $(BUSOBJ)/cpc/mface2.o
BUSOBJS += $(BUSOBJ)/cpc/symbfac2.o
BUSOBJS += $(BUSOBJ)/cpc/amdrum.o
BUSOBJS += $(BUSOBJ)/cpc/playcity.o
+BUSOBJS += $(BUSOBJ)/cpc/smartwatch.o
endif
#-------------------------------------------------
diff --git a/src/emu/bus/cpc/smartwatch.c b/src/emu/bus/cpc/smartwatch.c
new file mode 100644
index 00000000000..cb82fba853d
--- /dev/null
+++ b/src/emu/bus/cpc/smartwatch.c
@@ -0,0 +1,89 @@
+/*
+ Dobbertin Smartwatch
+
+ Created: 23/2/2015
+
+ TODO: setting the time (requires the DS1315 core to be able to do this,
+ at the moment it just reads the current time)
+*/
+
+#include "emu.h"
+#include "smartwatch.h"
+#include "includes/amstrad.h"
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type CPC_SMARTWATCH = &device_creator<cpc_smartwatch_device>;
+
+
+static MACHINE_CONFIG_FRAGMENT( cpc_smartwatch )
+ MCFG_DS1315_ADD("rtc")
+ // no pass-through (?)
+MACHINE_CONFIG_END
+
+machine_config_constructor cpc_smartwatch_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( cpc_smartwatch );
+}
+
+ROM_START( cpc_smartwatch )
+ ROM_REGION( 0x4000, "exp_rom", 0 )
+ ROM_LOAD( "timerom+.rom", 0x0000, 0x4000, CRC(ed42a147) SHA1(61750d0535a1fbf2a4addad9def332cbcf8917c3) )
+ROM_END
+
+const rom_entry *cpc_smartwatch_device::device_rom_region() const
+{
+ return ROM_NAME( cpc_smartwatch );
+}
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+cpc_smartwatch_device::cpc_smartwatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, CPC_SMARTWATCH, "Dobbertin Smartwatch", tag, owner, clock, "cpc_smartwatch", __FILE__),
+ device_cpc_expansion_card_interface(mconfig, *this),
+ m_rtc(*this,"rtc")
+{
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void cpc_smartwatch_device::device_start()
+{
+ m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void cpc_smartwatch_device::device_reset()
+{
+ device_t* cpu = machine().device(":maincpu");
+ address_space& space = cpu->memory().space(AS_PROGRAM);
+ space.install_read_handler(0xc000,0xc001,0,0,read8_delegate(FUNC(cpc_smartwatch_device::rtc_w),this));
+ space.install_read_handler(0xc004,0xc004,0,0,read8_delegate(FUNC(cpc_smartwatch_device::rtc_r),this));
+ m_bank = membank(":bank7");
+}
+
+READ8_MEMBER(cpc_smartwatch_device::rtc_w)
+{
+ UINT8* bank = (UINT8*)m_bank->base();
+ if(offset & 1)
+ m_rtc->read_1(space,0);
+ else
+ m_rtc->read_0(space,0);
+ return bank[offset & 1];
+}
+
+READ8_MEMBER(cpc_smartwatch_device::rtc_r)
+{
+ UINT8* bank = (UINT8*)m_bank->base();
+ return ((bank[(offset & 1)+4]) & 0xfe) | (m_rtc->read_data(space,0) & 0x01);
+}
diff --git a/src/emu/bus/cpc/smartwatch.h b/src/emu/bus/cpc/smartwatch.h
new file mode 100644
index 00000000000..aacdd085981
--- /dev/null
+++ b/src/emu/bus/cpc/smartwatch.h
@@ -0,0 +1,46 @@
+/*
+ Dobbertin Smartwatch
+
+ Dallas DS1216 Smartwatch + DS1315 Phantom Time chip
+
+ Further info at: http://www.cpcwiki.eu/index.php/Dobbertin_Smart_Watch
+
+*/
+
+#ifndef SMARTWATCH_H_
+#define SMARTWATCH_H_
+
+#include "emu.h"
+#include "cpcexp.h"
+#include "machine/ds1315.h"
+
+class cpc_smartwatch_device : public device_t,
+ public device_cpc_expansion_card_interface
+{
+public:
+ // construction/destruction
+ cpc_smartwatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual const rom_entry *device_rom_region() const;
+
+ DECLARE_READ8_MEMBER(rtc_w);
+ DECLARE_READ8_MEMBER(rtc_r);
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ cpc_expansion_slot_device *m_slot;
+
+ required_device<ds1315_device> m_rtc;
+ memory_bank* m_bank;
+};
+
+// device type definition
+extern const device_type CPC_SMARTWATCH;
+
+
+#endif /* SMARTWATCH_H_ */
diff --git a/src/mess/drivers/amstrad.c b/src/mess/drivers/amstrad.c
index 6ee05b85a3c..f7557ede3ba 100644
--- a/src/mess/drivers/amstrad.c
+++ b/src/mess/drivers/amstrad.c
@@ -804,6 +804,7 @@ SLOT_INTERFACE_START(cpc_exp_cards)
SLOT_INTERFACE("sf2", CPC_SYMBIFACE2)
SLOT_INTERFACE("amdrum", CPC_AMDRUM)
SLOT_INTERFACE("playcity", CPC_PLAYCITY)
+ SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH)
SLOT_INTERFACE_END
SLOT_INTERFACE_START(cpcplus_exp_cards)
@@ -816,6 +817,7 @@ SLOT_INTERFACE_START(cpcplus_exp_cards)
SLOT_INTERFACE("sf2", CPC_SYMBIFACE2)
SLOT_INTERFACE("amdrum", CPC_AMDRUM)
SLOT_INTERFACE("playcity", CPC_PLAYCITY)
+ SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH)
SLOT_INTERFACE_END
SLOT_INTERFACE_START(amstrad_centronics_devices)
diff --git a/src/mess/includes/amstrad.h b/src/mess/includes/amstrad.h
index 707eb8d157d..f186158df8a 100644
--- a/src/mess/includes/amstrad.h
+++ b/src/mess/includes/amstrad.h
@@ -23,6 +23,7 @@
#include "bus/cpc/symbfac2.h"
#include "bus/cpc/amdrum.h"
#include "bus/cpc/playcity.h"
+#include "bus/cpc/smartwatch.h"
#include "machine/ram.h"
#include "imagedev/cassette.h"
#include "bus/centronics/ctronics.h"
diff --git a/src/mess/machine/amstrad.c b/src/mess/machine/amstrad.c
index 8600075be1d..54997ce7b58 100644
--- a/src/mess/machine/amstrad.c
+++ b/src/mess/machine/amstrad.c
@@ -2918,7 +2918,7 @@ void amstrad_state::enumerate_roms()
void amstrad_state::amstrad_common_init()
{
- address_space &space = m_maincpu->space(AS_PROGRAM);
+// address_space &space = m_maincpu->space(AS_PROGRAM);
m_aleste_mode = 0;
@@ -2928,7 +2928,7 @@ void amstrad_state::amstrad_common_init()
m_GateArray_RamConfiguration = 0;
m_gate_array.hsync_counter = 2;
- space.install_read_bank(0x0000, 0x1fff, "bank1");
+/* space.install_read_bank(0x0000, 0x1fff, "bank1");
space.install_read_bank(0x2000, 0x3fff, "bank2");
space.install_read_bank(0x4000, 0x5fff, "bank3");
@@ -2951,7 +2951,7 @@ void amstrad_state::amstrad_common_init()
space.install_write_bank(0xc000, 0xdfff, "bank15");
space.install_write_bank(0xe000, 0xffff, "bank16");
-
+*/
enumerate_roms();
m_maincpu->reset();