This commit is contained in:
2026-04-02 11:49:10 +02:00
parent 5b5b78448d
commit 3d6f7887d8

View File

@@ -425,7 +425,15 @@ execute cpu = \case
_fHalfCarry = value .&. 16 + fromIntegral v .&. 16 > 16, -- TODO: check if this still works out
_fCarry = value > newValue
}
JPNN v -> cpu & pc .~ v
JPHL -> cpu & pc .~ cpu ^. hl
JPCCNN v _f op -> if op $ cpu ^. _f then cpu & pc .~ v else cpu
JRE v -> let target = fromIntegral $ (fromIntegral (cpu ^. pc) :: Integer) + fromIntegral v in cpu & pc .~ target
JRCCE v _f op -> if op $ cpu ^. _f then
let target = fromIntegral $ (fromIntegral (cpu ^. pc) :: Integer) + fromIntegral v in
cpu & pc .~ target
else
cpu
where
add :: Word8 -> Word8 -> Bool -> (Word8, FlagRegister)
add o n _c = let new = o + n + if _c then 1 else 0