From f79b01fa30f894f2b3ad22181c25ff555479018a Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 27 Aug 2026 07:27:58 +0200 Subject: Implement the bvc and bvs instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They were the last ones marked with the todo!() macro. Signed-off-by: Miquel Sabaté Solà --- lib/vnf/src/lib.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'lib/vnf/src/lib.rs') diff --git a/lib/vnf/src/lib.rs b/lib/vnf/src/lib.rs index e2d066b..ab8973b 100644 --- a/lib/vnf/src/lib.rs +++ b/lib/vnf/src/lib.rs @@ -771,10 +771,6 @@ impl Machine { self.status_register.overflow = false; match self.current_instruction.identifier { - // TODO - InstructionIdentifier::Bvc => todo!(), - InstructionIdentifier::Bvs => todo!(), - // Flag instructions. InstructionIdentifier::Sec => self.status_register.carry = true, InstructionIdentifier::Clc => self.status_register.carry = false, @@ -1042,6 +1038,17 @@ impl Machine { self.branch(); } } + InstructionIdentifier::Bvc => { + if !self.status_register.overflow { + self.branch(); + } + } + InstructionIdentifier::Bvs => { + if self.status_register.overflow { + self.branch(); + } + } + InstructionIdentifier::Rts => { // If the stack is empty but we were just running a function, // then assume that the machine is done. -- cgit v1.2.3