twoapple-reboot/test/d6502/test_decimal.d

30 lines
593 B
D
Raw Normal View History

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();
auto cpu = makeCpu!T();
2012-03-25 08:25:41 +00:00
setPC(cpu, 0x8000);
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-17 11:01:58 +00:00
writeln("Testing decimal mode, 6502");
testDecimalMode!(CPU!("6502"))();
2012-04-17 11:01:58 +00:00
writeln("Testing decimal mode, 65C02");
testDecimalMode!(CPU!("65C02"))();
}