summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/nec/v25.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/nec/v25.cpp')
-rw-r--r--src/devices/cpu/nec/v25.cpp163
1 files changed, 37 insertions, 126 deletions
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)