summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/m6502/m6500_1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/m6502/m6500_1.cpp')
-rw-r--r--src/devices/cpu/m6502/m6500_1.cpp46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/devices/cpu/m6502/m6500_1.cpp b/src/devices/cpu/m6502/m6500_1.cpp
index aaede8b2bff..6ba2f9c3919 100644
--- a/src/devices/cpu/m6502/m6500_1.cpp
+++ b/src/devices/cpu/m6502/m6500_1.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Vas Crabb
/***************************************************************************
- m6500_1.h
+ m6500_1.cpp
MOS Technology 6500/1, original NMOS variant with onboard peripherals:
* 6502 CPU
@@ -58,11 +58,23 @@
appear to include the addition of an onboard power-on reset. It
is unknown what other differences these devices have.
+ TODO:
+ - For some reason most if not all Amiga MCU programs accesses arbitrary
+ zero page 0x90-0xff with a back-to-back cmp($00, x) opcode at
+ PC=c06-c08 with the actual result discarded. X can be any value in
+ the 0x90-0xff range, depending on the last user keypress row source
+ e.g. 0xdf-0xe0 for 'A', 0xef-0xf0 for 'Q', 0xfb-0xfc for function
+ keys.
+ This can be extremely verbose in the logging facility so we currently
+ nop it out for the time being.
+
***************************************************************************/
#include "emu.h"
#include "m6500_1.h"
+#include "m6502mcu.ipp"
+
namespace {
@@ -82,8 +94,8 @@ DEFINE_DEVICE_TYPE(M6500_1, m6500_1_device, "m6500_1", "MOS Technology 6500/1");
m6500_1_device::m6500_1_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
- : m6502_mcu_device(mconfig, M6500_1, tag, owner, clock)
- , m_port_in_cb{ *this }
+ : m6502_mcu_device_base<m6502_device>(mconfig, M6500_1, tag, owner, clock)
+ , m_port_in_cb{ *this, 0xffU }
, m_port_out_cb{ *this }
, m_cntr_out_cb{ *this }
, m_cr{ 0x00U }
@@ -124,24 +136,15 @@ void m6500_1_device::pd_w(u8 data)
}
-WRITE_LINE_MEMBER(m6500_1_device::cntr_w)
+void m6500_1_device::cntr_w(int state)
{
machine().scheduler().synchronize(timer_expired_delegate(FUNC(m6500_1_device::set_cntr_in), this), state);
}
-void m6500_1_device::device_resolve_objects()
-{
- m6502_mcu_device::device_resolve_objects();
-
- m_port_in_cb.resolve_all();
- m_port_out_cb.resolve_all_safe();
- m_cntr_out_cb.resolve_safe();
-}
-
void m6500_1_device::device_start()
{
- m6502_mcu_device::device_start();
+ m6502_mcu_device_base<m6502_device>::device_start();
m_counter_base = 0U;
@@ -163,7 +166,7 @@ void m6500_1_device::device_start()
void m6500_1_device::device_reset()
{
- m6502_mcu_device::device_reset();
+ m6502_mcu_device_base<m6502_device>::device_reset();
SP = 0x003fU;
@@ -228,7 +231,7 @@ void m6500_1_device::state_import(device_state_entry const &entry)
break;
default:
- m6502_mcu_device::state_import(entry);
+ m6502_mcu_device_base<m6502_device>::state_import(entry);
}
}
@@ -259,7 +262,7 @@ void m6500_1_device::state_export(device_state_entry const &entry)
break;
default:
- m6502_mcu_device::state_export(entry);
+ m6502_mcu_device_base<m6502_device>::state_export(entry);
}
}
@@ -296,7 +299,7 @@ void m6500_1_device::update_irq()
u8 m6500_1_device::read_port(offs_t offset)
{
- if (!machine().side_effects_disabled() && m_port_in_cb[offset])
+ if (!machine().side_effects_disabled() && !m_port_in_cb[offset].isunset())
{
u8 const prev(m_port_in[offset]);
m_port_in[offset] = m_port_in_cb[offset]();
@@ -322,7 +325,7 @@ void m6500_1_device::write_port(offs_t offset, u8 data)
if (!offset)
{
- if (!machine().side_effects_disabled() && m_port_in_cb[0])
+ if (!machine().side_effects_disabled() && !m_port_in_cb[0].isunset())
m_port_in[0] = m_port_in_cb[0]();
u8 const effective(m_port_in[0] & data);
u8 const diff(prev ^ effective);
@@ -343,7 +346,7 @@ void m6500_1_device::clear_edge(offs_t offset, u8 data)
template <unsigned Port> TIMER_CALLBACK_MEMBER(m6500_1_device::set_port_in)
{
u8 const prev(m_port_in[Port]);
- m_port_in[Port] = m_port_in_cb[Port] ? m_port_in_cb[Port]() : u8(u32(param));
+ m_port_in[Port] = !m_port_in_cb[Port].isunset() ? m_port_in_cb[Port]() : u8(u32(param));
if (!Port)
{
@@ -504,5 +507,8 @@ void m6500_1_device::memory_map(address_map &map)
map(0x008f, 0x008f).rw(FUNC(m6500_1_device::read_control_register), FUNC(m6500_1_device::write_control_register));
+ // TODO: mirror or actually unmapped?
+ map(0x0090, 0x00ff).nopr();
+
map(0x0800, 0x0fff).rom().region(DEVICE_SELF, 0);
}