Previous 199869 Revisions Next

r35244 Monday 23rd February, 2015 at 22:32:42 UTC by Barry Rodewald
amstrad: added support for the Dobbertin Smart Watch
[src/emu/bus]bus.mak
[src/emu/bus/cpc]smartwatch.c* smartwatch.h*
[src/mess/drivers]amstrad.c
[src/mess/includes]amstrad.h
[src/mess/machine]amstrad.c

trunk/src/emu/bus/bus.mak
r243755r243756
13711371BUSOBJS += $(BUSOBJ)/cpc/symbfac2.o
13721372BUSOBJS += $(BUSOBJ)/cpc/amdrum.o
13731373BUSOBJS += $(BUSOBJ)/cpc/playcity.o
1374BUSOBJS += $(BUSOBJ)/cpc/smartwatch.o
13741375endif
13751376
13761377#-------------------------------------------------
trunk/src/emu/bus/cpc/smartwatch.c
r0r243756
1/*
2   Dobbertin Smartwatch
3   
4   Created: 23/2/2015
5   
6   TODO: setting the time (requires the DS1315 core to be able to do this,
7         at the moment it just reads the current time)
8*/
9
10#include "emu.h"
11#include "smartwatch.h"
12#include "includes/amstrad.h"
13
14
15//**************************************************************************
16//  DEVICE DEFINITIONS
17//**************************************************************************
18
19const device_type CPC_SMARTWATCH = &device_creator<cpc_smartwatch_device>;
20
21
22static MACHINE_CONFIG_FRAGMENT( cpc_smartwatch )
23   MCFG_DS1315_ADD("rtc")
24   // no pass-through (?)
25MACHINE_CONFIG_END
26
27machine_config_constructor cpc_smartwatch_device::device_mconfig_additions() const
28{
29   return MACHINE_CONFIG_NAME( cpc_smartwatch );
30}
31
32ROM_START( cpc_smartwatch )
33   ROM_REGION( 0x4000, "exp_rom", 0 )
34   ROM_LOAD( "timerom+.rom",   0x0000, 0x4000, CRC(ed42a147) SHA1(61750d0535a1fbf2a4addad9def332cbcf8917c3) )
35ROM_END
36
37const rom_entry *cpc_smartwatch_device::device_rom_region() const
38{
39   return ROM_NAME( cpc_smartwatch );
40}
41
42//**************************************************************************
43//  LIVE DEVICE
44//**************************************************************************
45
46cpc_smartwatch_device::cpc_smartwatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
47   device_t(mconfig, CPC_SMARTWATCH, "Dobbertin Smartwatch", tag, owner, clock, "cpc_smartwatch", __FILE__),
48   device_cpc_expansion_card_interface(mconfig, *this),
49   m_rtc(*this,"rtc")
50{
51}
52
53//-------------------------------------------------
54//  device_start - device-specific startup
55//-------------------------------------------------
56
57void cpc_smartwatch_device::device_start()
58{
59   m_slot = dynamic_cast<cpc_expansion_slot_device *>(owner());
60}
61
62//-------------------------------------------------
63//  device_reset - device-specific reset
64//-------------------------------------------------
65
66void cpc_smartwatch_device::device_reset()
67{
68   device_t* cpu = machine().device(":maincpu");
69   address_space& space = cpu->memory().space(AS_PROGRAM);
70   space.install_read_handler(0xc000,0xc001,0,0,read8_delegate(FUNC(cpc_smartwatch_device::rtc_w),this));
71   space.install_read_handler(0xc004,0xc004,0,0,read8_delegate(FUNC(cpc_smartwatch_device::rtc_r),this));
72   m_bank = membank(":bank7");
73}
74
75READ8_MEMBER(cpc_smartwatch_device::rtc_w)
76{
77   UINT8* bank = (UINT8*)m_bank->base();
78   if(offset & 1)
79      m_rtc->read_1(space,0);
80   else
81      m_rtc->read_0(space,0);
82   return bank[offset & 1];
83}
84
85READ8_MEMBER(cpc_smartwatch_device::rtc_r)
86{
87   UINT8* bank = (UINT8*)m_bank->base();
88   return ((bank[(offset & 1)+4]) & 0xfe) | (m_rtc->read_data(space,0) & 0x01);
89}
trunk/src/emu/bus/cpc/smartwatch.h
r0r243756
1/*
2   Dobbertin Smartwatch
3   
4   Dallas DS1216 Smartwatch + DS1315 Phantom Time chip
5   
6   Further info at: http://www.cpcwiki.eu/index.php/Dobbertin_Smart_Watch
7   
8*/
9
10#ifndef SMARTWATCH_H_
11#define SMARTWATCH_H_
12
13#include "emu.h"
14#include "cpcexp.h"
15#include "machine/ds1315.h"
16
17class cpc_smartwatch_device   : public device_t,
18            public device_cpc_expansion_card_interface
19{
20public:
21   // construction/destruction
22   cpc_smartwatch_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
23
24   // optional information overrides
25   virtual machine_config_constructor device_mconfig_additions() const;
26   virtual const rom_entry *device_rom_region() const;
27
28   DECLARE_READ8_MEMBER(rtc_w);
29   DECLARE_READ8_MEMBER(rtc_r);
30protected:
31   // device-level overrides
32   virtual void device_start();
33   virtual void device_reset();
34
35private:
36   cpc_expansion_slot_device *m_slot;
37
38   required_device<ds1315_device> m_rtc;
39   memory_bank* m_bank;
40};
41
42// device type definition
43extern const device_type CPC_SMARTWATCH;
44
45
46#endif /* SMARTWATCH_H_ */
trunk/src/mess/drivers/amstrad.c
r243755r243756
804804   SLOT_INTERFACE("sf2", CPC_SYMBIFACE2)
805805   SLOT_INTERFACE("amdrum", CPC_AMDRUM)
806806   SLOT_INTERFACE("playcity", CPC_PLAYCITY)
807   SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH)
807808SLOT_INTERFACE_END
808809
809810SLOT_INTERFACE_START(cpcplus_exp_cards)
r243755r243756
816817   SLOT_INTERFACE("sf2", CPC_SYMBIFACE2)
817818   SLOT_INTERFACE("amdrum", CPC_AMDRUM)
818819   SLOT_INTERFACE("playcity", CPC_PLAYCITY)
820   SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH)
819821SLOT_INTERFACE_END
820822
821823SLOT_INTERFACE_START(amstrad_centronics_devices)
trunk/src/mess/includes/amstrad.h
r243755r243756
2323#include "bus/cpc/symbfac2.h"
2424#include "bus/cpc/amdrum.h"
2525#include "bus/cpc/playcity.h"
26#include "bus/cpc/smartwatch.h"
2627#include "machine/ram.h"
2728#include "imagedev/cassette.h"
2829#include "bus/centronics/ctronics.h"
trunk/src/mess/machine/amstrad.c
r243755r243756
29182918
29192919void amstrad_state::amstrad_common_init()
29202920{
2921   address_space &space = m_maincpu->space(AS_PROGRAM);
2921//   address_space &space = m_maincpu->space(AS_PROGRAM);
29222922
29232923   m_aleste_mode = 0;
29242924
r243755r243756
29282928   m_GateArray_RamConfiguration = 0;
29292929   m_gate_array.hsync_counter = 2;
29302930
2931   space.install_read_bank(0x0000, 0x1fff, "bank1");
2931/*   space.install_read_bank(0x0000, 0x1fff, "bank1");
29322932   space.install_read_bank(0x2000, 0x3fff, "bank2");
29332933
29342934   space.install_read_bank(0x4000, 0x5fff, "bank3");
r243755r243756
29512951
29522952   space.install_write_bank(0xc000, 0xdfff, "bank15");
29532953   space.install_write_bank(0xe000, 0xffff, "bank16");
2954
2954*/
29552955   enumerate_roms();
29562956
29572957   m_maincpu->reset();


Previous 199869 Revisions Next


© 1997-2024 The MAME Team