1
0
mirror of https://github.com/jborza/emu6502.git synced 2024-11-28 08:49:46 +00:00

fixed status register handling in PLP (bit 4 now not read)

This commit is contained in:
jborza 2019-05-01 21:10:12 +02:00
parent 9f0a6bc40b
commit adb70b62c3
2 changed files with 3 additions and 1 deletions

2
cpu.c
View File

@ -342,6 +342,8 @@ void PLA_(State6502* state) {
void PLP_(State6502* state) { void PLP_(State6502* state) {
byte value = pop_byte_from_stack(state); byte value = pop_byte_from_stack(state);
//we don't read the BRK flag
value ^= 1 << 4;
memset(&state->flags, value, sizeof(Flags)); memset(&state->flags, value, sizeof(Flags));
} }

View File

@ -1957,7 +1957,7 @@ void test_PLP() {
assert_sp(&state, 0xFF); assert_sp(&state, 0xFF);
assert_flag_c(&state, 1); assert_flag_c(&state, 1);
assert_flag_d(&state, 1); assert_flag_d(&state, 1);
assert_flag_b(&state, 1); assert_flag_b(&state, 0);
assert_flag_z(&state, 1); assert_flag_z(&state, 1);
assert_flag_v(&state, 1); assert_flag_v(&state, 1);
assert_flag_n(&state, 1); assert_flag_n(&state, 1);