added boilerplate comments, sync pc/curpc, add enum for state. (nw)

This commit is contained in:
smf- 2016-10-28 15:39:41 +01:00
parent f3aa650a3c
commit 6fe9924c50
4 changed files with 57 additions and 24 deletions

View File

@ -63,33 +63,41 @@ void arc_device::device_start()
m_program = &space(AS_PROGRAM);
state_add( 0, "PC", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add(STATE_GENPC, "GENPC", m_debugger_temp).callexport().noshow();
state_add(STATE_GENPCBASE, "CURPC", m_debugger_temp).callexport().noshow();
state_add(ARC_PC, "PC", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add(STATE_GENPCBASE, "CURPC", m_debugger_temp).callimport().callexport().noshow();
m_icountptr = &m_icount;
}
//-------------------------------------------------
// state_export - export state from the device,
// to a known location where it can be read
//-------------------------------------------------
void arc_device::state_export(const device_state_entry &entry)
{
switch (entry.index())
{
case 0:
m_debugger_temp = m_pc << 2;
break;
case STATE_GENPC:
case ARC_PC:
case STATE_GENPCBASE:
m_debugger_temp = m_pc << 2;
break;
}
}
//-------------------------------------------------
// state_import - import state into the device,
// after it has been set
//-------------------------------------------------
void arc_device::state_import(const device_state_entry &entry)
{
switch (entry.index())
{
case 0:
case ARC_PC:
case STATE_GENPCBASE:
m_pc = (m_debugger_temp & 0xfffffffc) >> 2;
break;
}

View File

@ -12,6 +12,11 @@
#ifndef __ARC_H__
#define __ARC_H__
enum
{
ARC_PC = STATE_GENPC
};
class arc_device : public cpu_device
{
public:

View File

@ -88,14 +88,13 @@ void arcompact_device::device_start()
m_program = &space(AS_PROGRAM);
m_io = &space(AS_IO);
state_add( 0, "PC", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add( ARCOMPACT_PC, "PC", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add( 0x10, "STATUS32", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add( 0x11, "LP_START", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add( 0x12, "LP_END", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add( ARCOMPACT_STATUS32, "STATUS32", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add( ARCOMPACT_LP_START, "LP_START", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add( ARCOMPACT_LP_END, "LP_END", m_debugger_temp).callimport().callexport().formatstr("%08X");
state_add(STATE_GENPC, "GENPC", m_debugger_temp).callexport().noshow();
state_add(STATE_GENPCBASE, "CURPC", m_debugger_temp).callexport().noshow();
state_add(STATE_GENPCBASE, "CURPC", m_debugger_temp).callimport().callexport().noshow();
for (int i = 0x100; i < 0x140; i++)
{
@ -106,25 +105,30 @@ void arcompact_device::device_start()
m_icountptr = &m_icount;
}
//-------------------------------------------------
// state_export - export state from the device,
// to a known location where it can be read
//-------------------------------------------------
void arcompact_device::state_export(const device_state_entry &entry)
{
int index = entry.index();
switch (index)
{
case STATE_GENPC:
case ARCOMPACT_PC:
case STATE_GENPCBASE:
case 0:
m_debugger_temp = m_pc;
break;
case 0x10:
case ARCOMPACT_STATUS32:
m_debugger_temp = m_status32;
break;
case 0x11:
case ARCOMPACT_LP_START:
m_debugger_temp = m_LP_START;
break;
case 0x12:
case ARCOMPACT_LP_END:
m_debugger_temp = m_LP_END;
break;
@ -138,23 +142,30 @@ void arcompact_device::state_export(const device_state_entry &entry)
}
}
//-------------------------------------------------
// state_import - import state into the device,
// after it has been set
//-------------------------------------------------
void arcompact_device::state_import(const device_state_entry &entry)
{
int index = entry.index();
switch (index)
{
case 0:
case ARCOMPACT_PC:
case STATE_GENPCBASE:
m_pc = (m_debugger_temp & 0xfffffffe);
break;
case 0x10:
case ARCOMPACT_STATUS32:
m_status32 = m_debugger_temp;
break;
case 0x11:
case ARCOMPACT_LP_START:
m_LP_START = m_debugger_temp;
break;
case 0x12:
case ARCOMPACT_LP_END:
m_LP_END = m_debugger_temp;
break;

View File

@ -11,6 +11,15 @@
#ifndef __ARCOMPACT_H__
#define __ARCOMPACT_H__
enum
{
ARCOMPACT_PC = STATE_GENPC,
ARCOMPACT_STATUS32 = 0x10,
ARCOMPACT_LP_START,
ARCOMPACT_LP_END
};
#define ARCOMPACT_RETTYPE uint32_t
#define OPS_32 uint32_t op
#define OPS_16 uint16_t op