2012-03-23 12:14:15 -04:00
|
|
|
import std.stdio;
|
2012-03-31 15:44:23 -04:00
|
|
|
|
2012-04-14 11:26:27 -04:00
|
|
|
import test.d6502.base, test.d6502.cpu;
|
2012-03-23 12:14:15 -04:00
|
|
|
|
|
|
|
|
|
|
|
void testDecimalMode(T)()
|
|
|
|
if (isCpu!T)
|
|
|
|
{
|
2012-04-17 07:01:58 -04:00
|
|
|
auto mem = decimal_test_mem!T();
|
2012-04-14 03:07:02 -04:00
|
|
|
auto cpu = makeCpu!T();
|
2012-03-25 04:25:41 -04:00
|
|
|
setPC(cpu, 0x8000);
|
2012-04-13 21:35:40 -04:00
|
|
|
connectMem(cpu, mem);
|
2012-03-23 12:14:15 -04:00
|
|
|
runUntilBRK(cpu);
|
2012-04-17 07:01:58 -04:00
|
|
|
|
2012-03-23 12:14:15 -04:00
|
|
|
if (mem[0x8003])
|
2012-03-25 04:25:41 -04:00
|
|
|
{
|
|
|
|
// TODO: check data block to find out what failed exactly
|
2012-03-23 12:14:15 -04:00
|
|
|
throw new TestException("failed decimal mode " ~ T.stringof);
|
2012-03-25 04:25:41 -04:00
|
|
|
}
|
2012-03-23 12:14:15 -04:00
|
|
|
}
|
|
|
|
|
2012-04-17 07:01:58 -04:00
|
|
|
void main()
|
2012-04-08 21:06:38 -04:00
|
|
|
{
|
2012-04-17 07:01:58 -04:00
|
|
|
writeln("Testing decimal mode, 6502");
|
|
|
|
testDecimalMode!(CPU!("6502"))();
|
2012-04-08 21:06:38 -04:00
|
|
|
|
2012-04-17 07:01:58 -04:00
|
|
|
writeln("Testing decimal mode, 65C02");
|
|
|
|
testDecimalMode!(CPU!("65C02"))();
|
2012-04-08 21:06:38 -04:00
|
|
|
}
|