trunk/src/emu/bus/cpc/smartwatch.c
r0 | r243756 | |
| 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 | |
| 19 | const device_type CPC_SMARTWATCH = &device_creator<cpc_smartwatch_device>; |
| 20 | |
| 21 | |
| 22 | static MACHINE_CONFIG_FRAGMENT( cpc_smartwatch ) |
| 23 | MCFG_DS1315_ADD("rtc") |
| 24 | // no pass-through (?) |
| 25 | MACHINE_CONFIG_END |
| 26 | |
| 27 | machine_config_constructor cpc_smartwatch_device::device_mconfig_additions() const |
| 28 | { |
| 29 | return MACHINE_CONFIG_NAME( cpc_smartwatch ); |
| 30 | } |
| 31 | |
| 32 | ROM_START( cpc_smartwatch ) |
| 33 | ROM_REGION( 0x4000, "exp_rom", 0 ) |
| 34 | ROM_LOAD( "timerom+.rom", 0x0000, 0x4000, CRC(ed42a147) SHA1(61750d0535a1fbf2a4addad9def332cbcf8917c3) ) |
| 35 | ROM_END |
| 36 | |
| 37 | const rom_entry *cpc_smartwatch_device::device_rom_region() const |
| 38 | { |
| 39 | return ROM_NAME( cpc_smartwatch ); |
| 40 | } |
| 41 | |
| 42 | //************************************************************************** |
| 43 | // LIVE DEVICE |
| 44 | //************************************************************************** |
| 45 | |
| 46 | cpc_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 | |
| 57 | void 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 | |
| 66 | void 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 | |
| 75 | READ8_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 | |
| 85 | READ8_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
r0 | r243756 | |
| 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 | |
| 17 | class cpc_smartwatch_device : public device_t, |
| 18 | public device_cpc_expansion_card_interface |
| 19 | { |
| 20 | public: |
| 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); |
| 30 | protected: |
| 31 | // device-level overrides |
| 32 | virtual void device_start(); |
| 33 | virtual void device_reset(); |
| 34 | |
| 35 | private: |
| 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 |
| 43 | extern const device_type CPC_SMARTWATCH; |
| 44 | |
| 45 | |
| 46 | #endif /* SMARTWATCH_H_ */ |
trunk/src/mess/drivers/amstrad.c
r243755 | r243756 | |
804 | 804 | SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) |
805 | 805 | SLOT_INTERFACE("amdrum", CPC_AMDRUM) |
806 | 806 | SLOT_INTERFACE("playcity", CPC_PLAYCITY) |
| 807 | SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) |
807 | 808 | SLOT_INTERFACE_END |
808 | 809 | |
809 | 810 | SLOT_INTERFACE_START(cpcplus_exp_cards) |
r243755 | r243756 | |
816 | 817 | SLOT_INTERFACE("sf2", CPC_SYMBIFACE2) |
817 | 818 | SLOT_INTERFACE("amdrum", CPC_AMDRUM) |
818 | 819 | SLOT_INTERFACE("playcity", CPC_PLAYCITY) |
| 820 | SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) |
819 | 821 | SLOT_INTERFACE_END |
820 | 822 | |
821 | 823 | SLOT_INTERFACE_START(amstrad_centronics_devices) |
trunk/src/mess/machine/amstrad.c
r243755 | r243756 | |
2918 | 2918 | |
2919 | 2919 | void amstrad_state::amstrad_common_init() |
2920 | 2920 | { |
2921 | | address_space &space = m_maincpu->space(AS_PROGRAM); |
| 2921 | // address_space &space = m_maincpu->space(AS_PROGRAM); |
2922 | 2922 | |
2923 | 2923 | m_aleste_mode = 0; |
2924 | 2924 | |
r243755 | r243756 | |
2928 | 2928 | m_GateArray_RamConfiguration = 0; |
2929 | 2929 | m_gate_array.hsync_counter = 2; |
2930 | 2930 | |
2931 | | space.install_read_bank(0x0000, 0x1fff, "bank1"); |
| 2931 | /* space.install_read_bank(0x0000, 0x1fff, "bank1"); |
2932 | 2932 | space.install_read_bank(0x2000, 0x3fff, "bank2"); |
2933 | 2933 | |
2934 | 2934 | space.install_read_bank(0x4000, 0x5fff, "bank3"); |
r243755 | r243756 | |
2951 | 2951 | |
2952 | 2952 | space.install_write_bank(0xc000, 0xdfff, "bank15"); |
2953 | 2953 | space.install_write_bank(0xe000, 0xffff, "bank16"); |
2954 | | |
| 2954 | */ |
2955 | 2955 | enumerate_roms(); |
2956 | 2956 | |
2957 | 2957 | m_maincpu->reset(); |