Split ADSP2100 execution loop between debug/non-debug.

This commit is contained in:
Aaron Giles 2008-06-29 16:45:55 +00:00
parent b8ea760a2b
commit df4f70a0a7

View File

@ -97,6 +97,7 @@
#include "debugger.h"
#include "adsp2100.h"
#include <stddef.h>
/***************************************************************************
@ -239,7 +240,6 @@ typedef struct
UINT16 ifc;
UINT8 irq_state[9];
UINT8 irq_latch[9];
INT32 interrupt_cycles;
int (*irq_callback)(int irqline);
/* other callbacks */
@ -282,6 +282,7 @@ static UINT32 pcbucket[0x4000];
static int create_tables(void);
static void check_irqs(void);
static void execute_one(UINT32 op);
/***************************************************************************
@ -726,7 +727,6 @@ static void adsp2100_init(int index, int clock, const void *config, int (*irqcal
state_save_register_item("adsp2100", index, adsp2100.ifc);
state_save_register_item_array("adsp2100", index, adsp2100.irq_state);
state_save_register_item_array("adsp2100", index, adsp2100.irq_latch);
state_save_register_item("adsp2100", index, adsp2100.interrupt_cycles);
}
@ -797,7 +797,6 @@ static void adsp2100_reset(void)
adsp2100.imask = 0;
for (irq = 0; irq < 8; irq++)
adsp2100.irq_state[irq] = adsp2100.irq_latch[irq] = CLEAR_LINE;
adsp2100.interrupt_cycles = 0;
}
@ -938,15 +937,51 @@ static int adsp2100_execute(int cycles)
/* count cycles and interrupt cycles */
adsp2100_icount = cycles;
adsp2100_icount -= adsp2100.interrupt_cycles;
adsp2100.interrupt_cycles = 0;
CHANGEPC();
/* core execution loop */
/* no debugger */
if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
{
do
{
UINT32 op, temp;
UINT32 op;
/* debugging */
adsp2100.ppc = adsp2100.pc; /* copy PC to previous PC */
op = ROPCODE();
/* advance to the next instruction */
if (adsp2100.pc != adsp2100.loop)
adsp2100.pc++;
/* handle looping */
else
{
/* condition not met, keep looping */
if (CONDITION(adsp2100.loop_condition))
adsp2100.pc = pc_stack_top();
/* condition met; pop the PC and loop stacks and fall through */
else
{
loop_stack_pop();
pc_stack_pop_val();
adsp2100.pc++;
}
}
execute_one(op);
adsp2100_icount--;
} while (adsp2100_icount > 0);
}
/* debugger enabled */
else
{
do
{
UINT32 op;
/* debugging */
adsp2100.ppc = adsp2100.pc; /* copy PC to previous PC */
@ -979,6 +1014,19 @@ static int adsp2100_execute(int cycles)
}
}
execute_one(op);
adsp2100_icount--;
} while (adsp2100_icount > 0);
}
return cycles - adsp2100_icount;
}
static void execute_one(UINT32 op)
{
UINT32 temp;
/* parse the instruction */
switch (op >> 16)
{
@ -1673,15 +1721,6 @@ static int adsp2100_execute(int cycles)
adsp2100.core.my1.u = pgm_read_dag2(op >> 4);
break;
}
adsp2100_icount--;
} while (adsp2100_icount > 0);
adsp2100_icount -= adsp2100.interrupt_cycles;
adsp2100.interrupt_cycles = 0;
return cycles - adsp2100_icount;
}