summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2021-05-17 20:14:26 -0400
committer arbee <rb6502@users.noreply.github.com>2021-05-17 20:14:26 -0400
commit24b7ed9ec5ba5e8769a99b6550909f8fad5d3788 (patch)
tree4d68a262e0a37776f0e68ed0b298a59d050e086b
parent9b599afb0bb8772175ad190f4163e7b9af0df004 (diff)
adb: add skeleton for model A9M0331 ADB mouse. [R. Belmont, Al Kossow]
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/adb/a9m0331.cpp125
-rw-r--r--src/devices/bus/adb/a9m0331.h42
-rw-r--r--src/devices/bus/adb/adb.cpp2
-rw-r--r--src/mame/machine/egret.cpp4
5 files changed, 175 insertions, 0 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index e51160abade..2beab5212bf 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -201,6 +201,8 @@ if (BUSES["ADB"]~=null) then
MAME_DIR .. "src/devices/bus/adb/adb.h",
MAME_DIR .. "src/devices/bus/adb/adbhle.cpp",
MAME_DIR .. "src/devices/bus/adb/adbhle.h",
+ MAME_DIR .. "src/devices/bus/adb/a9m0331.cpp",
+ MAME_DIR .. "src/devices/bus/adb/a9m0331.h",
}
end
diff --git a/src/devices/bus/adb/a9m0331.cpp b/src/devices/bus/adb/a9m0331.cpp
new file mode 100644
index 00000000000..73c4240d414
--- /dev/null
+++ b/src/devices/bus/adb/a9m0331.cpp
@@ -0,0 +1,125 @@
+// license:BSD-3-Clause
+// copyright-holders: R. Belmont
+/*********************************************************************
+
+ a9m0331.cpp
+ Apple standard ADB mouse
+ Skeleton by R. Belmont
+
+ TODO: Everything.
+ What 6805 or 68705 sub-model is this?
+ Is the boot vector actually correct?
+
+*********************************************************************/
+
+#include "emu.h"
+#include "a9m0331.h"
+
+DEFINE_DEVICE_TYPE(ADB_A9M0331, a9m0331_device, "a9m0331", "Apple ADB Mouse (A9M0331)");
+
+ROM_START(a9m0331)
+ ROM_REGION(0x800, "mcu", 0)
+ ROM_LOAD( "lsc84488p_1986_3.0.bin", 0x000000, 0x000800, CRC(572a11e0) SHA1(caab6c60b18670e5ea597e35e526032e33b6e8c7) )
+ ROM_LOAD( "zc84506p_1987_ea_3.2_trim.bin", 0x000000, 0x000800, CRC(85f858d9) SHA1(61ebad9953f4f88b6fcabf498f3875918493d138) )
+ROM_END
+
+static INPUT_PORTS_START(a9m0331)
+ PORT_START("button")
+ PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1)
+
+ PORT_START("mousex")
+ PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(40) PORT_KEYDELTA(0) PORT_PLAYER(1)
+
+ PORT_START("mousey")
+ PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(40) PORT_KEYDELTA(0) PORT_PLAYER(1)
+INPUT_PORTS_END
+
+/***************************************************************************
+ DEVICE CONFIGURATION
+***************************************************************************/
+
+/*-------------------------------------------------
+ input_ports - device-specific input ports
+-------------------------------------------------*/
+ioport_constructor a9m0331_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME(a9m0331);
+}
+
+/*-------------------------------------------------
+ device_add_mconfig - device-specific
+ machine configurations
+-------------------------------------------------*/
+void a9m0331_device::device_add_mconfig(machine_config &config)
+{
+ M68705P3(config, m_mcu, 2048000);
+ m_mcu->porta_r().set(FUNC(a9m0331_device::mcu_port_a_r));
+ m_mcu->portb_r().set(FUNC(a9m0331_device::mcu_port_b_r));
+ m_mcu->portc_r().set(FUNC(a9m0331_device::mcu_port_c_r));
+ m_mcu->porta_w().set(FUNC(a9m0331_device::mcu_port_a_w));
+ m_mcu->portb_w().set(FUNC(a9m0331_device::mcu_port_b_w));
+ m_mcu->portc_w().set(FUNC(a9m0331_device::mcu_port_c_w));
+}
+
+/*-------------------------------------------------
+ rom_region - device-specific ROM region
+-------------------------------------------------*/
+const tiny_rom_entry *a9m0331_device::device_rom_region() const
+{
+ return ROM_NAME(a9m0331);
+}
+
+/***************************************************************************
+ DEVICE IMPLEMENTATION
+***************************************************************************/
+
+a9m0331_device::a9m0331_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ adb_device(mconfig, ADB_A9M0331, tag, owner, clock),
+ adb_slot_card_interface(mconfig, *this, DEVICE_SELF),
+ m_mcu(*this, "mcu")
+{
+}
+
+void a9m0331_device::device_start()
+{
+ adb_device::device_start();
+}
+
+void a9m0331_device::device_reset()
+{
+ adb_device::device_reset();
+}
+
+void a9m0331_device::adb_w(int state)
+{
+}
+
+void a9m0331_device::mcu_port_a_w(u8 data)
+{
+ logerror("%02x to port A\n", data);
+}
+
+void a9m0331_device::mcu_port_b_w(u8 data)
+{
+ logerror("%02x to port B\n", data);
+}
+
+void a9m0331_device::mcu_port_c_w(u8 data)
+{
+ logerror("%02x to port C\n", data);
+}
+
+u8 mcu_port_a_r()
+{
+ return 0xff;
+}
+
+u8 mcu_port_b_r()
+{
+ return 0xff;
+}
+
+u8 mcu_port_c_r()
+{
+ return 0xff;
+}
diff --git a/src/devices/bus/adb/a9m0331.h b/src/devices/bus/adb/a9m0331.h
new file mode 100644
index 00000000000..f6fd1d145ab
--- /dev/null
+++ b/src/devices/bus/adb/a9m0331.h
@@ -0,0 +1,42 @@
+// license:BSD-3-Clause
+// copyright-holders: R. Belmont
+
+// a9m0331.h - Apple ADB mouse
+
+#ifndef MAME_BUS_ADB_A9M0331_H
+#define MAME_BUS_ADB_A9M0331_H
+
+#pragma once
+
+#include "adb.h"
+#include "cpu/m6805/m68705.h"
+
+class a9m0331_device : public adb_device, public adb_slot_card_interface
+{
+public:
+ a9m0331_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ virtual const tiny_rom_entry *device_rom_region() const override;
+ virtual ioport_constructor device_input_ports() const override;
+ virtual void device_add_mconfig(machine_config &config) override;
+
+ virtual void adb_w(int state) override;
+
+ required_device<m68705p_device> m_mcu;
+
+private:
+ void mcu_port_a_w(u8 data);
+ void mcu_port_b_w(u8 data);
+ void mcu_port_c_w(u8 data);
+ u8 mcu_port_a_r();
+ u8 mcu_port_b_r();
+ u8 mcu_port_c_r();
+};
+
+DECLARE_DEVICE_TYPE(ADB_A9M0331, a9m0331_device)
+
+#endif
diff --git a/src/devices/bus/adb/adb.cpp b/src/devices/bus/adb/adb.cpp
index 3ff2ea6b382..d0d329fd741 100644
--- a/src/devices/bus/adb/adb.cpp
+++ b/src/devices/bus/adb/adb.cpp
@@ -11,6 +11,7 @@
#include "adb.h"
#include "adbhle.h"
+#include "a9m0331.h"
DEFINE_DEVICE_TYPE(ADB_CONNECTOR, adb_connector, "adbslot", "ADB connector")
@@ -61,4 +62,5 @@ void adb_device::device_reset()
void adb_device::default_devices(device_slot_interface &device)
{
device.option_add("hle", ADB_HLE);
+ device.option_add("a9m0331", ADB_A9M0331);
}
diff --git a/src/mame/machine/egret.cpp b/src/mame/machine/egret.cpp
index 53658209496..ecd7146251b 100644
--- a/src/mame/machine/egret.cpp
+++ b/src/mame/machine/egret.cpp
@@ -87,6 +87,10 @@ void egret_device::device_add_mconfig(machine_config &config)
{
M68HC05EG(config, m_maincpu, XTAL(32'768)*128); // Intended to run 4.1 MHz, the ADB timings in uS are twice as long as spec at 2.1
m_maincpu->set_addrmap(AS_PROGRAM, &egret_device::egret_map);
+
+ #if USE_BUS_ADB
+ ADB_CONNECTOR(config, "adb1", adb_device::default_devices, "a9m0331", false);
+ #endif
}
const tiny_rom_entry *egret_device::device_rom_region() const