summaryrefslogtreecommitdiffstatshomepage
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
parent0e2f53c45bb676bfd77f4af55a7b9affcc4aab7b (diff)
nec, v25: Add byte registers to debugger state; improve tracking of previous PC for debugger; use more NEC register names
-rw-r--r--src/devices/cpu/nec/nec.cpp60
-rw-r--r--src/devices/cpu/nec/nec.h7
-rw-r--r--src/devices/cpu/nec/v25.cpp163
-rw-r--r--src/devices/cpu/nec/v25.h7
4 files changed, 85 insertions, 152 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)
{
diff --git a/src/devices/cpu/nec/nec.h b/src/devices/cpu/nec/nec.h
index 1e3a0dbc22f..7734c1dd40c 100644
--- a/src/devices/cpu/nec/nec.h
+++ b/src/devices/cpu/nec/nec.h
@@ -13,8 +13,10 @@
enum
{
NEC_PC=0,
- NEC_IP, NEC_AW, NEC_CW, NEC_DW, NEC_BW, NEC_SP, NEC_BP, NEC_IX, NEC_IY,
- NEC_FLAGS, NEC_ES, NEC_CS, NEC_SS, NEC_DS,
+ NEC_AW, NEC_CW, NEC_DW, NEC_BW, NEC_SP, NEC_BP, NEC_IX, NEC_IY,
+ NEC_DS1, NEC_PS, NEC_SS, NEC_DS0,
+ NEC_AL, NEC_AH, NEC_CL, NEC_CH, NEC_DL, NEC_DH, NEC_BL, NEC_BH,
+ NEC_PSW,
NEC_XA,
NEC_PENDING
};
@@ -77,6 +79,7 @@ private:
uint16_t m_sregs[4];
uint16_t m_ip;
+ uint16_t m_prev_ip;
/* PSW flags */
int32_t m_SignVal;
diff --git a/src/devices/cpu/nec/v25.cpp b/src/devices/cpu/nec/v25.cpp
index e5f18733719..9d57b0f2733 100644
--- a/src/devices/cpu/nec/v25.cpp
+++ b/src/devices/cpu/nec/v25.cpp
@@ -180,6 +180,7 @@ uint8_t v25_common_device::fetchop()
void v25_common_device::device_reset()
{
m_ip = 0;
+ m_prev_ip = 0;
m_IBRK = 1;
m_F0 = 0;
m_F1 = 0;
@@ -270,7 +271,7 @@ void v25_common_device::nec_interrupt(unsigned int_num, int /*INTSOURCES*/ sourc
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;
}
@@ -286,7 +287,7 @@ void v25_common_device::nec_bankswitch(unsigned bank_num)
Wreg(PSW_SAVE) = tmp;
Wreg(PC_SAVE) = m_ip;
- m_ip = Wreg(VECTOR_PC);
+ m_prev_ip = m_ip = Wreg(VECTOR_PC);
CHANGE_PC;
}
@@ -565,6 +566,7 @@ void v25_common_device::device_start()
save_item(NAME(m_intp_state));
save_item(NAME(m_ip));
+ save_item(NAME(m_prev_ip));
save_item(NAME(m_IBRK));
save_item(NAME(m_F0));
save_item(NAME(m_F1));
@@ -637,23 +639,32 @@ void v25_common_device::device_start()
m_p1_out.resolve_safe();
m_p2_out.resolve_safe();
- state_add( V25_PC, "PC", m_debugger_temp).callimport().callexport().formatstr("%05X");
- state_add( V25_IP, "IP", m_ip).formatstr("%04X");
- state_add( V25_SP, "SP", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_FLAGS, "F", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_AW, "AW", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_CW, "CW", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_DW, "DW", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_BW, "BW", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_BP, "BP", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_IX, "IX", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_IY, "IY", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_ES, "DS1", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_CS, "PS", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_SS, "SS", m_debugger_temp).callimport().callexport().formatstr("%04X");
- state_add( V25_DS, "DS0", m_debugger_temp).callimport().callexport().formatstr("%04X");
-
- state_add( V25_IDB, "IDB", m_IDB).mask(0xffe00).callimport();
+ state_add( V25_PC, "PC", m_ip).formatstr("%04X");
+ state_add<uint16_t>( V25_PSW, "PSW", [this]() { return CompressFlags(); }, [this](uint16_t data) { ExpandFlags(data); });
+
+ state_add<uint16_t>( V25_AW, "AW", [this]() { return Wreg(AW); }, [this](uint16_t data) { Wreg(AW) = data; });
+ state_add<uint16_t>( V25_CW, "CW", [this]() { return Wreg(CW); }, [this](uint16_t data) { Wreg(CW) = data; });
+ state_add<uint16_t>( V25_DW, "DW", [this]() { return Wreg(DW); }, [this](uint16_t data) { Wreg(DW) = data; });
+ state_add<uint16_t>( V25_BW, "BW", [this]() { return Wreg(BW); }, [this](uint16_t data) { Wreg(BW) = data; });
+ state_add<uint16_t>( V25_SP, "SP", [this]() { return Wreg(SP); }, [this](uint16_t data) { Wreg(SP) = data; });
+ state_add<uint16_t>( V25_BP, "BP", [this]() { return Wreg(BP); }, [this](uint16_t data) { Wreg(BP) = data; });
+ state_add<uint16_t>( V25_IX, "IX", [this]() { return Wreg(IX); }, [this](uint16_t data) { Wreg(IX) = data; });
+ state_add<uint16_t>( V25_IY, "IY", [this]() { return Wreg(IY); }, [this](uint16_t data) { Wreg(IY) = data; });
+ state_add<uint16_t>( V25_DS1, "DS1", [this]() { return Sreg(DS1); }, [this](uint16_t data) { Sreg(DS1) = data; });
+ state_add<uint16_t>( V25_PS, "PS", [this]() { return Sreg(PS); }, [this](uint16_t data) { Sreg(PS) = data; });
+ state_add<uint16_t>( V25_SS, "SS", [this]() { return Sreg(SS); }, [this](uint16_t data) { Sreg(SS) = data; });
+ state_add<uint16_t>( V25_DS0, "DS0", [this]() { return Sreg(DS0); }, [this](uint16_t data) { Sreg(DS0) = data; });
+
+ state_add<uint8_t>( V25_AL, "AL", [this]() { return Breg(AL); }, [this](uint8_t data) { Breg(AL) = data; }).noshow();
+ state_add<uint8_t>( V25_AH, "AH", [this]() { return Breg(AH); }, [this](uint8_t data) { Breg(AH) = data; }).noshow();
+ state_add<uint8_t>( V25_CL, "CL", [this]() { return Breg(CL); }, [this](uint8_t data) { Breg(CL) = data; }).noshow();
+ state_add<uint8_t>( V25_CH, "CH", [this]() { return Breg(CH); }, [this](uint8_t data) { Breg(CH) = data; }).noshow();
+ state_add<uint8_t>( V25_DL, "DL", [this]() { return Breg(DL); }, [this](uint8_t data) { Breg(DL) = data; }).noshow();
+ state_add<uint8_t>( V25_DH, "DH", [this]() { return Breg(DH); }, [this](uint8_t data) { Breg(DH) = data; }).noshow();
+ state_add<uint8_t>( V25_BL, "BL", [this]() { return Breg(BL); }, [this](uint8_t data) { Breg(BL) = data; }).noshow();
+ state_add<uint8_t>( V25_BH, "BH", [this]() { return Breg(BH); }, [this](uint8_t data) { Breg(BH) = data; }).noshow();
+
+ state_add( V25_IDB, "IDB", m_IDB).mask(0xffe00).callimport();
state_add( STATE_GENPC, "GENPC", m_debugger_temp).callexport().noshow();
state_add( STATE_GENPCBASE, "CURPC", m_debugger_temp).callexport().noshow();
@@ -694,7 +705,7 @@ void v25_common_device::state_import(const device_state_entry &entry)
{
switch (entry.index())
{
- case V25_PC:
+ case STATE_GENPC:
if( m_debugger_temp - (Sreg(PS)<<4) < 0x10000 )
{
m_ip = m_debugger_temp - (Sreg(PS)<<4);
@@ -704,58 +715,7 @@ void v25_common_device::state_import(const device_state_entry &entry)
Sreg(PS) = m_debugger_temp >> 4;
m_ip = m_debugger_temp & 0x0000f;
}
- break;
-
- case V25_SP:
- Wreg(SP) = m_debugger_temp;
- break;
-
- case V25_FLAGS:
- ExpandFlags(m_debugger_temp);
- break;
-
- case V25_AW:
- Wreg(AW) = m_debugger_temp;
- break;
-
- case V25_CW:
- Wreg(CW) = m_debugger_temp;
- break;
-
- case V25_DW:
- Wreg(DW) = m_debugger_temp;
- break;
-
- case V25_BW:
- Wreg(BW) = m_debugger_temp;
- break;
-
- case V25_BP:
- Wreg(BP) = m_debugger_temp;
- break;
-
- case V25_IX:
- Wreg(IX) = m_debugger_temp;
- break;
-
- case V25_IY:
- Wreg(IY) = m_debugger_temp;
- break;
-
- case V25_ES:
- Sreg(DS1) = m_debugger_temp;
- break;
-
- case V25_CS:
- Sreg(PS) = m_debugger_temp;
- break;
-
- case V25_SS:
- Sreg(SS) = m_debugger_temp;
- break;
-
- case V25_DS:
- Sreg(DS0) = m_debugger_temp;
+ m_prev_ip = m_ip;
break;
case V25_IDB:
@@ -770,65 +730,15 @@ void v25_common_device::state_export(const device_state_entry &entry)
switch (entry.index())
{
case STATE_GENPC:
- case STATE_GENPCBASE:
- case V25_PC:
m_debugger_temp = (Sreg(PS)<<4) + m_ip;
break;
- case STATE_GENSP:
- m_debugger_temp = (Sreg(SS)<<4) + Wreg(SP);
- break;
-
- case V25_SP:
- m_debugger_temp = Wreg(SP);
- break;
-
- case V25_FLAGS:
- m_debugger_temp = CompressFlags();
- break;
-
- case V25_AW:
- m_debugger_temp = Wreg(AW);
- break;
-
- case V25_CW:
- m_debugger_temp = Wreg(CW);
- break;
-
- case V25_DW:
- m_debugger_temp = Wreg(DW);
- break;
-
- case V25_BW:
- m_debugger_temp = Wreg(BW);
- break;
-
- case V25_BP:
- m_debugger_temp = Wreg(BP);
- break;
-
- case V25_IX:
- m_debugger_temp = Wreg(IX);
- break;
-
- case V25_IY:
- m_debugger_temp = Wreg(IY);
- break;
-
- case V25_ES:
- m_debugger_temp = Sreg(DS1);
- break;
-
- case V25_CS:
- m_debugger_temp = Sreg(PS);
- break;
-
- case V25_SS:
- m_debugger_temp = Sreg(SS);
+ case STATE_GENPCBASE:
+ m_debugger_temp = (Sreg(PS)<<4) + m_prev_ip;
break;
- case V25_DS:
- m_debugger_temp = Sreg(DS0);
+ case STATE_GENSP:
+ m_debugger_temp = (Sreg(SS)<<4) + Wreg(SP);
break;
}
}
@@ -875,6 +785,7 @@ void v25_common_device::execute_run()
while(m_icount>0) {
/* Dispatch IRQ */
+ m_prev_ip = m_ip;
if (m_no_interrupt==0 && (m_pending_irq & m_unmasked_irq))
{
if (m_pending_irq & NMI_IRQ)
diff --git a/src/devices/cpu/nec/v25.h b/src/devices/cpu/nec/v25.h
index 6669006886d..8d37752c85d 100644
--- a/src/devices/cpu/nec/v25.h
+++ b/src/devices/cpu/nec/v25.h
@@ -16,8 +16,10 @@
enum
{
V25_PC=0,
- V25_IP, V25_AW, V25_CW, V25_DW, V25_BW, V25_SP, V25_BP, V25_IX, V25_IY,
- V25_FLAGS, V25_ES, V25_CS, V25_SS, V25_DS,
+ V25_AW, V25_CW, V25_DW, V25_BW, V25_SP, V25_BP, V25_IX, V25_IY,
+ V25_DS1, V25_PS, V25_SS, V25_DS0,
+ V25_AL, V25_AH, V25_CL, V25_CH, V25_DL, V25_DH, V25_BL, V25_BH,
+ V25_PSW,
V25_IDB,
V25_PENDING
};
@@ -80,6 +82,7 @@ private:
required_shared_ptr<uint16_t> m_internal_ram;
uint16_t m_ip;
+ uint16_t m_prev_ip;
/* PSW flags */
int32_t m_SignVal;