mirror of
https://github.com/edmccard/twoapple-reboot.git
synced 2025-01-27 18:37:51 +00:00
WIP
This commit is contained in:
parent
a572ea9146
commit
cf369d4d2b
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user