1
0
mirror of https://github.com/mre/mos6502.git synced 2024-11-15 13:05:33 +00:00

Add branch_if_positive().

This commit is contained in:
Andrew Keeton 2014-11-06 20:02:40 -05:00
parent eb27595cd5
commit f3160e1bcc

View File

@ -583,6 +583,12 @@ impl Machine {
} }
} }
fn branch_if_positive(&mut self, addr: Address) {
if !self.registers.status.contains(PS_NEGATIVE) {
self.registers.program_counter = addr;
}
}
fn push_on_stack(&mut self, val: u8) { fn push_on_stack(&mut self, val: u8) {
let addr = self.registers.stack_pointer.to_address(); let addr = self.registers.stack_pointer.to_address();
self.memory.set_byte(addr, val); self.memory.set_byte(addr, val);