Fixed PHP to only modify B flag in byte written, status reg itself is unchanged
* line #71: C7E8 68 PLA * see http://visual6502.org/wiki/index.php?title=6502_BRK_and_B_bit
This commit is contained in:
parent
4bfc5655b6
commit
3471e9aa3a
12
6502.c
12
6502.c
|
@ -322,8 +322,16 @@ static void inst_PHA()
|
|||
|
||||
static void inst_PHP()
|
||||
{
|
||||
SR.bits.brk = 1; // this is slightly unexpected, but it's what the real hardware does.
|
||||
stack_push(SR.byte);
|
||||
union StatusReg pushed_sr;
|
||||
|
||||
// PHP sets the BRK flag in the byte that is pushed onto the stack,
|
||||
// but doesn't affect the status register itself. this is slightly
|
||||
// unexpected, but it's what the real hardware does.
|
||||
//
|
||||
// See http://visual6502.org/wiki/index.php?title=6502_BRK_and_B_bit
|
||||
pushed_sr.byte = SR.byte;
|
||||
pushed_sr.bits.brk = 1;
|
||||
stack_push(pushed_sr.byte);
|
||||
}
|
||||
|
||||
static void inst_PLA()
|
||||
|
|
Loading…
Reference in New Issue