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