diff --git a/src/GBC/CPU.hs b/src/GBC/CPU.hs index 257105d..494ad30 100644 --- a/src/GBC/CPU.hs +++ b/src/GBC/CPU.hs @@ -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