amstrad: added support for the Dobbertin Smart Watch

This commit is contained in:
mahlemiut 2015-02-24 11:30:48 +13:00
parent 757335d048
commit c1b6c93576
6 changed files with 142 additions and 3 deletions

View File

@ -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
#-------------------------------------------------

View File

@ -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);
}

View File

@ -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_ */

View File

@ -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)

View File

@ -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"

View File

@ -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();