diff options
Diffstat (limited to 'src/devices/bus/astrocde')
-rw-r--r-- | src/devices/bus/astrocde/accessory.cpp | 112 | ||||
-rw-r--r-- | src/devices/bus/astrocde/accessory.h | 99 | ||||
-rw-r--r-- | src/devices/bus/astrocde/cassette.cpp | 130 | ||||
-rw-r--r-- | src/devices/bus/astrocde/cassette.h | 61 | ||||
-rw-r--r-- | src/devices/bus/astrocde/ctrl.cpp | 120 | ||||
-rw-r--r-- | src/devices/bus/astrocde/ctrl.h | 98 | ||||
-rw-r--r-- | src/devices/bus/astrocde/exp.cpp | 14 | ||||
-rw-r--r-- | src/devices/bus/astrocde/exp.h | 4 | ||||
-rw-r--r-- | src/devices/bus/astrocde/joy.cpp | 56 | ||||
-rw-r--r-- | src/devices/bus/astrocde/joy.h | 45 | ||||
-rw-r--r-- | src/devices/bus/astrocde/lightpen.cpp | 87 | ||||
-rw-r--r-- | src/devices/bus/astrocde/lightpen.h | 51 | ||||
-rw-r--r-- | src/devices/bus/astrocde/ram.cpp | 61 | ||||
-rw-r--r-- | src/devices/bus/astrocde/ram.h | 12 | ||||
-rw-r--r-- | src/devices/bus/astrocde/rom.cpp | 41 | ||||
-rw-r--r-- | src/devices/bus/astrocde/rom.h | 21 | ||||
-rw-r--r-- | src/devices/bus/astrocde/slot.cpp | 3 | ||||
-rw-r--r-- | src/devices/bus/astrocde/slot.h | 3 |
18 files changed, 12 insertions, 1006 deletions
diff --git a/src/devices/bus/astrocde/accessory.cpp b/src/devices/bus/astrocde/accessory.cpp deleted file mode 100644 index fe7727b855d..00000000000 --- a/src/devices/bus/astrocde/accessory.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz - -#include "emu.h" -#include "accessory.h" - -#include <cassert> - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(ASTROCADE_ACCESSORY_PORT, astrocade_accessory_port_device, "astrocade_accessory_port", "Bally Astrocade Accessory Port") - - -//************************************************************************** -// Bally Astrocade accessory interface -//************************************************************************** - -device_astrocade_accessory_interface::device_astrocade_accessory_interface(const machine_config &mconfig, device_t &device) - : device_slot_card_interface(mconfig, device) - , m_port(dynamic_cast<astrocade_accessory_port_device *>(device.owner())) -{ -} - -device_astrocade_accessory_interface::~device_astrocade_accessory_interface() -{ -} - -void device_astrocade_accessory_interface::interface_validity_check(validity_checker &valid) const -{ - device_slot_card_interface::interface_validity_check(valid); - - if (device().owner() && !m_port) - { - osd_printf_error("Owner device %s (%s) is not an astrocade_accessory_port_device\n", device().owner()->tag(), device().owner()->name()); - } -} - -void device_astrocade_accessory_interface::interface_pre_start() -{ - device_slot_card_interface::interface_pre_start(); - - if (m_port && !m_port->started()) - throw device_missing_dependencies(); -} - - -//************************************************************************** -// Bally Astrocade accessory port -//************************************************************************** - -astrocade_accessory_port_device::astrocade_accessory_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ASTROCADE_ACCESSORY_PORT, tag, owner, clock) - , device_slot_interface(mconfig, *this) - , m_ltpen(0) - , m_ltpen_handler(*this) - , m_screen(*this, finder_base::DUMMY_TAG) - , m_device(nullptr) -{ -} - -astrocade_accessory_port_device::~astrocade_accessory_port_device() -{ -} - -void astrocade_accessory_port_device::device_validity_check(validity_checker &valid) const -{ - device_t *const card(get_card_device()); - if (card && !dynamic_cast<device_astrocade_accessory_interface *>(card)) - { - osd_printf_error("Card device %s (%s) does not implement device_astrocade_accessory_interface\n", card->tag(), card->name()); - } -} - -void astrocade_accessory_port_device::device_resolve_objects() -{ - device_astrocade_accessory_interface *const card(dynamic_cast<device_astrocade_accessory_interface *>(get_card_device())); - if (card) - { - m_device = card; - m_device->set_screen(m_screen); - } - - m_ltpen_handler.resolve_safe(); -} - -void astrocade_accessory_port_device::device_start() -{ - device_t *const card(get_card_device()); - if (card) - { - if (!m_device) - { - throw emu_fatalerror("astrocade_accessory_port_device: card device %s (%s) does not implement device_astrocade_accessory_interface\n", card->tag(), card->name()); - } - } - - save_item(NAME(m_ltpen)); - - m_ltpen = 0; - - m_ltpen_handler(0); -} - -#include "lightpen.h" - -void astrocade_accessories(device_slot_interface &device) -{ - device.option_add("lightpen", ASTROCADE_LIGHTPEN); -} diff --git a/src/devices/bus/astrocde/accessory.h b/src/devices/bus/astrocde/accessory.h deleted file mode 100644 index d745e464cd2..00000000000 --- a/src/devices/bus/astrocde/accessory.h +++ /dev/null @@ -1,99 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -#ifndef MAME_BUS_ASTROCDE_ACCESSORY_H -#define MAME_BUS_ASTROCDE_ACCESSORY_H - -#pragma once - -#include "screen.h" - - -/*************************************************************************** - FORWARD DECLARATIONS - ***************************************************************************/ - -class device_astrocade_accessory_interface; - - -/*************************************************************************** - TYPE DEFINITIONS - ***************************************************************************/ - -// ======================> astrocade_accessory_port_device - -class astrocade_accessory_port_device : public device_t, public device_slot_interface -{ -public: - // construction/destruction - template <typename T, typename U> - astrocade_accessory_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&screen_tag, U &&opts, char const *dflt) - : astrocade_accessory_port_device(mconfig, tag, owner, 0U) - { - m_screen.set_tag(std::forward<T>(screen_tag)); - option_reset(); - opts(*this); - set_default_option(dflt); - set_fixed(false); - } - astrocade_accessory_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U); - virtual ~astrocade_accessory_port_device(); - - auto ltpen_handler() { return m_ltpen_handler.bind(); } - -protected: - // device_t implementation - virtual void device_validity_check(validity_checker &valid) const override ATTR_COLD; - virtual void device_resolve_objects() override; - virtual void device_start() override; - - int m_ltpen; - devcb_write_line m_ltpen_handler; - required_device<screen_device> m_screen; - -private: - device_astrocade_accessory_interface *m_device; - - friend class device_astrocade_accessory_interface; -}; - - -// ======================> device_astrocade_accessory_interface - -class device_astrocade_accessory_interface : public device_slot_card_interface -{ -public: - virtual ~device_astrocade_accessory_interface(); - - DECLARE_WRITE_LINE_MEMBER( write_ltpen ) { m_port->m_ltpen = state; m_port->m_ltpen_handler(state); } - -protected: - device_astrocade_accessory_interface(machine_config const &mconfig, device_t &device); - - // device_interface implementation - virtual void interface_validity_check(validity_checker &valid) const override ATTR_COLD; - virtual void interface_pre_start() override; - - void set_screen(screen_device *screen) { m_screen = screen; } - screen_device *m_screen; - -private: - astrocade_accessory_port_device *const m_port; - - friend class astrocade_accessory_port_device; -}; - - -/*************************************************************************** - FUNCTIONS - ***************************************************************************/ - -void astrocade_accessories(device_slot_interface &device); - - -/*************************************************************************** - DEVICE TYPES - ***************************************************************************/ - -DECLARE_DEVICE_TYPE(ASTROCADE_ACCESSORY_PORT, astrocade_accessory_port_device) - -#endif // MAME_BUS_ASTROCDE_ACCESSORY_H diff --git a/src/devices/bus/astrocde/cassette.cpp b/src/devices/bus/astrocde/cassette.cpp deleted file mode 100644 index 3e4cc80deb8..00000000000 --- a/src/devices/bus/astrocde/cassette.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -// -// Decoding is done in hardware by an external box, and decoded bits are fed to bit 0 of the controller port, -// with sync bits being fed to bit 1. The current HLE is not remotely accurate to hardware, but works. - -#include "emu.h" -#include "cassette.h" - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(ASTROCADE_CASSETTE, astrocade_cassette_device, "astrocade_cass", "Bally Astrocade Cassette") - - -//************************************************************************** -// Bally Astrocade cassette input -//************************************************************************** - -astrocade_cassette_device::astrocade_cassette_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ASTROCADE_CASSETTE, tag, owner, clock) - , device_astrocade_ctrl_interface(mconfig, *this) - , m_cassette(*this, "cassette") -{ -} - -astrocade_cassette_device::~astrocade_cassette_device() -{ -} - -void astrocade_cassette_device::device_start() -{ - save_item(NAME(m_cass_wave)); - save_item(NAME(m_cass_delta)); - save_item(NAME(m_cass_wave_ticks)); - save_item(NAME(m_cass_cycles)); - save_item(NAME(m_cass_mark)); -} - -void astrocade_cassette_device::device_reset() -{ - m_cass_wave = 0.0; - m_cass_delta = 0.0; - m_cass_wave_ticks = 0; - m_cass_cycles = 0; - m_cass_mark = false; -} - -uint8_t astrocade_cassette_device::read_handle() -{ - if (m_cass_data.size()) - { - const uint8_t data = m_cass_data.front(); - m_cass_data.pop(); - return data; - } - return 0; -} - -uint8_t astrocade_cassette_device::read_knob() -{ - return 0; -} - -TIMER_DEVICE_CALLBACK_MEMBER(astrocade_cassette_device::check_cassette_wave) -{ - if (m_cassette->get_state() & CASSETTE_MOTOR_DISABLED) - return; - - double old_cass_wave = m_cass_wave; - m_cass_wave = m_cassette->input(); - - bool cycled = false; - if (old_cass_wave != m_cass_wave) - { - double old_delta = m_cass_delta; - m_cass_delta = m_cass_wave - old_cass_wave; - if (old_delta < 0.0 && m_cass_delta > 0.0) - { - cycled = true; - } - } - - if (cycled) - { - m_cass_mark = m_cass_wave_ticks <= 30; - - m_cass_wave_ticks = 0; - - m_cass_cycles++; - if (m_cass_mark) - { - if (m_cass_cycles >= 8) - { - m_cass_data.push(1); - m_cass_cycles = 0; - } - } - else - { - if (m_cass_cycles >= 4) - { - m_cass_data.push(0); - m_cass_cycles = 0; - } - } - } - - m_cass_wave_ticks++; -} - -TIMER_DEVICE_CALLBACK_MEMBER(astrocade_cassette_device::pulse_cassette_clock) -{ - if (m_cass_data.size()) - { - write_ltpen(1); - write_ltpen(0); - } -} - -void astrocade_cassette_device::device_add_mconfig(machine_config &config) -{ - CASSETTE(config, m_cassette); - m_cassette->set_default_state(CASSETTE_STOPPED); - m_cassette->set_interface("astrocade_cass"); - - TIMER(config, "kcs_hle").configure_periodic(FUNC(astrocade_cassette_device::check_cassette_wave), attotime::from_hz(48000)); - TIMER(config, "kcs_clk").configure_periodic(FUNC(astrocade_cassette_device::pulse_cassette_clock), attotime::from_hz(300)); -} diff --git a/src/devices/bus/astrocde/cassette.h b/src/devices/bus/astrocde/cassette.h deleted file mode 100644 index d36e8a1bfd7..00000000000 --- a/src/devices/bus/astrocde/cassette.h +++ /dev/null @@ -1,61 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -#ifndef MAME_BUS_ASTROCDE_CASSETTE_H -#define MAME_BUS_ASTROCDE_CASSETTE_H - -#pragma once - -#include "ctrl.h" -#include "imagedev/cassette.h" -#include "machine/timer.h" - -#include <queue> - - -/*************************************************************************** - TYPE DEFINITIONS - ***************************************************************************/ - -// ======================> astrocade_cassette_device - -class astrocade_cassette_device : public device_t, - public device_astrocade_ctrl_interface -{ -public: - static constexpr feature_type imperfect_features() { return feature::TAPE; } - - // construction/destruction - astrocade_cassette_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U); - virtual ~astrocade_cassette_device(); - - // device_astrocade_ctrl_interface implementation - virtual uint8_t read_handle() override; - virtual uint8_t read_knob() override; - -protected: - // device_t implementation - virtual void device_start() override; - virtual void device_reset() override; - virtual void device_add_mconfig(machine_config &config) override; - - TIMER_DEVICE_CALLBACK_MEMBER(check_cassette_wave); - TIMER_DEVICE_CALLBACK_MEMBER(pulse_cassette_clock); - -private: - required_device<cassette_image_device> m_cassette; - double m_cass_wave; - double m_cass_delta; - uint32_t m_cass_wave_ticks; - uint32_t m_cass_cycles; - bool m_cass_mark; - std::queue<uint8_t> m_cass_data; -}; - - -/*************************************************************************** - DEVICE TYPES - ***************************************************************************/ - -DECLARE_DEVICE_TYPE(ASTROCADE_CASSETTE, astrocade_cassette_device) - -#endif // MAME_BUS_ASTROCDE_CASSETTE_H diff --git a/src/devices/bus/astrocde/ctrl.cpp b/src/devices/bus/astrocde/ctrl.cpp deleted file mode 100644 index 89cd60ca6a5..00000000000 --- a/src/devices/bus/astrocde/ctrl.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz - -#include "emu.h" -#include "ctrl.h" - -#include <cassert> - - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(ASTROCADE_CTRL_PORT, astrocade_ctrl_port_device, "astrocade_ctrl_port", "Bally Astrocade Control Port") - - -//************************************************************************** -// Bally Astrocade controller interface -//************************************************************************** - -device_astrocade_ctrl_interface::device_astrocade_ctrl_interface(const machine_config &mconfig, device_t &device) - : device_slot_card_interface(mconfig, device) - , m_port(dynamic_cast<astrocade_ctrl_port_device *>(device.owner())) -{ -} - -device_astrocade_ctrl_interface::~device_astrocade_ctrl_interface() -{ -} - -void device_astrocade_ctrl_interface::interface_validity_check(validity_checker &valid) const -{ - device_slot_card_interface::interface_validity_check(valid); - - if (device().owner() && !m_port) - { - osd_printf_error("Owner device %s (%s) is not an astrocade_ctrl_port_device\n", device().owner()->tag(), device().owner()->name()); - } -} - -void device_astrocade_ctrl_interface::interface_pre_start() -{ - device_slot_card_interface::interface_pre_start(); - - if (m_port && !m_port->started()) - throw device_missing_dependencies(); -} - - -//************************************************************************** -// Bally Astrocade controller port -//************************************************************************** - -astrocade_ctrl_port_device::astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ASTROCADE_CTRL_PORT, tag, owner, clock) - , device_slot_interface(mconfig, *this) - , m_ltpen(0) - , m_ltpen_handler(*this) - , m_device(nullptr) -{ -} - -astrocade_ctrl_port_device::~astrocade_ctrl_port_device() -{ -} - -void astrocade_ctrl_port_device::device_validity_check(validity_checker &valid) const -{ - device_t *const card(get_card_device()); - if (card && !dynamic_cast<device_astrocade_ctrl_interface *>(card)) - { - osd_printf_error("Card device %s (%s) does not implement device_astrocade_ctrl_interface\n", card->tag(), card->name()); - } -} - -void astrocade_ctrl_port_device::device_resolve_objects() -{ - device_astrocade_ctrl_interface *const card(dynamic_cast<device_astrocade_ctrl_interface *>(get_card_device())); - if (card) - m_device = card; - - m_ltpen_handler.resolve_safe(); -} - -void astrocade_ctrl_port_device::device_start() -{ - device_t *const card(get_card_device()); - if (card) - { - if (!m_device) - { - throw emu_fatalerror("astrocade_ctrl_port_device: card device %s (%s) does not implement device_astrocade_ctrl_interface\n", card->tag(), card->name()); - } - } - - save_item(NAME(m_ltpen)); - - m_ltpen = 0; - - m_ltpen_handler(0); -} - -uint8_t astrocade_ctrl_port_device::read_handle() -{ - return m_device ? m_device->read_handle() : 0; -} - -uint8_t astrocade_ctrl_port_device::read_knob() -{ - return m_device ? m_device->read_knob() : 0; -} - -#include "joy.h" -#include "cassette.h" - -void astrocade_controllers(device_slot_interface &device) -{ - device.option_add("joy", ASTROCADE_JOY); - device.option_add("cassette", ASTROCADE_CASSETTE); -} diff --git a/src/devices/bus/astrocde/ctrl.h b/src/devices/bus/astrocde/ctrl.h deleted file mode 100644 index 0cc34ea4dcc..00000000000 --- a/src/devices/bus/astrocde/ctrl.h +++ /dev/null @@ -1,98 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -#ifndef MAME_BUS_ASTROCDE_CTRL_H -#define MAME_BUS_ASTROCDE_CTRL_H - -#pragma once - - -/*************************************************************************** - FORWARD DECLARATIONS - ***************************************************************************/ - -class device_astrocade_ctrl_interface; - - -/*************************************************************************** - TYPE DEFINITIONS - ***************************************************************************/ - -// ======================> astrocade_ctrl_port_device - -class astrocade_ctrl_port_device : public device_t, public device_slot_interface -{ -public: - // construction/destruction - template <typename T> - astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&opts, char const *dflt) - : astrocade_ctrl_port_device(mconfig, tag, owner, 0U) - { - option_reset(); - opts(*this); - set_default_option(dflt); - set_fixed(false); - } - astrocade_ctrl_port_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U); - virtual ~astrocade_ctrl_port_device(); - - auto ltpen_handler() { return m_ltpen_handler.bind(); } - - uint8_t read_handle(); - uint8_t read_knob(); - -protected: - // device_t implementation - virtual void device_validity_check(validity_checker &valid) const override ATTR_COLD; - virtual void device_resolve_objects() override; - virtual void device_start() override; - - int m_ltpen; - devcb_write_line m_ltpen_handler; - -private: - device_astrocade_ctrl_interface *m_device; - - friend class device_astrocade_ctrl_interface; -}; - - -// ======================> device_astrocade_ctrl_interface - -class device_astrocade_ctrl_interface : public device_slot_card_interface -{ -public: - virtual ~device_astrocade_ctrl_interface(); - - virtual uint8_t read_handle() { return 0; } - virtual uint8_t read_knob() { return 0; } - - DECLARE_WRITE_LINE_MEMBER( write_ltpen ) { m_port->m_ltpen = state; m_port->m_ltpen_handler(state); } - -protected: - device_astrocade_ctrl_interface(machine_config const &mconfig, device_t &device); - - // device_interface implementation - virtual void interface_validity_check(validity_checker &valid) const override ATTR_COLD; - virtual void interface_pre_start() override; - -private: - astrocade_ctrl_port_device *const m_port; - - friend class astrocade_ctrl_port_device; -}; - - -/*************************************************************************** - FUNCTIONS - ***************************************************************************/ - -void astrocade_controllers(device_slot_interface &device); - - -/*************************************************************************** - DEVICE TYPES - ***************************************************************************/ - -DECLARE_DEVICE_TYPE(ASTROCADE_CTRL_PORT, astrocade_ctrl_port_device) - -#endif // MAME_BUS_ASTROCDE_CTRL_H diff --git a/src/devices/bus/astrocde/exp.cpp b/src/devices/bus/astrocde/exp.cpp index 9fe3c9f3fda..40b6fbecbc4 100644 --- a/src/devices/bus/astrocde/exp.cpp +++ b/src/devices/bus/astrocde/exp.cpp @@ -74,14 +74,6 @@ READ8_MEMBER(astrocade_exp_device::read) return 0xff; } -READ8_MEMBER(astrocade_exp_device::read_io) -{ - if (m_card) - return m_card->read_io(space, offset); - else - return 0xff; -} - /*------------------------------------------------- write -------------------------------------------------*/ @@ -91,9 +83,3 @@ WRITE8_MEMBER(astrocade_exp_device::write) if (m_card) m_card->write(space, offset, data); } - -WRITE8_MEMBER(astrocade_exp_device::write_io) -{ - if (m_card) - m_card->write_io(space, offset, data); -} diff --git a/src/devices/bus/astrocde/exp.h b/src/devices/bus/astrocde/exp.h index a01db130974..e6c97862224 100644 --- a/src/devices/bus/astrocde/exp.h +++ b/src/devices/bus/astrocde/exp.h @@ -14,8 +14,6 @@ public: // reading and writing virtual DECLARE_READ8_MEMBER(read) { return 0xff; } virtual DECLARE_WRITE8_MEMBER(write) { } - virtual DECLARE_READ8_MEMBER(read_io) { return 0xff; } - virtual DECLARE_WRITE8_MEMBER(write_io) { } protected: device_astrocade_card_interface(const machine_config &mconfig, device_t &device); @@ -48,8 +46,6 @@ public: // reading and writing virtual DECLARE_READ8_MEMBER(read); virtual DECLARE_WRITE8_MEMBER(write); - virtual DECLARE_READ8_MEMBER(read_io); - virtual DECLARE_WRITE8_MEMBER(write_io); protected: bool m_card_mounted; diff --git a/src/devices/bus/astrocde/joy.cpp b/src/devices/bus/astrocde/joy.cpp deleted file mode 100644 index cbf75da0c5c..00000000000 --- a/src/devices/bus/astrocde/joy.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz - -#include "emu.h" -#include "joy.h" - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(ASTROCADE_JOY, astrocade_joy_device, "astrocade_joy", "Bally Astrocade Joystick") - - -//************************************************************************** -// Bally Astrocade joystick control -//************************************************************************** - -astrocade_joy_device::astrocade_joy_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ASTROCADE_JOY, tag, owner, clock) - , device_astrocade_ctrl_interface(mconfig, *this) - , m_handle(*this, "HANDLE") - , m_knob(*this, "KNOB") -{ -} - -astrocade_joy_device::~astrocade_joy_device() -{ -} - -uint8_t astrocade_joy_device::read_handle() -{ - return m_handle->read(); -} - -uint8_t astrocade_joy_device::read_knob() -{ - return m_knob->read(); -} - -static INPUT_PORTS_START( astrocade_joy ) - PORT_START("HANDLE") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_8WAY - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_8WAY - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_8WAY - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_8WAY - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) - PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START("KNOB") - PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) -INPUT_PORTS_END - -ioport_constructor astrocade_joy_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( astrocade_joy ); -} diff --git a/src/devices/bus/astrocde/joy.h b/src/devices/bus/astrocde/joy.h deleted file mode 100644 index bb8f755c845..00000000000 --- a/src/devices/bus/astrocde/joy.h +++ /dev/null @@ -1,45 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -#ifndef MAME_BUS_ASTROCDE_JOY_H -#define MAME_BUS_ASTROCDE_JOY_H - -#pragma once - -#include "ctrl.h" - -/*************************************************************************** - TYPE DEFINITIONS - ***************************************************************************/ - -// ======================> astrocade_joy_device - -class astrocade_joy_device : public device_t, - public device_astrocade_ctrl_interface -{ -public: - // construction/destruction - astrocade_joy_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U); - virtual ~astrocade_joy_device(); - - // device_astrocade_ctrl_interface implementation - virtual uint8_t read_handle() override; - virtual uint8_t read_knob() override; - -protected: - // device_t implementation - virtual ioport_constructor device_input_ports() const override; - virtual void device_start() override { } - -private: - required_ioport m_handle; - required_ioport m_knob; -}; - - -/*************************************************************************** - DEVICE TYPES - ***************************************************************************/ - -DECLARE_DEVICE_TYPE(ASTROCADE_JOY, astrocade_joy_device) - -#endif // MAME_BUS_ASTROCDE_JOY_H diff --git a/src/devices/bus/astrocde/lightpen.cpp b/src/devices/bus/astrocde/lightpen.cpp deleted file mode 100644 index e31eed122be..00000000000 --- a/src/devices/bus/astrocde/lightpen.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz - -#include "emu.h" -#include "lightpen.h" - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -DEFINE_DEVICE_TYPE(ASTROCADE_LIGHTPEN, astrocade_lightpen_device, "astrocade_lightpen", "Bally Astrocade Light Pen") - - -//************************************************************************** -// Bally Astrocade light pen input -//************************************************************************** - -astrocade_lightpen_device::astrocade_lightpen_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ASTROCADE_LIGHTPEN, tag, owner, clock) - , device_astrocade_accessory_interface(mconfig, *this) - , m_trigger(*this, "TRIGGER") - , m_lightx(*this, "LIGHTX") - , m_lighty(*this, "LIGHTY") - , m_pen_timer(nullptr) -{ -} - -astrocade_lightpen_device::~astrocade_lightpen_device() -{ -} - -void astrocade_lightpen_device::device_start() -{ - m_pen_timer = timer_alloc(TIMER_TRIGGER); - - save_item(NAME(m_retrigger)); -} - -void astrocade_lightpen_device::device_reset() -{ - m_pen_timer->adjust(attotime::never); - m_retrigger = false; -} - -void astrocade_lightpen_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - if (id == TIMER_TRIGGER) - { - write_ltpen(1); - write_ltpen(0); - if (m_retrigger) - m_pen_timer->adjust(m_screen->time_until_pos(m_lighty->read(), m_lightx->read())); - else - m_pen_timer->adjust(attotime::never); - } -} - -INPUT_CHANGED_MEMBER( astrocade_lightpen_device::trigger ) -{ - if (newval) - { - m_retrigger = true; - m_pen_timer->adjust(m_screen->time_until_pos(m_lighty->read(), m_lightx->read())); - } - else - { - m_retrigger = false; - m_pen_timer->adjust(attotime::never); - } -} - -static INPUT_PORTS_START( astrocade_lightpen ) - PORT_START("TRIGGER") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, astrocade_lightpen_device, trigger, nullptr) - PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED ) - - PORT_START("LIGHTX") - PORT_BIT(0x1ff, 0x000, IPT_LIGHTGUN_X) PORT_MINMAX(0x000, 0x15f) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15) - - PORT_START("LIGHTY") - PORT_BIT(0x0ff, 0x000, IPT_LIGHTGUN_Y) PORT_MINMAX(0x000, 0x0f0) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(45) PORT_KEYDELTA(15) -INPUT_PORTS_END - -ioport_constructor astrocade_lightpen_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( astrocade_lightpen ); -} diff --git a/src/devices/bus/astrocde/lightpen.h b/src/devices/bus/astrocde/lightpen.h deleted file mode 100644 index a0863d5d3e8..00000000000 --- a/src/devices/bus/astrocde/lightpen.h +++ /dev/null @@ -1,51 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ryan Holtz -#ifndef MAME_BUS_ASTROCDE_LIGHTPEN_H -#define MAME_BUS_ASTROCDE_LIGHTPEN_H - -#pragma once - -#include "accessory.h" - - -/*************************************************************************** - TYPE DEFINITIONS - ***************************************************************************/ - -// ======================> astrocade_lightpen_device - -class astrocade_lightpen_device : public device_t, - public device_astrocade_accessory_interface -{ -public: - // construction/destruction - astrocade_lightpen_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U); - virtual ~astrocade_lightpen_device(); - - DECLARE_INPUT_CHANGED_MEMBER( trigger ); - -protected: - // device_t implementation - virtual void device_start() override; - virtual void device_reset() override; - virtual ioport_constructor device_input_ports() const override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - - static const device_timer_id TIMER_TRIGGER = 0; - -private: - required_ioport m_trigger; - required_ioport m_lightx; - required_ioport m_lighty; - emu_timer *m_pen_timer; - bool m_retrigger; -}; - - -/*************************************************************************** - DEVICE TYPES - ***************************************************************************/ - -DECLARE_DEVICE_TYPE(ASTROCADE_LIGHTPEN, astrocade_lightpen_device) - -#endif // MAME_BUS_ASTROCDE_LIGHTPEN_H diff --git a/src/devices/bus/astrocde/ram.cpp b/src/devices/bus/astrocde/ram.cpp index 8f20b0256fa..36d1ed9ab77 100644 --- a/src/devices/bus/astrocde/ram.cpp +++ b/src/devices/bus/astrocde/ram.cpp @@ -21,10 +21,10 @@ switch and run it as a cartridge. This is useful for cartridge development. Blue RAM -- available in 4K, 16K, and 32K. These also use an INS8154 chip, - which has an additional $80 bytes of RAM mapped immediately after the end of - the expansion address space (not yet implemented). This memory can't be write - protected. The INS8154 has I/O features needed for loading tape programs into - Blue RAM BASIC, as well as running the Blue RAM Utility cart. + (not yet implemented) which has an additional $80 bytes of RAM mapped + immediately after the end of the expansion address space. This memory + can't be write protected. The INS8154 has I/O features needed for loading + tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart. 4K: $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory past this range) 16K: $6000 to $9FFF @@ -69,11 +69,9 @@ DEFINE_DEVICE_TYPE(ASTROCADE_RL64RAM, astrocade_rl64ram_device, "astroca astrocade_blueram_4k_device::astrocade_blueram_4k_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, type, tag, owner, clock) - , device_astrocade_card_interface(mconfig, *this) - , m_write_prot(*this, "RAM_PROTECT") - , m_ramio(*this, "ramio") - , m_cassette(*this, "cassette") + : device_t(mconfig, type, tag, owner, clock), + device_astrocade_card_interface(mconfig, *this), + m_write_prot(*this, "RAM_PROTECT") { } @@ -165,35 +163,7 @@ WRITE8_MEMBER(astrocade_blueram_4k_device::write) m_ram[offset - 0x1000] = data; } -READ8_MEMBER(astrocade_blueram_4k_device::read_io) -{ - return m_ramio->read_io(offset & 0x7f); -} - -WRITE8_MEMBER(astrocade_blueram_4k_device::write_io) -{ - logerror("write_io: %04x = %02x\n", offset, data); - m_ramio->write_io(offset & 0x7f, data); -} - -uint8_t astrocade_blueram_4k_device::porta_r() -{ - return 0; -} - -uint8_t astrocade_blueram_4k_device::portb_r() -{ - return m_cassette->input() > 0.0 ? 1 : 0; -} - -void astrocade_blueram_4k_device::porta_w(uint8_t data) -{ -} -void astrocade_blueram_4k_device::portb_w(uint8_t data) -{ - m_cassette->output(BIT(data, 0) ? +1 : -1); -} // Viper System 1 expansion has RAM in 0x6000-0x9fff READ8_MEMBER(astrocade_viper_sys1_device::read) @@ -237,20 +207,3 @@ WRITE8_MEMBER(astrocade_rl64ram_device::write) if (!m_write_prot->read()) m_ram[offset] = data; } - -/*------------------------------------------------- - machine configuration - -------------------------------------------------*/ - -void astrocade_blueram_4k_device::device_add_mconfig(machine_config &config) -{ - CASSETTE(config, m_cassette); - m_cassette->set_default_state(CASSETTE_STOPPED); - m_cassette->set_interface("astrocade_cass"); - - INS8154(config, m_ramio); - m_ramio->out_a().set(FUNC(astrocade_blueram_4k_device::porta_w)); - m_ramio->out_b().set(FUNC(astrocade_blueram_4k_device::portb_w)); - m_ramio->in_a().set(FUNC(astrocade_blueram_4k_device::porta_r)); - m_ramio->in_b().set(FUNC(astrocade_blueram_4k_device::portb_r)); -} diff --git a/src/devices/bus/astrocde/ram.h b/src/devices/bus/astrocde/ram.h index ee5ed884ef4..83f9483d2e8 100644 --- a/src/devices/bus/astrocde/ram.h +++ b/src/devices/bus/astrocde/ram.h @@ -6,8 +6,6 @@ #pragma once #include "exp.h" -#include "imagedev/cassette.h" -#include "machine/ins8154.h" // ======================> astrocade_blueram_4k_device @@ -24,25 +22,15 @@ public: // reading and writing virtual DECLARE_READ8_MEMBER(read) override; virtual DECLARE_WRITE8_MEMBER(write) override; - virtual DECLARE_READ8_MEMBER(read_io) override; - virtual DECLARE_WRITE8_MEMBER(write_io) override; - - uint8_t porta_r(); - uint8_t portb_r(); - void porta_w(uint8_t data); - void portb_w(uint8_t data); protected: astrocade_blueram_4k_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); virtual void device_start() override { m_ram.resize(0x1000); save_item(NAME(m_ram)); } virtual void device_reset() override { } - virtual void device_add_mconfig(machine_config &config) override; std::vector<uint8_t> m_ram; required_ioport m_write_prot; - required_device<ins8154_device> m_ramio; - required_device<cassette_image_device> m_cassette; }; // ======================> astrocade_blueram_16k_device diff --git a/src/devices/bus/astrocde/rom.cpp b/src/devices/bus/astrocde/rom.cpp index bb5d6912fc2..fcebedfc81d 100644 --- a/src/devices/bus/astrocde/rom.cpp +++ b/src/devices/bus/astrocde/rom.cpp @@ -17,10 +17,9 @@ // astrocade_rom_device - constructor //------------------------------------------------- -DEFINE_DEVICE_TYPE(ASTROCADE_ROM_STD, astrocade_rom_device, "astrocade_rom", "Bally Astrocade Standard Carts") -DEFINE_DEVICE_TYPE(ASTROCADE_ROM_256K, astrocade_rom_256k_device, "astrocade_rom_256k", "Bally Astrocade 256K Carts") -DEFINE_DEVICE_TYPE(ASTROCADE_ROM_512K, astrocade_rom_512k_device, "astrocade_rom_512k", "Bally Astrocade 512K Carts") -DEFINE_DEVICE_TYPE(ASTROCADE_ROM_CASS, astrocade_rom_cass_device, "astrocade_rom_cass", "Bally Astrocade AstroBASIC Cart") +DEFINE_DEVICE_TYPE(ASTROCADE_ROM_STD, astrocade_rom_device, "astrocade_rom", "Bally Astrocade Standard Carts") +DEFINE_DEVICE_TYPE(ASTROCADE_ROM_256K, astrocade_rom_256k_device, "astrocade_256k", "Bally Astrocade 256K Carts") +DEFINE_DEVICE_TYPE(ASTROCADE_ROM_512K, astrocade_rom_512k_device, "astrocade_512k", "Bally Astrocade 512K Carts") astrocade_rom_device::astrocade_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) @@ -43,12 +42,6 @@ astrocade_rom_512k_device::astrocade_rom_512k_device(const machine_config &mconf { } -astrocade_rom_cass_device::astrocade_rom_cass_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : astrocade_rom_device(mconfig, ASTROCADE_ROM_CASS, tag, owner, clock) - , m_cassette(*this, "cassette") -{ -} - void astrocade_rom_256k_device::device_start() { @@ -102,31 +95,3 @@ READ8_MEMBER(astrocade_rom_512k_device::read_rom) else // 0x3fc0-0x3fff return m_base_bank = offset & 0x7f; } - -READ8_MEMBER(astrocade_rom_cass_device::read_rom) -{ - if (offset < m_rom_size) - return m_rom[offset]; - else if ((offset & 0x1c00) == 0x1800) - { - m_cassette->output(+1); - return 0xff; - } - else if ((offset & 0x1c00) == 0x1c00) - { - m_cassette->output(-1); - return m_cassette->input() > 0.0 ? 0 : 1; - } - return 0xff; -} - -/*------------------------------------------------- - mapper specific device configuration - -------------------------------------------------*/ - -void astrocade_rom_cass_device::device_add_mconfig(machine_config &config) -{ - CASSETTE(config, m_cassette); - m_cassette->set_default_state(CASSETTE_STOPPED); - m_cassette->set_interface("astrocade_cass"); -} diff --git a/src/devices/bus/astrocde/rom.h b/src/devices/bus/astrocde/rom.h index efd17b16ded..0471ada8dd1 100644 --- a/src/devices/bus/astrocde/rom.h +++ b/src/devices/bus/astrocde/rom.h @@ -6,7 +6,6 @@ #pragma once #include "slot.h" -#include "imagedev/cassette.h" // ======================> astrocade_rom_device @@ -65,30 +64,10 @@ private: uint8_t m_base_bank; }; -// ======================> astrocade_rom_cass_device - -class astrocade_rom_cass_device : public astrocade_rom_device -{ -public: - // construction/destruction - astrocade_rom_cass_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - // reading and writing - virtual DECLARE_READ8_MEMBER(read_rom) override; - -private: - virtual void device_start() override { } - virtual void device_reset() override { } - virtual void device_add_mconfig(machine_config &config) override; - - required_device<cassette_image_device> m_cassette; -}; - // device type definition DECLARE_DEVICE_TYPE(ASTROCADE_ROM_STD, astrocade_rom_device) DECLARE_DEVICE_TYPE(ASTROCADE_ROM_256K, astrocade_rom_256k_device) DECLARE_DEVICE_TYPE(ASTROCADE_ROM_512K, astrocade_rom_512k_device) -DECLARE_DEVICE_TYPE(ASTROCADE_ROM_CASS, astrocade_rom_cass_device) #endif // MAME_BUS_ASTROCADE_ROM_H diff --git a/src/devices/bus/astrocde/slot.cpp b/src/devices/bus/astrocde/slot.cpp index 2aa78be98d9..b83b8e576ad 100644 --- a/src/devices/bus/astrocde/slot.cpp +++ b/src/devices/bus/astrocde/slot.cpp @@ -104,8 +104,7 @@ static const astrocade_slot slot_list[] = { { ASTROCADE_STD, "rom" }, { ASTROCADE_256K, "rom_256k" }, - { ASTROCADE_512K, "rom_512k" }, - { ASTROCADE_CASS, "rom_cass" } + { ASTROCADE_512K, "rom_512k" } }; static int astrocade_get_pcb_id(const char *slot) diff --git a/src/devices/bus/astrocde/slot.h b/src/devices/bus/astrocde/slot.h index 419f4672985..88c34fa0d8e 100644 --- a/src/devices/bus/astrocde/slot.h +++ b/src/devices/bus/astrocde/slot.h @@ -19,8 +19,7 @@ enum { ASTROCADE_STD = 0, ASTROCADE_256K, - ASTROCADE_512K, - ASTROCADE_CASS + ASTROCADE_512K }; |