diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index a07da201d35..ff25be50683 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -2201,6 +2201,8 @@ if (BUSES["CPC"]~=null) then MAME_DIR .. "src/devices/bus/cpc/ddi1.h", MAME_DIR .. "src/devices/bus/cpc/magicsound.c", MAME_DIR .. "src/devices/bus/cpc/magicsound.h", + MAME_DIR .. "src/devices/bus/cpc/doubler.c", + MAME_DIR .. "src/devices/bus/cpc/doubler.h", } end diff --git a/src/devices/bus/cpc/doubler.c b/src/devices/bus/cpc/doubler.c new file mode 100644 index 00000000000..50bdf437a5d --- /dev/null +++ b/src/devices/bus/cpc/doubler.c @@ -0,0 +1,75 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + * doubler.c -- Draysoft Doubler - external cassette interface for the 464 (works on 664/6128 with external cassette?), + * intended for use in duplicating cassette software + * + */ + + #include "doubler.h" + #include "includes/amstrad.h" + + //************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type CPC_DOUBLER = &device_creator; + + +static MACHINE_CONFIG_FRAGMENT( cpc_doubler ) + MCFG_CASSETTE_ADD( "doubler_tape" ) + MCFG_CASSETTE_FORMATS(cdt_cassette_formats) + MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED) + MCFG_CASSETTE_INTERFACE("cpc_cass") + + // no pass-through seen on remake PCBs, unknown if actual hardware had a pass-through port or not +MACHINE_CONFIG_END + + +machine_config_constructor cpc_doubler_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( cpc_doubler ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +cpc_doubler_device::cpc_doubler_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, CPC_DOUBLER, "Draysoft Doubler", tag, owner, clock, "cpc_doubler", __FILE__), + device_cpc_expansion_card_interface(mconfig, *this), + m_tape(*this,"doubler_tape") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cpc_doubler_device::device_start() +{ + device_t* cpu = machine().device("maincpu"); + address_space& space = cpu->memory().space(AS_IO); + m_slot = dynamic_cast(owner()); + + space.install_read_handler(0xf0e0,0xf0e0,0,0,read8_delegate(FUNC(cpc_doubler_device::ext_tape_r),this)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void cpc_doubler_device::device_reset() +{ + // TODO +} + +READ8_MEMBER(cpc_doubler_device::ext_tape_r) +{ + UINT8 data = 0; + if(m_tape->input() > 0.03) + data |= 0x20; + return data; +} + diff --git a/src/devices/bus/cpc/doubler.h b/src/devices/bus/cpc/doubler.h new file mode 100644 index 00000000000..22cac02c3e2 --- /dev/null +++ b/src/devices/bus/cpc/doubler.h @@ -0,0 +1,45 @@ +// license:BSD-3-Clause +// copyright-holders:Barry Rodewald +/* + * doubler.c -- Draysoft Doubler - external cassette interface for the 464 (works on 664/6128 with external cassette?), + * intended for use in duplicating cassette software + * + * Uses only port F0E0 (may conflict with other peripherals, PPI port A is not usable while Doubler software is running) + * + */ + +#ifndef DOUBLER_H_ +#define DOUBLER_H_ + +#include "emu.h" +#include "cpcexp.h" +#include "imagedev/cassette.h" +#include "formats/tzx_cas.h" + +class cpc_doubler_device : public device_t, + public device_cpc_expansion_card_interface +{ +public: + // construction/destruction + cpc_doubler_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + + DECLARE_READ8_MEMBER(ext_tape_r); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + +private: + cpc_expansion_slot_device *m_slot; + + required_device m_tape; +}; + +// device type definition +extern const device_type CPC_DOUBLER; + +#endif /* DOUBLER_H_ */ diff --git a/src/mame/drivers/amstrad.c b/src/mame/drivers/amstrad.c index 8e88e135151..8db6bd65304 100644 --- a/src/mame/drivers/amstrad.c +++ b/src/mame/drivers/amstrad.c @@ -814,6 +814,7 @@ SLOT_INTERFACE_START(cpc464_exp_cards) SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) SLOT_INTERFACE("hd20", CPC_HD20) + SLOT_INTERFACE("doubler", CPC_DOUBLER) SLOT_INTERFACE_END SLOT_INTERFACE_START(cpc_exp_cards) @@ -830,6 +831,7 @@ SLOT_INTERFACE_START(cpc_exp_cards) SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) SLOT_INTERFACE("hd20", CPC_HD20) + SLOT_INTERFACE("doubler", CPC_DOUBLER) SLOT_INTERFACE_END SLOT_INTERFACE_START(cpcplus_exp_cards) @@ -844,6 +846,7 @@ SLOT_INTERFACE_START(cpcplus_exp_cards) SLOT_INTERFACE("playcity", CPC_PLAYCITY) SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) SLOT_INTERFACE("hd20", CPC_HD20) + SLOT_INTERFACE("doubler", CPC_DOUBLER) SLOT_INTERFACE_END SLOT_INTERFACE_START(aleste_exp_cards) @@ -860,6 +863,7 @@ SLOT_INTERFACE_START(aleste_exp_cards) SLOT_INTERFACE("smartwatch", CPC_SMARTWATCH) SLOT_INTERFACE("brunword4", CPC_BRUNWORD_MK4) SLOT_INTERFACE("hd20", CPC_HD20) + SLOT_INTERFACE("doubler", CPC_DOUBLER) SLOT_INTERFACE("magicsound", AL_MAGICSOUND) SLOT_INTERFACE_END diff --git a/src/mame/includes/amstrad.h b/src/mame/includes/amstrad.h index 40c798ccbdb..30e74caa743 100644 --- a/src/mame/includes/amstrad.h +++ b/src/mame/includes/amstrad.h @@ -30,6 +30,7 @@ #include "bus/cpc/brunword4.h" #include "bus/cpc/hd20.h" #include "bus/cpc/magicsound.h" +#include "bus/cpc/doubler.h" #include "machine/ram.h" #include "imagedev/cassette.h" #include "bus/centronics/ctronics.h"