summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/mcs48/mcs48.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/mcs48/mcs48.cpp')
-rw-r--r--src/devices/cpu/mcs48/mcs48.cpp98
1 files changed, 45 insertions, 53 deletions
diff --git a/src/devices/cpu/mcs48/mcs48.cpp b/src/devices/cpu/mcs48/mcs48.cpp
index 865da42c104..b3ea2e55dda 100644
--- a/src/devices/cpu/mcs48/mcs48.cpp
+++ b/src/devices/cpu/mcs48/mcs48.cpp
@@ -34,7 +34,7 @@
8648 64 1k 27 (OTPROM)
8748 64 1k 27 (EPROM)
8884 64 1k
- N7751 128 2k
+ N7751 64 1k (8048, speech synthesizer in internal ROM)
8039 128 0 27 (external ROM)
8049 128 2k 27 (ROM)
@@ -87,8 +87,6 @@
#include "mcs48.h"
#include "mcs48dsm.h"
-#include "debugger.h"
-
/***************************************************************************
CONSTANTS
@@ -161,7 +159,7 @@ DEFINE_DEVICE_TYPE(I8742, i8742_device, "i8742", "Intel 8742")
DEFINE_DEVICE_TYPE(I8042AH, i8042ah_device, "i8042ah", "Intel 8042AH")
DEFINE_DEVICE_TYPE(I8742AH, i8742ah_device, "i8742ah", "Intel 8742AH")
DEFINE_DEVICE_TYPE(MB8884, mb8884_device, "mb8884", "MB8884")
-DEFINE_DEVICE_TYPE(N7751, n7751_device, "n7751", "N7751")
+DEFINE_DEVICE_TYPE(N7751, n7751_device, "n7751", "NEC uPD7751")
DEFINE_DEVICE_TYPE(M58715, m58715_device, "m58715", "M58715")
@@ -203,16 +201,21 @@ void mcs48_cpu_device::data_8bit(address_map &map)
mcs48_cpu_device::mcs48_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int rom_size, int ram_size, uint8_t feature_mask, const mcs48_cpu_device::mcs48_ophandler *opcode_table)
: cpu_device(mconfig, type, tag, owner, clock)
- , m_program_config("program", ENDIANNESS_LITTLE, 8, (feature_mask & MB_FEATURE) != 0 ? 12 : 11, 0
- , (rom_size == 1024) ? address_map_constructor(FUNC(mcs48_cpu_device::program_10bit), this) : (rom_size == 2048) ? address_map_constructor(FUNC(mcs48_cpu_device::program_11bit), this) : (rom_size == 4096) ? address_map_constructor(FUNC(mcs48_cpu_device::program_12bit), this) : address_map_constructor())
- , m_data_config("data", ENDIANNESS_LITTLE, 8, ( ( ram_size == 64 ) ? 6 : ( ( ram_size == 128 ) ? 7 : 8 ) ), 0
- , (ram_size == 64) ? address_map_constructor(FUNC(mcs48_cpu_device::data_6bit), this) : (ram_size == 128) ? address_map_constructor(FUNC(mcs48_cpu_device::data_7bit), this) : address_map_constructor(FUNC(mcs48_cpu_device::data_8bit), this))
+ , m_program_config("program", ENDIANNESS_LITTLE, 8, (feature_mask & MB_FEATURE) != 0 ? 12 : 11, 0,
+ (rom_size == 1024) ? address_map_constructor(FUNC(mcs48_cpu_device::program_10bit), this) :
+ (rom_size == 2048) ? address_map_constructor(FUNC(mcs48_cpu_device::program_11bit), this) :
+ (rom_size == 4096) ? address_map_constructor(FUNC(mcs48_cpu_device::program_12bit), this) :
+ address_map_constructor())
+ , m_data_config("data", ENDIANNESS_LITTLE, 8, ((ram_size == 64) ? 6 : ((ram_size == 128) ? 7 : 8)), 0,
+ (ram_size == 64) ? address_map_constructor(FUNC(mcs48_cpu_device::data_6bit), this) :
+ (ram_size == 128) ? address_map_constructor(FUNC(mcs48_cpu_device::data_7bit), this) :
+ address_map_constructor(FUNC(mcs48_cpu_device::data_8bit), this))
, m_io_config("io", ENDIANNESS_LITTLE, 8, 8, 0)
- , m_port_in_cb(*this)
+ , m_port_in_cb(*this, 0xff)
, m_port_out_cb(*this)
- , m_bus_in_cb(*this)
+ , m_bus_in_cb(*this, 0xff)
, m_bus_out_cb(*this)
- , m_test_in_cb(*this)
+ , m_test_in_cb(*this, 0)
, m_t0_clk_func(*this)
, m_prog_out_cb(*this)
, m_psw(0)
@@ -711,11 +714,9 @@ OPHANDLER( in_a_p2 ) { burn_cycles(2); m_a = port_r(2) & m_p2; }
OPHANDLER( ins_a_bus ) { burn_cycles(2); m_a = bus_r(); }
OPHANDLER( in_a_dbb )
{
- burn_cycles(2);
+ burn_cycles(1);
// acknowledge the IBF IRQ and clear the bit in STS
- if ((m_sts & STS_IBF) != 0)
- standard_irq_callback(UPI41_INPUT_IBF);
m_sts &= ~STS_IBF;
// if P2 flags are enabled, update the state of P2
@@ -852,7 +853,7 @@ OPHANDLER( outl_p1_a ) { burn_cycles(2); port_w(1, m_p1 = m_a); }
OPHANDLER( outl_p2_a ) { burn_cycles(2); uint8_t mask = p2_mask(); port_w(2, m_p2 = (m_p2 & ~mask) | (m_a & mask)); }
OPHANDLER( out_dbb_a )
{
- burn_cycles(2);
+ burn_cycles(1);
// copy to the DBBO and update the bit in STS
m_dbbo = m_a;
@@ -1132,47 +1133,36 @@ void mcs48_cpu_device::device_start()
if(m_feature_mask & EXT_BUS_FEATURE)
space(AS_IO).specific(m_io);
- // resolve callbacks
- m_port_in_cb.resolve_all_safe(0xff);
- m_port_out_cb.resolve_all_safe();
- m_bus_in_cb.resolve_safe(0xff);
- m_bus_out_cb.resolve_safe();
- m_test_in_cb.resolve_all_safe(0);
- m_prog_out_cb.resolve_safe();
-
// ensure that regptr is valid before get_info gets called
update_regptr();
// set up the state table
- {
- state_add(MCS48_PC, "PC", m_pc).mask(0xfff);
- state_add(STATE_GENPC, "GENPC", m_pc).mask(0xfff).noshow();
- state_add(STATE_GENPCBASE, "CURPC", m_prevpc).mask(0xfff).noshow();
- state_add(MCS48_SP, "SP", m_psw).mask(0x7).noshow();
- state_add(STATE_GENFLAGS, "GENFLAGS", m_psw).noshow().formatstr("%11s");
- state_add(MCS48_A, "A", m_a);
- state_add(MCS48_TC, "TC", m_timer);
- state_add(MCS48_TPRE, "TPRE", m_prescaler).mask(0x1f);
-
- if (m_feature_mask & I802X_FEATURE)
- state_add(MCS48_P0, "P0", m_dbbo);
- state_add(MCS48_P1, "P1", m_p1);
- state_add(MCS48_P2, "P2", m_p2);
-
- for (int regnum = 0; regnum < 8; regnum++) {
- state_add(MCS48_R0 + regnum, string_format("R%d", regnum).c_str(), m_rtemp).callimport().callexport();
- }
-
- if (m_feature_mask & EXT_BUS_FEATURE)
- state_add(MCS48_EA, "EA", m_ea).mask(0x1);
+ state_add(MCS48_PC, "PC", m_pc).mask(0xfff);
+ state_add(STATE_GENPC, "GENPC", m_pc).mask(0xfff).noshow();
+ state_add(STATE_GENPCBASE, "CURPC", m_prevpc).mask(0xfff).noshow();
+ state_add(MCS48_SP, "SP", m_psw).mask(0x7).noshow();
+ state_add(STATE_GENFLAGS, "GENFLAGS", m_psw).noshow().formatstr("%11s");
+ state_add(MCS48_A, "A", m_a);
+ state_add(MCS48_TC, "TC", m_timer);
+ state_add(MCS48_TPRE, "TPRE", m_prescaler).mask(0x1f);
+
+ if (m_feature_mask & I802X_FEATURE)
+ state_add(MCS48_P0, "P0", m_dbbo);
+ state_add(MCS48_P1, "P1", m_p1);
+ state_add(MCS48_P2, "P2", m_p2);
+
+ for (int regnum = 0; regnum < 8; regnum++) {
+ state_add(MCS48_R0 + regnum, string_format("R%d", regnum).c_str(), m_rtemp).callimport().callexport();
+ }
- if (m_feature_mask & UPI41_FEATURE)
- {
- state_add(MCS48_STS, "STS", m_sts).mask(0xf3);
- state_add(MCS48_DBBI, "DBBI", m_dbbi);
- state_add(MCS48_DBBO, "DBBO", m_dbbo);
- }
+ if (m_feature_mask & EXT_BUS_FEATURE)
+ state_add(MCS48_EA, "EA", m_ea).mask(0x1);
+ if (m_feature_mask & UPI41_FEATURE)
+ {
+ state_add(MCS48_STS, "STS", m_sts).mask(0xf3);
+ state_add(MCS48_DBBI, "DBBI", m_dbbi);
+ state_add(MCS48_DBBO, "DBBO", m_dbbo);
}
// register for savestates
@@ -1258,6 +1248,9 @@ void mcs48_cpu_device::check_irqs()
// external interrupts take priority
else if ((m_irq_state || (m_sts & STS_IBF) != 0) && m_xirq_enabled)
{
+ // indicate we took the external IRQ
+ standard_irq_callback(0, m_pc);
+
burn_cycles(2);
m_irq_in_progress = true;
@@ -1270,14 +1263,13 @@ void mcs48_cpu_device::check_irqs()
// transfer to location 0x03
execute_call(0x03);
-
- // indicate we took the external IRQ
- standard_irq_callback(0);
}
// timer overflow interrupts follow
else if (m_timer_overflow && m_tirq_enabled)
{
+ standard_irq_callback(1, m_pc);
+
burn_cycles(2);
m_irq_in_progress = true;