bench516e317ee
mov instruction must set the zero flag appropriately to avoid desyncing
+2 −2
1 file changed
- M src/cpu.rs +2 −2
| @@ -37,6 +37,8 @@ impl CPU { | |||
| 37 | 37 | 3 => self.d = val, | |
| 38 | 38 | _ => {} | |
| 39 | 39 | } | |
| 40 | + | ||
| 41 | + | self.zero = val == 0; | |
| 40 | 42 | } | |
| 41 | 43 | ||
| 42 | 44 | pub fn add(&mut self, mem:&mut Memory) { | |
| @@ -150,7 +152,6 @@ impl CPU { | |||
| 150 | 152 | if self.zero { | |
| 151 | 153 | self.pc = addrs; | |
| 152 | 154 | } | |
| 153 | − | ||
| 154 | 155 | } | |
| 155 | 156 | ||
| 156 | 157 | pub fn jnz(&mut self, mem: &mut Memory) { | |
| @@ -162,7 +163,6 @@ impl CPU { | |||
| 162 | 163 | if !self.zero { | |
| 163 | 164 | self.pc = addrs; | |
| 164 | 165 | } | |
| 165 | − | ||
| 166 | 166 | } | |
| 167 | 167 | ||
| 168 | 168 | ||