mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Don't change cs if new pc/curpc is within the current segment on i86/i186, fix i286 pc/curpc in protected mode. (nw)
This commit is contained in:
parent
9708183b46
commit
63bb277ce4
@ -247,7 +247,7 @@ void i80286_cpu_device::device_start()
|
||||
state_add( I286_ES_LIMIT, "ESLIMIT", m_limit[ES]).formatstr("%04X");
|
||||
state_add( I286_ES_FLAGS, "ESFLAGS", m_rights[ES]).formatstr("%02X");
|
||||
state_add( I286_CS, "CS", m_sregs[CS] ).callimport().formatstr("%04X");
|
||||
state_add( I286_CS_BASE, "CSBASE", m_base[CS]).formatstr("%06X");
|
||||
state_add( I286_CS_BASE, "CSBASE", m_base[CS]).callimport().formatstr("%06X");
|
||||
state_add( I286_CS_LIMIT, "CSLIMIT", m_limit[CS]).formatstr("%04X");
|
||||
state_add( I286_CS_FLAGS, "CSFLAGS", m_rights[CS]).formatstr("%02X");
|
||||
state_add( I286_SS, "SS", m_sregs[SS] ).formatstr("%04X");
|
||||
@ -281,6 +281,45 @@ void i80286_cpu_device::device_start()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// state_import - import state into the device,
|
||||
// after it has been set
|
||||
//-------------------------------------------------
|
||||
|
||||
void i80286_cpu_device::state_import(const device_state_entry &entry)
|
||||
{
|
||||
switch (entry.index())
|
||||
{
|
||||
case I286_IP:
|
||||
case I286_CS_BASE:
|
||||
m_pc = m_base[CS] + m_ip;
|
||||
break;
|
||||
|
||||
case I286_CS:
|
||||
// TODO: should this call data_descriptor to update the current segment?
|
||||
break;
|
||||
|
||||
case STATE_GENPC:
|
||||
case STATE_GENPCBASE:
|
||||
if (m_pc - m_base[CS] > m_limit[CS])
|
||||
{
|
||||
// TODO: should this call data_descriptor instead of ignoring jumps outside the current segment?
|
||||
if (PM)
|
||||
{
|
||||
m_pc = m_base[CS] + m_ip;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sregs[CS] = m_pc >> 4;
|
||||
m_base[CS] = m_sregs[CS] << 4;
|
||||
}
|
||||
}
|
||||
m_ip = m_pc - m_base[CS];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// state_string_export - export state as a string
|
||||
// for the debugger
|
||||
|
@ -79,6 +79,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
// device_state_interface overrides
|
||||
virtual void state_import(const device_state_entry &entry) override;
|
||||
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
|
||||
|
||||
virtual uint32_t execute_input_lines() const override { return 1; }
|
||||
|
@ -320,6 +320,7 @@ i8086_common_cpu_device::i8086_common_cpu_device(const machine_config &mconfig,
|
||||
memset(m_sregs, 0x00, sizeof(m_sregs));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// state_import - import state into the device,
|
||||
// after it has been set
|
||||
@ -336,8 +337,9 @@ void i8086_common_cpu_device::state_import(const device_state_entry &entry)
|
||||
|
||||
case STATE_GENPC:
|
||||
case STATE_GENPCBASE:
|
||||
m_sregs[CS] = m_pc >> 4;
|
||||
m_ip = m_pc & 0xf;
|
||||
if (m_pc - (m_sregs[CS] << 4) > 0xffff)
|
||||
m_sregs[CS] = m_pc >> 4;
|
||||
m_ip = m_pc - (m_sregs[CS] << 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user