1
0
mirror of https://github.com/jborza/emu6502.git synced 2025-02-16 17:30:27 +00:00

longer test for JSR and RTS

This commit is contained in:
jborza 2019-04-26 11:28:20 +02:00
parent eb1134b0da
commit 6b6fcd677b

View File

@ -44,6 +44,15 @@ void test_step(State6502 * state) {
print_all(state); print_all(state);
} }
void test_step_until_break(State6502* state) {
do {
print_all(state);
disassemble_6502(state->memory, state->pc);
emulate_6502_op(state);
} while (state->flags.b != 1);
print_all(state);
}
void test_cleanup(State6502 * state) { void test_cleanup(State6502 * state) {
free(state->memory); free(state->memory);
} }
@ -2173,8 +2182,7 @@ void test_JSR_RTS() {
char program[] = { JSR_ABS, 0x06, 0x00, LDA_IMM, 0xAA, BRK, LDX_IMM, 0xBB, RTS}; char program[] = { JSR_ABS, 0x06, 0x00, LDA_IMM, 0xAA, BRK, LDX_IMM, 0xBB, RTS};
memcpy(state.memory, program, sizeof(program)); memcpy(state.memory, program, sizeof(program));
//act //act
test_step(&state); test_step_until_break(&state);
test_step(&state);
//assert //assert
assert_pc(&state, 0x0006); assert_pc(&state, 0x0006);
assert_sp(&state, 0xFF); assert_sp(&state, 0xFF);