From f3160e1bcc7fd8a431c01e7de367b359077c6a67 Mon Sep 17 00:00:00 2001 From: Andrew Keeton Date: Thu, 6 Nov 2014 20:02:40 -0500 Subject: [PATCH] Add branch_if_positive(). --- src/machine.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/machine.rs b/src/machine.rs index 54df5a4..210c46c 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -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) { let addr = self.registers.stack_pointer.to_address(); self.memory.set_byte(addr, val);