From 6e317ee063844780961a70b13a6aea73154ad72e Mon Sep 17 00:00:00 2001 From: krolxon Date: Sun, 4 Jan 2026 19:17:15 +0530 Subject: [PATCH] mov instruction must set the zero flag appropriately to avoid desyncing --- src/cpu.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpu.rs b/src/cpu.rs index 124d391..b28fef9 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -37,6 +37,8 @@ impl CPU { 3 => self.d = val, _ => {} } + + self.zero = val == 0; } pub fn add(&mut self, mem:&mut Memory) { @@ -150,7 +152,6 @@ impl CPU { if self.zero { self.pc = addrs; } - } pub fn jnz(&mut self, mem: &mut Memory) { @@ -162,7 +163,6 @@ impl CPU { if !self.zero { self.pc = addrs; } - }