mirror of
https://bitbucket.org/rslr/miggy-cpu.git
synced 2026-06-12 19:16:29 +00:00
Fixed LSL/LSR/ROL/ROR
This commit is contained in:
parent
4aad8cbc96
commit
d2d7171a18
14 changed files with 70 additions and 57 deletions
|
|
@ -1349,6 +1349,8 @@ public class CoreALU {
|
|||
|
||||
sr ^= (sr ^ (cx | z | n)) & (FL_C | FL_V | FL_Z | FL_N | FL_X);
|
||||
} else {
|
||||
res = (byte) res;
|
||||
|
||||
int n = (res >> 28) & FL_N;
|
||||
int z = (~((res | -res) >> 31)) & FL_Z;
|
||||
|
||||
|
|
@ -1380,6 +1382,8 @@ public class CoreALU {
|
|||
|
||||
sr ^= (sr ^ (cx | z | n)) & (FL_C | FL_V | FL_Z | FL_N | FL_X);
|
||||
} else {
|
||||
res = (short) res;
|
||||
|
||||
int n = (res >> 28) & FL_N;
|
||||
int z = (~((res | -res) >> 31)) & FL_Z;
|
||||
|
||||
|
|
@ -1613,7 +1617,7 @@ public class CoreALU {
|
|||
shift &= 0x3f;
|
||||
|
||||
if (shift > 0) {
|
||||
shift &= 7;
|
||||
shift &= 15;
|
||||
|
||||
short res = (short) ((dst << (16 - shift)) | ((dst & 0xffff) >>> shift));
|
||||
int cn = (res >> 31) & (FL_N | FL_C);
|
||||
|
|
@ -1637,7 +1641,7 @@ public class CoreALU {
|
|||
shift &= 0x3f;
|
||||
|
||||
if (shift > 0) {
|
||||
shift &= 7;
|
||||
shift &= 31;
|
||||
|
||||
int res = (dst << (32 - shift)) | (dst >>> shift);
|
||||
int cn = (res >> 31) & (FL_N | FL_C);
|
||||
|
|
|
|||
|
|
@ -71,51 +71,60 @@ public class InstructionTests extends TestCase {
|
|||
test.executeBinTest("BTST");
|
||||
}
|
||||
|
||||
// public void testASL() {
|
||||
// CoreTest test = new CoreTest(0xffffff + 1, true);
|
||||
//
|
||||
// test.executeBinTest("ASL.b");
|
||||
// test.executeBinTest("ASL.w");
|
||||
// test.executeBinTest("ASL.l");
|
||||
// }
|
||||
public void testShift() {
|
||||
CoreTest test = new CoreTest(0xffffff + 1, true);
|
||||
|
||||
public void testBcc() {
|
||||
CoreTest test = new CoreTest(0xffffff + 1, true);
|
||||
|
||||
test.executeBinTest("Bcc", 373, 466, 570, 1547, 1695, 1782, 2166, 2224, 2441);
|
||||
test.executeBinTest("BSR", 25, 573, 814, 1357, 1443, 1509, 1734, 1934, 2232, 2338);
|
||||
}
|
||||
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 testDBcc() {
|
||||
CoreTest test = new CoreTest(0xffffff + 1, true);
|
||||
public void testBcc() {
|
||||
CoreTest test = new CoreTest(0xffffff + 1, true);
|
||||
|
||||
test.executeBinTest("DBcc");
|
||||
}
|
||||
test.executeBinTest("Bcc", 373, 466, 570, 1547, 1695, 1782, 2166, 2224, 2441);
|
||||
test.executeBinTest("BSR", 25, 573, 814, 1357, 1443, 1509, 1734, 1934, 2232, 2338);
|
||||
}
|
||||
|
||||
public void testMisc() {
|
||||
CoreTest test = new CoreTest(0xffffff + 1, true);
|
||||
public void testDBcc() {
|
||||
CoreTest test = new CoreTest(0xffffff + 1, true);
|
||||
|
||||
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");
|
||||
}
|
||||
test.executeBinTest("DBcc");
|
||||
}
|
||||
|
||||
public void testMisc() {
|
||||
CoreTest test = new CoreTest(0xffffff + 1, true);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
public void testJMP() {
|
||||
CoreTest test = new CoreTest(0xffffff + 1, true);
|
||||
|
|
@ -153,26 +162,26 @@ public class InstructionTests extends TestCase {
|
|||
|
||||
test.executeBinTest("MOVE.b");
|
||||
/*
|
||||
* 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)
|
||||
* 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)
|
||||
*/
|
||||
test.executeBinTest("MOVE.w", 295, 342, 494, 994, 1225, 1846);
|
||||
/*
|
||||
* 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)
|
||||
* 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)
|
||||
*/
|
||||
test.executeBinTest("MOVE.l", 217, 502, 1152, 1691, 1830, 2057, 2135);
|
||||
test.executeBinTest("MOVE.q");
|
||||
|
||||
|
||||
test.executeBinTest("MOVEP.w");
|
||||
test.executeBinTest("MOVEP.l");
|
||||
|
||||
|
|
@ -181,7 +190,7 @@ public class InstructionTests extends TestCase {
|
|||
|
||||
test.executeBinTest("MOVEM.w");
|
||||
test.executeBinTest("MOVEM.l");
|
||||
|
||||
|
||||
test.executeBinTest("MOVEtoCCR");
|
||||
test.executeBinTest("MOVEtoUSP");
|
||||
test.executeBinTest("MOVEfromUSP");
|
||||
|
|
|
|||
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSL.b.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSL.b.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSL.l.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSL.l.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSL.w.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSL.w.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSR.b.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSR.b.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSR.l.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSR.l.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSR.w.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/LSR.w.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROL.b.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROL.b.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROL.l.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROL.l.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROL.w.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROL.w.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROR.b.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROR.b.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROR.l.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROR.l.json.bin
Normal file
Binary file not shown.
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROR.w.json.bin
Normal file
BIN
miggy-emu/src/test/resources/miggy/cpupoet/ROR.w.json.bin
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue