mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-02 06:41:32 +00:00
Simplified test code for X and Y regs, added additional JSR test
This commit is contained in:
parent
7b78521920
commit
a3e9a44254
|
@ -305,11 +305,8 @@ public class TestProgram {
|
|||
String condition = "X != %s <<%s>>".formatted(Integer.toHexString(val), caller);
|
||||
_test("""
|
||||
PHP
|
||||
PHA
|
||||
TXA
|
||||
CMP #%s
|
||||
CPX #%s
|
||||
BNE ++
|
||||
PLA
|
||||
PLP
|
||||
BRA +
|
||||
++ ; Error
|
||||
|
@ -324,11 +321,8 @@ public class TestProgram {
|
|||
String condition = "Y != %s <<%s>>".formatted(Integer.toHexString(val), caller);
|
||||
_test("""
|
||||
PHP
|
||||
PHA
|
||||
TYA
|
||||
CMP #%s
|
||||
CPY #%s
|
||||
BNE ++
|
||||
PLA
|
||||
PLP
|
||||
BRA +
|
||||
++ ; Error
|
||||
|
|
|
@ -765,6 +765,7 @@ public class Full65C02Test {
|
|||
/* Test JSR */
|
||||
@Test
|
||||
public void testJsr() throws ProgramException {
|
||||
// "Easy" test that JSR + RTS work as expected and together take 12 cycles
|
||||
new TestProgram()
|
||||
.add("""
|
||||
jmp +
|
||||
|
@ -776,5 +777,33 @@ public class Full65C02Test {
|
|||
JSR sub1
|
||||
""", 12)
|
||||
.run();
|
||||
// Check that JSR pushes the expected PC values to the stack
|
||||
new TestProgram()
|
||||
.add("""
|
||||
jmp start
|
||||
test
|
||||
plx
|
||||
ply
|
||||
phy
|
||||
phx
|
||||
rts
|
||||
""")
|
||||
.test("", "RTS did not return to the correct address")
|
||||
.add("""
|
||||
start
|
||||
+traceOn
|
||||
jsr test
|
||||
ret
|
||||
""")
|
||||
.test("""
|
||||
cpy #>ret
|
||||
beq +
|
||||
""", "Y = MSB of return address")
|
||||
.test("""
|
||||
inx
|
||||
cpx #<ret
|
||||
beq +
|
||||
""", "X = LSB of return address-1")
|
||||
.run();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user