changed skip-lbi-testing

This commit is contained in:
hap 2015-05-02 18:26:19 +02:00
parent 5b0e6aae92
commit 1e189ee52e
3 changed files with 48 additions and 98 deletions

View File

@ -51,7 +51,6 @@
TODO: TODO:
- remove LBIOps
- remove InstLen - remove InstLen
- run interrupt test suite - run interrupt test suite
- run production test suite - run production test suite
@ -198,9 +197,6 @@ cop400_cpu_device::cop400_cpu_device(const machine_config &mconfig, device_type
/* initialize instruction length array */ /* initialize instruction length array */
for (i=0; i<256; i++) m_InstLen[i]=1; for (i=0; i<256; i++) m_InstLen[i]=1;
/* initialize LBI opcode array */
for (i=0x00; i<0x100; i++) m_LBIops[i] = 0;
for (i=0; i<256; i++) m_LBIops33[i] = 0;
switch (featuremask) switch (featuremask)
{ {
@ -210,11 +206,6 @@ cop400_cpu_device::cop400_cpu_device(const machine_config &mconfig, device_type
/* initialize instruction length array */ /* initialize instruction length array */
m_InstLen[0x60] = m_InstLen[0x61] = m_InstLen[0x68] = m_InstLen[0x60] = m_InstLen[0x61] = m_InstLen[0x68] =
m_InstLen[0x69] = m_InstLen[0x33] = m_InstLen[0x23] = 2; m_InstLen[0x69] = m_InstLen[0x33] = m_InstLen[0x23] = 2;
/* initialize LBI opcode array */
for (i=0x08; i<0x10; i++) m_LBIops[i] = 1;
for (i=0x18; i<0x20; i++) m_LBIops[i] = 1;
for (i=0x28; i<0x30; i++) m_LBIops[i] = 1;
for (i=0x38; i<0x40; i++) m_LBIops[i] = 1;
break; break;
case COP420_FEATURE: case COP420_FEATURE:
@ -224,12 +215,6 @@ cop400_cpu_device::cop400_cpu_device(const machine_config &mconfig, device_type
m_InstLen[0x60] = m_InstLen[0x61] = m_InstLen[0x62] = m_InstLen[0x63] = m_InstLen[0x60] = m_InstLen[0x61] = m_InstLen[0x62] = m_InstLen[0x63] =
m_InstLen[0x68] = m_InstLen[0x69] = m_InstLen[0x6a] = m_InstLen[0x6b] = m_InstLen[0x68] = m_InstLen[0x69] = m_InstLen[0x6a] = m_InstLen[0x6b] =
m_InstLen[0x33] = m_InstLen[0x23] = 2; m_InstLen[0x33] = m_InstLen[0x23] = 2;
/* initialize LBI opcode array */
for (i=0x08; i<0x10; i++) m_LBIops[i] = 1;
for (i=0x18; i<0x20; i++) m_LBIops[i] = 1;
for (i=0x28; i<0x30; i++) m_LBIops[i] = 1;
for (i=0x38; i<0x40; i++) m_LBIops[i] = 1;
for (i=0x80; i<0xc0; i++) m_LBIops33[i] = 1;
break; break;
case COP444_FEATURE: case COP444_FEATURE:
@ -239,13 +224,6 @@ cop400_cpu_device::cop400_cpu_device(const machine_config &mconfig, device_type
m_InstLen[0x60] = m_InstLen[0x61] = m_InstLen[0x62] = m_InstLen[0x63] = m_InstLen[0x60] = m_InstLen[0x61] = m_InstLen[0x62] = m_InstLen[0x63] =
m_InstLen[0x68] = m_InstLen[0x69] = m_InstLen[0x6a] = m_InstLen[0x6b] = m_InstLen[0x68] = m_InstLen[0x69] = m_InstLen[0x6a] = m_InstLen[0x6b] =
m_InstLen[0x33] = m_InstLen[0x23] = 2; m_InstLen[0x33] = m_InstLen[0x23] = 2;
/* initialize LBI opcode array */
for (i=0x00; i<0x100; i++) m_LBIops[i] = 0;
for (i=0x08; i<0x10; i++) m_LBIops[i] = 1;
for (i=0x18; i<0x20; i++) m_LBIops[i] = 1;
for (i=0x28; i<0x30; i++) m_LBIops[i] = 1;
for (i=0x38; i<0x40; i++) m_LBIops[i] = 1;
for (i=0x80; i<0xc0; i++) m_LBIops33[i] = 1;
break; break;
default: default:
@ -1025,7 +1003,6 @@ void cop400_cpu_device::device_start()
save_item(NAME(m_skl)); save_item(NAME(m_skl));
save_item(NAME(m_t)); save_item(NAME(m_t));
save_item(NAME(m_skip)); save_item(NAME(m_skip));
save_item(NAME(m_skip_lbi));
save_item(NAME(m_skt_latch)); save_item(NAME(m_skt_latch));
save_item(NAME(m_si)); save_item(NAME(m_si));
save_item(NAME(m_last_skip)); save_item(NAME(m_last_skip));
@ -1093,7 +1070,6 @@ void cop400_cpu_device::device_start()
m_il = 0; m_il = 0;
m_in[0] = m_in[1] = m_in[2] = m_in[3] = 0; m_in[0] = m_in[1] = m_in[2] = m_in[3] = 0;
m_si = 0; m_si = 0;
m_skip_lbi = 0;
m_last_skip = 0; m_last_skip = 0;
m_microbus_int = 0; m_microbus_int = 0;
m_skip = 0; m_skip = 0;
@ -1118,6 +1094,7 @@ void cop400_cpu_device::device_reset()
T = 0; T = 0;
m_skt_latch = 1; m_skt_latch = 1;
m_last_opcode_function = INST(nop);
m_halt = 0; m_halt = 0;
m_idle = 0; m_idle = 0;
} }
@ -1128,8 +1105,6 @@ void cop400_cpu_device::device_reset()
void cop400_cpu_device::execute_run() void cop400_cpu_device::execute_run()
{ {
UINT8 opcode;
do do
{ {
m_prevpc = PC; m_prevpc = PC;
@ -1147,87 +1122,61 @@ void cop400_cpu_device::execute_run()
continue; continue;
} }
opcode = ROM(PC); UINT8 opcode = ROM(PC);
if (m_skip_lbi) int inst_cycles = m_opcode_map[opcode].cycles;
PC++;
(this->*(m_opcode_map[opcode].function))(opcode);
m_last_opcode_function = m_opcode_map[opcode].function;
m_icount -= inst_cycles;
// check for interrupt
if (BIT(EN, 1) && BIT(IL, 1))
{ {
int is_lbi = 0; cop400_opcode_func function = m_opcode_map[ROM(PC)].function;
if (opcode == 0x33) // all successive transfer of control instructions and successive LBIs have been completed
if ((function != INST(jp)) && (function != INST(jmp)) && (function != INST(jsr)) && !(m_last_opcode_function == INST(lbi) && function == INST(lbi)))
{ {
is_lbi = m_LBIops33[ROM(PC+1)]; // store skip logic
} m_last_skip = m_skip;
else m_skip = 0;
{
is_lbi = m_LBIops[opcode]; // push next PC
PUSH(PC);
// jump to interrupt service routine
PC = 0x0ff;
// disable interrupt
EN &= ~0x02;
} }
if (is_lbi) IL &= ~2;
{
m_icount -= m_opcode_map[opcode].cycles;
PC += m_InstLen[opcode];
}
else
{
m_skip_lbi = 0;
}
} }
if (!m_skip_lbi) // skip next instruction?
if (m_skip)
{ {
int inst_cycles = m_opcode_map[opcode].cycles; cop400_opcode_func function = m_opcode_map[ROM(PC)].function;
PC++; opcode = ROM(PC);
(this->*(m_opcode_map[opcode].function))(opcode); if ((function == INST(lqid)) || (function == INST(jid)))
m_icount -= inst_cycles;
// check for interrupt
if (BIT(EN, 1) && BIT(IL, 1))
{ {
cop400_opcode_func function = m_opcode_map[ROM(PC)].function; m_icount -= 1;
}
if ((function != INST(jp)) && (function != INST(jmp)) && (function != INST(jsr))) else
{ {
// store skip logic m_icount -= m_opcode_map[opcode].cycles;
m_last_skip = m_skip;
m_skip = 0;
// push next PC
PUSH(PC);
// jump to interrupt service routine
PC = 0x0ff;
// disable interrupt
EN &= ~0x02;
}
IL &= ~2;
} }
// skip next instruction? PC += m_InstLen[opcode];
if (m_skip) m_skip = 0;
{
cop400_opcode_func function = m_opcode_map[ROM(PC)].function;
opcode = ROM(PC);
if ((function == INST(lqid)) || (function == INST(jid)))
{
m_icount -= 1;
}
else
{
m_icount -= m_opcode_map[opcode].cycles;
}
PC += m_InstLen[opcode];
m_skip = 0;
}
} }
} while (m_icount > 0); } while (m_icount > 0);
} }

View File

@ -239,7 +239,6 @@ protected:
/* skipping logic */ /* skipping logic */
int m_skip; /* skip next instruction */ int m_skip; /* skip next instruction */
int m_skip_lbi; /* skip until next non-LBI instruction */
int m_last_skip; /* last value of skip */ int m_last_skip; /* last value of skip */
int m_halt; /* halt mode */ int m_halt; /* halt mode */
int m_idle; /* idle mode */ int m_idle; /* idle mode */
@ -249,8 +248,6 @@ protected:
/* execution logic */ /* execution logic */
int m_InstLen[256]; /* instruction length in bytes */ int m_InstLen[256]; /* instruction length in bytes */
int m_LBIops[256];
int m_LBIops33[256];
int m_icount; /* instruction counter */ int m_icount; /* instruction counter */
/* timers */ /* timers */
@ -268,6 +265,7 @@ protected:
}; };
const cop400_opcode_map *m_opcode_map; const cop400_opcode_map *m_opcode_map;
cop400_opcode_func m_last_opcode_function;
static const cop400_opcode_map COP410_OPCODE_23_MAP[]; static const cop400_opcode_map COP410_OPCODE_23_MAP[];
static const cop400_opcode_map COP410_OPCODE_33_MAP[]; static const cop400_opcode_map COP410_OPCODE_33_MAP[];

View File

@ -913,6 +913,11 @@ INSTRUCTION( cba )
INSTRUCTION( lbi ) INSTRUCTION( lbi )
{ {
if (m_last_opcode_function == INST(lbi))
{
return;
}
if (opcode & 0x80) if (opcode & 0x80)
{ {
B = opcode & 0x7f; B = opcode & 0x7f;
@ -921,8 +926,6 @@ INSTRUCTION( lbi )
{ {
B = (opcode & 0x30) | (((opcode & 0x0f) + 1) & 0x0f); B = (opcode & 0x30) | (((opcode & 0x0f) + 1) & 0x0f);
} }
m_skip_lbi = 1;
} }
/* /*