mirror of
https://github.com/irmen/ksim65.git
synced 2026-04-27 04:17:45 +00:00
implement a handful more illegal instructions (6502)
This commit is contained in:
1 parent
466da87deb
commit
6e79efdf3c
4 files changed
+19
-22
No files matched your search
@@ -13,7 +13,7 @@ Properties of this simulator:
|
||||
- simulates various hardware components (bus, cpu, memory, i/o controllers)
|
||||
- IRQ and NMI
|
||||
- instruction cycle times are simulated (however the *internal* cpu behavior is not cycle-exact for simplicity reasons)
|
||||
- has all 6502 and 65c02 instructions, including many of the 'illegal' 6502 instructions (goal is 100% eventually)
|
||||
- simulates all 6502 and 65c02 instructions, including many of the 'illegal' 6502 instructions
|
||||
- correct BCD mode for adc/sbc instructions on both cpu types
|
||||
- passes several extensive unit test suites that verify instruction and cpu flags behavior
|
||||
- simple debugging machine monitor, which basic disassembler and assembler functions
|
||||
|
||||
@@ -1416,10 +1416,11 @@ sealed class Cpu6502Core : BusComponent() {
|
||||
// or https://github.com/quietust/nintendulator/blob/master/src/CPU.cpp (search for LogBadOps)
|
||||
// or https://github.com/stardot/b-em/blob/master/src/6502.c
|
||||
// or https://github.com/wpmed92/MedNES/blob/master/NES/6502.cpp
|
||||
// TODO: some of the instructions below may be implemented incorrectly / are not finished yet
|
||||
|
||||
// NOTE: some instructions below may be unimplemented due to cpu quirkyness
|
||||
|
||||
private fun iAhx(): Boolean {
|
||||
val addrHi = 0xff // TODO get the correct byte from the instruction (=last byte read)
|
||||
val addrHi = (fetchedAddress shr 8) and 0xff
|
||||
val value = regA and regX and (addrHi+1)
|
||||
write(fetchedAddress, value)
|
||||
return false
|
||||
@@ -1506,13 +1507,13 @@ sealed class Cpu6502Core : BusComponent() {
|
||||
}
|
||||
|
||||
private fun iShx(): Boolean {
|
||||
val addrHi = 0xff // TODO get the correct byte from the instruction (=last byte read)
|
||||
val addrHi = (fetchedAddress shr 8) and 0xff
|
||||
write(fetchedAddress, regX and (addrHi+1))
|
||||
return false
|
||||
}
|
||||
|
||||
private fun iShy(): Boolean {
|
||||
val addrHi = 0xff // TODO get the correct byte from the instruction (=last byte read)
|
||||
val addrHi = (fetchedAddress shr 8) and 0xff
|
||||
write(fetchedAddress, regY and (addrHi+1))
|
||||
return false
|
||||
}
|
||||
@@ -1531,7 +1532,7 @@ sealed class Cpu6502Core : BusComponent() {
|
||||
|
||||
private fun iTas(): Boolean {
|
||||
regSP = regA and regX
|
||||
val addrHi = 0xff // TODO get the correct byte from the instruction (=last byte read)
|
||||
val addrHi = (fetchedAddress shr 8) and 0xff
|
||||
write(fetchedAddress, regSP and addrHi)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
version=1.21
|
||||
version=1.22
|
||||
@@ -283,60 +283,56 @@ class Test6502TestSuiteIllegalInstructions: FunctionalTestsBase() {
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
fun testAlrb() {
|
||||
runTest("alrb") // TODO fix?
|
||||
runTest("alrb")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
fun testAneb() {
|
||||
runTest("aneb") // TODO fix?
|
||||
runTest("aneb")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
fun testArrb() {
|
||||
runTest("arrb") // TODO fix?
|
||||
runTest("arrb")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
fun testLxab() {
|
||||
runTest("lxab") // TODO fix something?
|
||||
runTest("lxab")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
fun testSbxb() {
|
||||
runTest("sbxb") // TODO fix?
|
||||
runTest("sbxb")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
fun testShaay() {
|
||||
runTest("shaay") // TODO fix?
|
||||
runTest("shaay")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
fun testShaiy() {
|
||||
runTest("shaiy") // TODO fix?
|
||||
runTest("shaiy")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
@Disabled("this instruction has quirky behavior that varies between machines")
|
||||
fun testShsay() {
|
||||
runTest("shsay") // TODO fix?
|
||||
runTest("shsay")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
fun testShxay() {
|
||||
runTest("shxay") // TODO fix?
|
||||
runTest("shxay")
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled("this illegal instruction is probably not implemented correctly yet")
|
||||
fun testShyax() {
|
||||
runTest("shyax") // TODO fix?
|
||||
runTest("shyax")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user