summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/mcs96/mcs96.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/mcs96/mcs96.cpp')
-rw-r--r--src/devices/cpu/mcs96/mcs96.cpp58
1 files changed, 24 insertions, 34 deletions
diff --git a/src/devices/cpu/mcs96/mcs96.cpp b/src/devices/cpu/mcs96/mcs96.cpp
index 76dbb2d8609..93e4603293f 100644
--- a/src/devices/cpu/mcs96/mcs96.cpp
+++ b/src/devices/cpu/mcs96/mcs96.cpp
@@ -9,7 +9,6 @@
***************************************************************************/
#include "emu.h"
-#include "debugger.h"
#include "mcs96.h"
mcs96_device::mcs96_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int data_width, address_map_constructor regs_map) :
@@ -26,19 +25,19 @@ void mcs96_device::device_start()
{
program = &space(AS_PROGRAM);
if(program->data_width() == 8) {
- auto cache = program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_pr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ program->cache(m_cache8);
+ m_pr8 = [this](offs_t address) -> u8 { return m_cache8.read_byte(address); };
} else {
- auto cache = program->cache<1, 0, ENDIANNESS_LITTLE>();
- m_pr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ program->cache(m_cache16);
+ m_pr8 = [this](offs_t address) -> u8 { return m_cache16.read_byte(address); };
}
regs = &space(AS_DATA);
set_icountptr(icount);
+ auto register_file_bytes = util::little_endian_cast<u8>(register_file.target());
state_add(STATE_GENPC, "GENPC", PC).noshow();
state_add(STATE_GENPCBASE, "CURPC", PPC).noshow();
- state_add(STATE_GENSP, "GENSP", register_file[0]).noshow();
state_add(STATE_GENFLAGS, "GENFLAGS", PSW).formatstr("%16s").noshow();
state_add(MCS96_PC, "PC", PC);
state_add(MCS96_PSW, "PSW", PSW);
@@ -48,14 +47,14 @@ void mcs96_device::device_start()
state_add(MCS96_DX, "DX", register_file[3]);
state_add(MCS96_BX, "BX", register_file[4]);
state_add(MCS96_CX, "CX", register_file[5]);
- state_add(MCS96_AL, "AL", reinterpret_cast<u8 *>(&register_file[2])[BYTE_XOR_LE(0)]).noshow();
- state_add(MCS96_AH, "AH", reinterpret_cast<u8 *>(&register_file[2])[BYTE_XOR_LE(1)]).noshow();
- state_add(MCS96_DL, "DL", reinterpret_cast<u8 *>(&register_file[3])[BYTE_XOR_LE(0)]).noshow();
- state_add(MCS96_DH, "DH", reinterpret_cast<u8 *>(&register_file[3])[BYTE_XOR_LE(1)]).noshow();
- state_add(MCS96_BL, "BL", reinterpret_cast<u8 *>(&register_file[4])[BYTE_XOR_LE(0)]).noshow();
- state_add(MCS96_BH, "BH", reinterpret_cast<u8 *>(&register_file[4])[BYTE_XOR_LE(1)]).noshow();
- state_add(MCS96_CL, "CL", reinterpret_cast<u8 *>(&register_file[5])[BYTE_XOR_LE(0)]).noshow();
- state_add(MCS96_CH, "CH", reinterpret_cast<u8 *>(&register_file[5])[BYTE_XOR_LE(1)]).noshow();
+ state_add(MCS96_AL, "AL", register_file_bytes[4]).noshow();
+ state_add(MCS96_AH, "AH", register_file_bytes[5]).noshow();
+ state_add(MCS96_DL, "DL", register_file_bytes[6]).noshow();
+ state_add(MCS96_DH, "DH", register_file_bytes[7]).noshow();
+ state_add(MCS96_BL, "BL", register_file_bytes[8]).noshow();
+ state_add(MCS96_BH, "BH", register_file_bytes[9]).noshow();
+ state_add(MCS96_CL, "CL", register_file_bytes[10]).noshow();
+ state_add(MCS96_CH, "CH", register_file_bytes[11]).noshow();
save_item(NAME(inst_state));
save_item(NAME(pending_irq));
@@ -79,21 +78,16 @@ void mcs96_device::device_reset()
inst_state = STATE_FETCH;
}
-uint32_t mcs96_device::execute_min_cycles() const
+uint32_t mcs96_device::execute_min_cycles() const noexcept
{
return 4;
}
-uint32_t mcs96_device::execute_max_cycles() const
+uint32_t mcs96_device::execute_max_cycles() const noexcept
{
return 33;
}
-uint32_t mcs96_device::execute_input_lines() const
-{
- return 1;
-}
-
void mcs96_device::recompute_bcount(uint64_t event_time)
{
if(!event_time || event_time >= total_cycles() + icount) {
@@ -152,19 +146,6 @@ void mcs96_device::execute_run()
}
}
-void mcs96_device::execute_set_input(int inputnum, int state)
-{
- switch(inputnum) {
- case EXINT_LINE:
- if(state)
- pending_irq |= 0x80;
- else
- pending_irq &= 0x7f;
- check_irq();
- break;
- }
-}
-
device_memory_interface::space_config_vector mcs96_device::memory_space_config() const
{
return space_config_vector {
@@ -260,6 +241,15 @@ u16 mcs96_device::any_r16(u16 adr)
return program->read_word(adr);
}
+bool mcs96_device::memory_translate(int spacenum, int intention, offs_t &address, address_space *&target_space)
+{
+ if (spacenum == AS_PROGRAM && intention != TR_FETCH && address < 0x100)
+ target_space = regs;
+ else
+ target_space = &space(spacenum);
+ return true;
+}
+
uint8_t mcs96_device::do_addb(uint8_t v1, uint8_t v2)
{
uint16_t sum = v1+v2;