mirror of
https://github.com/mre/mos6502.git
synced 2024-12-22 12:29:31 +00:00
commit
a6eae6f2b0
@ -1361,5 +1361,11 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn stack_underflow() {
|
||||||
|
let mut cpu = CPU::new();
|
||||||
|
let _val: u8 = cpu.pull_from_stack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,11 +154,11 @@ impl StackPointer {
|
|||||||
// JAM: FIXME: Should we prevent overflow here? What would a 6502 do?
|
// JAM: FIXME: Should we prevent overflow here? What would a 6502 do?
|
||||||
|
|
||||||
pub fn decrement(&mut self) {
|
pub fn decrement(&mut self) {
|
||||||
self.0 -= 1;
|
self.0 = self.0.wrapping_sub(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn increment(&mut self) {
|
pub fn increment(&mut self) {
|
||||||
self.0 += 1;
|
self.0 = self.0.wrapping_add(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user