This commit is contained in:
edmccard 2012-04-14 02:43:03 -04:00
parent a572ea9146
commit cf369d4d2b
2 changed files with 17 additions and 8 deletions

View File

@ -93,9 +93,6 @@ else
ubyte data;
}
// TODO: other methods for stopping cpu
bool keepRunning;
this(MEM memory, CLK clock)
{
version(RunTest) {}
@ -128,10 +125,11 @@ else
(N & 0x80);
}
bool keepRunning;
final void run(bool continuous)
{
keepRunning = continuous;
// TODO debugging info?
ubyte opcode;
static if (!opArray)
{
@ -139,7 +137,8 @@ else
ushort address, base;
ubyte data;
}
do {
do
{
version(Cumulative)
{
static if (!opArray) cycles = 1;

View File

@ -218,8 +218,9 @@ version(Benchmark)
{
auto runner = new BreakRunner(mem);
auto cpu = new T(runner, runner);
runner.keepRunning = &cpu.keepRunning;
setPC(cpu, 0x8000);
try { cpu.run(true); } catch (StopException e) {}
cpu.run(true);
}
else
{
@ -243,6 +244,7 @@ version(Benchmark)
final class BreakRunner
{
TestMemory* mem;
bool* keepRunning;
this(ref TestMemory mem)
{
@ -251,8 +253,16 @@ version(Benchmark)
final ubyte read(ushort addr)
{
if (addr == 0xFFFE) throw new StopException("BRK");
return mem.read(addr);
if (addr == 0xfffe)
{
*keepRunning = false;
return 0x00;
}
else if (addr == 0xffff)
{
return 0x80;
}
else return mem.read(addr);
}
final void write(ushort addr, ubyte val)