summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/nec/nec.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-05-04 20:08:23 -0400
committer AJR <ajrhacker@users.noreply.github.com>2020-05-04 20:10:23 -0400
commita1a33d25e27174f9a0293b8377acf7548e69e1b5 (patch)
tree42acd9ebcd3b6567d5713f14bd809c843cb53d22 /src/devices/cpu/nec/nec.cpp
parent0e2f53c45bb676bfd77f4af55a7b9affcc4aab7b (diff)
nec, v25: Add byte registers to debugger state; improve tracking of previous PC for debugger; use more NEC register names
Diffstat (limited to 'src/devices/cpu/nec/nec.cpp')
-rw-r--r--src/devices/cpu/nec/nec.cpp60
1 files changed, 38 insertions, 22 deletions
diff --git a/src/devices/cpu/nec/nec.cpp b/src/devices/cpu/nec/nec.cpp
index e0363f54d40..09469dcad16 100644
--- a/src/devices/cpu/nec/nec.cpp
+++ b/src/devices/cpu/nec/nec.cpp
@@ -285,6 +285,7 @@ void nec_common_device::device_reset()
memset( &m_regs.w, 0, sizeof(m_regs.w));
m_ip = 0;
+ m_prev_ip = 0;
m_TF = 0;
m_IF = 0;
m_DF = 0;
@@ -331,7 +332,7 @@ void nec_common_device::nec_interrupt(unsigned int_num, int/*INTSOURCES*/ source
PUSH(Sreg(PS));
PUSH(m_ip);
- m_ip = (WORD)dest_off;
+ m_prev_ip = m_ip = (WORD)dest_off;
Sreg(PS) = (WORD)dest_seg;
CHANGE_PC;
}
@@ -352,7 +353,7 @@ void nec_common_device::nec_brk(unsigned int_num)
PUSH(Sreg(PS));
PUSH(m_ip);
}
- m_ip = read_mem_word(int_num*4);
+ m_prev_ip = m_ip = read_mem_word(int_num*4);
Sreg(PS) = read_mem_word(int_num*4+2);
CHANGE_PC;
}
@@ -464,6 +465,7 @@ void nec_common_device::device_start()
m_E16 = 0;
m_debugger_temp = 0;
m_ip = 0;
+ m_prev_ip = 0;
memset(m_regs.w, 0x00, sizeof(m_regs.w));
memset(m_sregs, 0x00, sizeof(m_sregs));
@@ -472,6 +474,7 @@ void nec_common_device::device_start()
save_item(NAME(m_sregs));
save_item(NAME(m_ip));
+ save_item(NAME(m_prev_ip));
save_item(NAME(m_TF));
save_item(NAME(m_IF));
save_item(NAME(m_DF));
@@ -511,21 +514,29 @@ void nec_common_device::device_start()
m_io = &space(AS_IO);
- state_add( NEC_PC, "PC", m_debugger_temp).callimport().callexport().formatstr("%05X");
- state_add( NEC_IP, "IP", m_ip).formatstr("%04X");
- state_add( NEC_SP, "SP", Wreg(SP)).formatstr("%04X");
- state_add( NEC_FLAGS, "F", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( NEC_AW, "AW", Wreg(AW)).formatstr("%04X");
- state_add( NEC_CW, "CW", Wreg(CW)).formatstr("%04X");
- state_add( NEC_DW, "DW", Wreg(DW)).formatstr("%04X");
- state_add( NEC_BW, "BW", Wreg(BW)).formatstr("%04X");
- state_add( NEC_BP, "BP", Wreg(BP)).formatstr("%04X");
- state_add( NEC_IX, "IX", Wreg(IX)).formatstr("%04X");
- state_add( NEC_IY, "IY", Wreg(IY)).formatstr("%04X");
- state_add( NEC_ES, "DS1", Sreg(DS1)).formatstr("%04X");
- state_add( NEC_CS, "PS", Sreg(PS)).formatstr("%04X");
- state_add( NEC_SS, "SS", Sreg(SS)).formatstr("%04X");
- state_add( NEC_DS, "DS0", Sreg(DS0)).formatstr("%04X");
+ state_add( NEC_PC, "PC", m_ip).formatstr("%04X");
+ state_add( NEC_PSW, "PSW", m_debugger_temp).callimport().callexport().formatstr("%04X");
+ state_add( NEC_AW, "AW", Wreg(AW)).formatstr("%04X");
+ state_add( NEC_CW, "CW", Wreg(CW)).formatstr("%04X");
+ state_add( NEC_DW, "DW", Wreg(DW)).formatstr("%04X");
+ state_add( NEC_BW, "BW", Wreg(BW)).formatstr("%04X");
+ state_add( NEC_SP, "SP", Wreg(SP)).formatstr("%04X");
+ state_add( NEC_BP, "BP", Wreg(BP)).formatstr("%04X");
+ state_add( NEC_IX, "IX", Wreg(IX)).formatstr("%04X");
+ state_add( NEC_IY, "IY", Wreg(IY)).formatstr("%04X");
+ state_add( NEC_DS1, "DS1", Sreg(DS1)).formatstr("%04X");
+ state_add( NEC_PS, "PS", Sreg(PS)).formatstr("%04X");
+ state_add( NEC_SS, "SS", Sreg(SS)).formatstr("%04X");
+ state_add( NEC_DS0, "DS0", Sreg(DS0)).formatstr("%04X");
+
+ state_add( NEC_AL, "AL", Breg(AL)).noshow();
+ state_add( NEC_AH, "AH", Breg(AH)).noshow();
+ state_add( NEC_CL, "CL", Breg(CL)).noshow();
+ state_add( NEC_CH, "CH", Breg(CH)).noshow();
+ state_add( NEC_DL, "DL", Breg(DL)).noshow();
+ state_add( NEC_DH, "DH", Breg(DH)).noshow();
+ state_add( NEC_BL, "BL", Breg(BL)).noshow();
+ state_add( NEC_BH, "BH", Breg(BH)).noshow();
if (m_chip_type == V33_TYPE)
state_add(NEC_XA, "XA", m_xa);
@@ -570,7 +581,7 @@ void nec_common_device::state_import(const device_state_entry &entry)
{
switch (entry.index())
{
- case NEC_PC:
+ case STATE_GENPC:
if (m_debugger_temp - (Sreg(PS)<<4) < 0x10000)
{
m_ip = m_debugger_temp - (Sreg(PS)<<4);
@@ -580,9 +591,10 @@ void nec_common_device::state_import(const device_state_entry &entry)
Sreg(PS) = m_debugger_temp >> 4;
m_ip = m_debugger_temp & 0x0000f;
}
+ m_prev_ip = m_ip;
break;
- case NEC_FLAGS:
+ case NEC_PSW:
ExpandFlags(m_debugger_temp);
break;
}
@@ -594,16 +606,18 @@ void nec_common_device::state_export(const device_state_entry &entry)
switch (entry.index())
{
case STATE_GENPC:
- case STATE_GENPCBASE:
- case NEC_PC:
m_debugger_temp = (Sreg(PS)<<4) + m_ip;
break;
+ case STATE_GENPCBASE:
+ m_debugger_temp = (Sreg(PS)<<4) + m_prev_ip;
+ break;
+
case STATE_GENSP:
m_debugger_temp = (Sreg(SS)<<4) + Wreg(SP);
break;
- case NEC_FLAGS:
+ case NEC_PSW:
m_debugger_temp = CompressFlags();
break;
}
@@ -622,6 +636,8 @@ void nec_common_device::execute_run()
}
while(m_icount>0) {
+ m_prev_ip = m_ip;
+
/* Dispatch IRQ */
if (m_pending_irq && m_no_interrupt==0)
{