From f760b96d19ace7eef91d3f3e0e96d42764991e45 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 9 Jul 2024 01:06:47 -0500 Subject: [PATCH] POP: Don't allow F.low to be set --- src/cpu.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cpu.rs b/src/cpu.rs index 1b5e46a..28dcd69 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -624,6 +624,9 @@ mod instructions { } pub fn insn_pop(&mut self, reg: R16Stack, bus: &mut impl BusIO) -> IResult { self[reg].0 = self.pop16(bus)?; + if let R16Stack::AF = reg { + self.af.wide_mut().0 &= 0xfff0; // lo flags should never be set + } Ok(()) } }