mirror of
https://github.com/mre/mos6502.git
synced 2024-11-28 07:49:19 +00:00
don't overshoot the stack pointer! (pla and plp)
This commit is contained in:
parent
62424070a1
commit
26a2f51bc6
@ -433,13 +433,13 @@ impl<M: Bus> CPU<M> {
|
|||||||
(Instruction::PLA, OpInput::UseImplied) => {
|
(Instruction::PLA, OpInput::UseImplied) => {
|
||||||
// Pull accumulator
|
// Pull accumulator
|
||||||
self.pull_from_stack();
|
self.pull_from_stack();
|
||||||
let val: u8 = self.pull_from_stack();
|
let val: u8 = self.fetch_from_stack();
|
||||||
self.registers.accumulator = val as i8;
|
self.registers.accumulator = val as i8;
|
||||||
}
|
}
|
||||||
(Instruction::PLP, OpInput::UseImplied) => {
|
(Instruction::PLP, OpInput::UseImplied) => {
|
||||||
// Pull status
|
// Pull status
|
||||||
self.pull_from_stack();
|
self.pull_from_stack();
|
||||||
let val: u8 = self.pull_from_stack();
|
let val: u8 = self.fetch_from_stack();
|
||||||
// The `truncate` here won't do anything because we have a
|
// The `truncate` here won't do anything because we have a
|
||||||
// constant for the single unused flags bit. This probably
|
// constant for the single unused flags bit. This probably
|
||||||
// corresponds to the behavior of the 6502...? FIXME: verify
|
// corresponds to the behavior of the 6502...? FIXME: verify
|
||||||
|
Loading…
Reference in New Issue
Block a user