2025-05-18 22:59:19 +02:00
|
|
|
package miggy.cpupoet;
|
|
|
|
|
|
|
|
|
|
import junit.framework.TestCase;
|
|
|
|
|
|
|
|
|
|
public class InstructionTests extends TestCase {
|
|
|
|
|
static {
|
|
|
|
|
MacroPLA.decode(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testBCD() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("ABCD");
|
|
|
|
|
test.executeBinTest("NBCD");
|
|
|
|
|
test.executeBinTest("SBCD");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testADD() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("ADD.b");
|
|
|
|
|
test.executeBinTest("ADD.w");
|
|
|
|
|
test.executeBinTest("ADD.l");
|
|
|
|
|
test.executeBinTest("ADDA.w");
|
|
|
|
|
test.executeBinTest("ADDA.l");
|
|
|
|
|
test.executeBinTest("ADDX.b");
|
|
|
|
|
test.executeBinTest("ADDX.w");
|
|
|
|
|
test.executeBinTest("ADDX.l");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testAND() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("AND.b");
|
|
|
|
|
test.executeBinTest("AND.w");
|
|
|
|
|
test.executeBinTest("AND.l");
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("ANDItoCCR");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testOR() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("OR.b");
|
|
|
|
|
test.executeBinTest("OR.w");
|
|
|
|
|
test.executeBinTest("OR.l");
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("ORItoCCR");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testEOR() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("EOR.b");
|
|
|
|
|
test.executeBinTest("EOR.w");
|
|
|
|
|
test.executeBinTest("EOR.l");
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("NOT.b");
|
|
|
|
|
test.executeBinTest("NOT.w");
|
|
|
|
|
test.executeBinTest("NOT.l");
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("EORItoCCR");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testBIT() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("BCHG");
|
|
|
|
|
test.executeBinTest("BCLR");
|
|
|
|
|
test.executeBinTest("BSET");
|
|
|
|
|
test.executeBinTest("BTST");
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-19 12:16:18 +02:00
|
|
|
public void testShift() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("LSL.b");
|
|
|
|
|
test.executeBinTest("LSL.w");
|
|
|
|
|
test.executeBinTest("LSL.l");
|
|
|
|
|
test.executeBinTest("LSR.b");
|
|
|
|
|
test.executeBinTest("LSR.w");
|
|
|
|
|
test.executeBinTest("LSR.l");
|
|
|
|
|
test.executeBinTest("ROL.b");
|
|
|
|
|
test.executeBinTest("ROL.w");
|
|
|
|
|
test.executeBinTest("ROL.l");
|
|
|
|
|
test.executeBinTest("ROR.b");
|
|
|
|
|
test.executeBinTest("ROR.w");
|
|
|
|
|
test.executeBinTest("ROR.l");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testBcc() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
2025-05-19 14:14:07 +02:00
|
|
|
test.executeBinTest("Bcc");
|
|
|
|
|
test.executeBinTest("BSR");
|
2025-05-19 12:16:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testDBcc() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("DBcc");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testMisc() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
2025-05-19 14:14:07 +02:00
|
|
|
test.executeBinTest("CHK");
|
2025-05-19 12:16:18 +02:00
|
|
|
test.executeBinTest("NOP");
|
|
|
|
|
test.executeBinTest("EXG");
|
|
|
|
|
test.executeBinTest("SWAP");
|
|
|
|
|
test.executeBinTest("EXT.w");
|
|
|
|
|
test.executeBinTest("EXT.l");
|
|
|
|
|
test.executeBinTest("LEA");
|
|
|
|
|
test.executeBinTest("PEA");
|
|
|
|
|
test.executeBinTest("RTS");
|
|
|
|
|
test.executeBinTest("RTR");
|
|
|
|
|
test.executeBinTest("LINK");
|
|
|
|
|
test.executeBinTest("UNLINK");
|
|
|
|
|
test.executeBinTest("Scc");
|
|
|
|
|
test.executeBinTest("TST.b");
|
|
|
|
|
test.executeBinTest("TST.w");
|
|
|
|
|
test.executeBinTest("TST.l");
|
|
|
|
|
test.executeBinTest("CLR.b");
|
|
|
|
|
test.executeBinTest("CLR.w");
|
|
|
|
|
test.executeBinTest("CLR.l");
|
|
|
|
|
test.executeBinTest("TRAP");
|
|
|
|
|
test.executeBinTest("TRAPV");
|
2025-05-19 14:33:03 +02:00
|
|
|
test.executeBinTest("RESET");
|
2025-05-19 12:16:18 +02:00
|
|
|
}
|
2025-05-18 22:59:19 +02:00
|
|
|
|
|
|
|
|
public void testJMP() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("JMP");
|
|
|
|
|
test.executeBinTest("JSR");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testSUB() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("SUB.b");
|
|
|
|
|
test.executeBinTest("SUB.w");
|
|
|
|
|
test.executeBinTest("SUB.l");
|
|
|
|
|
test.executeBinTest("SUBA.w");
|
|
|
|
|
test.executeBinTest("SUBA.l");
|
|
|
|
|
test.executeBinTest("CMP.b");
|
|
|
|
|
test.executeBinTest("CMP.w");
|
|
|
|
|
test.executeBinTest("CMP.l");
|
|
|
|
|
test.executeBinTest("CMPA.w");
|
|
|
|
|
test.executeBinTest("CMPA.l");
|
|
|
|
|
test.executeBinTest("SUBX.b");
|
|
|
|
|
test.executeBinTest("SUBX.w");
|
|
|
|
|
test.executeBinTest("SUBX.l");
|
|
|
|
|
test.executeBinTest("NEG.b");
|
2025-05-19 00:06:00 +02:00
|
|
|
test.executeBinTest("NEG.w");
|
2025-05-18 22:59:19 +02:00
|
|
|
test.executeBinTest("NEG.l");
|
|
|
|
|
test.executeBinTest("NEGX.b");
|
|
|
|
|
test.executeBinTest("NEGX.w");
|
|
|
|
|
test.executeBinTest("NEGX.l");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void testMOVE() {
|
|
|
|
|
CoreTest test = new CoreTest(0xffffff + 1, true);
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("MOVE.b");
|
|
|
|
|
/*
|
2025-05-19 12:16:18 +02:00
|
|
|
* 295 is not compatible (post incremented value is written by design) 342 is
|
|
|
|
|
* not compatible (post incremented value is written by design) 494 is not
|
|
|
|
|
* compatible (post incremented value is written by design) 994 is not
|
|
|
|
|
* compatible (pre decremented value is written by design) 1225 is not
|
|
|
|
|
* compatible (pre decremented value is written by design) 1846 is not
|
|
|
|
|
* compatible (post incremented value is written by design)
|
2025-05-18 22:59:19 +02:00
|
|
|
*/
|
|
|
|
|
test.executeBinTest("MOVE.w", 295, 342, 494, 994, 1225, 1846);
|
|
|
|
|
/*
|
2025-05-19 12:16:18 +02:00
|
|
|
* 217 is not compatible (post incremented value is written by design) 502 is
|
|
|
|
|
* not compatible (post incremented value is written by design) 1152 is not
|
|
|
|
|
* compatible (post incremented value is written by design) 1691 is not
|
|
|
|
|
* compatible (post incremented value is written by design) 1830 is not
|
|
|
|
|
* compatible (pre decremented value is written by design) 2057 is not
|
|
|
|
|
* compatible (post incremented value is written by design) 2135 is not
|
|
|
|
|
* compatible (post incremented value is written by design)
|
2025-05-18 22:59:19 +02:00
|
|
|
*/
|
|
|
|
|
test.executeBinTest("MOVE.l", 217, 502, 1152, 1691, 1830, 2057, 2135);
|
|
|
|
|
test.executeBinTest("MOVE.q");
|
2025-05-19 12:16:18 +02:00
|
|
|
|
2025-05-18 22:59:19 +02:00
|
|
|
test.executeBinTest("MOVEP.w");
|
|
|
|
|
test.executeBinTest("MOVEP.l");
|
|
|
|
|
|
|
|
|
|
test.executeBinTest("MOVEA.w");
|
|
|
|
|
test.executeBinTest("MOVEA.l");
|
|
|
|
|
|
2025-05-19 11:37:54 +02:00
|
|
|
test.executeBinTest("MOVEM.w");
|
|
|
|
|
test.executeBinTest("MOVEM.l");
|
2025-05-19 12:16:18 +02:00
|
|
|
|
2025-05-18 22:59:19 +02:00
|
|
|
test.executeBinTest("MOVEtoCCR");
|
|
|
|
|
test.executeBinTest("MOVEtoUSP");
|
|
|
|
|
test.executeBinTest("MOVEfromUSP");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|