Krolyxon
Commit 6e317ee

Branches

Tags

Refs →

bench516e317ee

mov instruction must set the zero flag appropriately to avoid desyncing

Author
krolxon
Date
2026-01-04 19:17 +0530
Parent
be61e5a
Commit
6e317ee063844780961a70b13a6aea73154ad72e

+2 −2

1 file changed

  1. M src/cpu.rs +2 −2
M src/cpu.rs View
@@ -37,6 +37,8 @@ impl CPU {
3737 3 => self.d = val,
3838 _ => {}
3939 }
40+
41+ self.zero = val == 0;
4042 }
4143
4244 pub fn add(&mut self, mem:&mut Memory) {
@@ -150,7 +152,6 @@ impl CPU {
150152 if self.zero {
151153 self.pc = addrs;
152154 }
153−
154155 }
155156
156157 pub fn jnz(&mut self, mem: &mut Memory) {
@@ -162,7 +163,6 @@ impl CPU {
162163 if !self.zero {
163164 self.pc = addrs;
164165 }
165−
166166 }
167167
168168