From d01db89fb09cd2bcc92bb213e66411d7f3e410f0 Mon Sep 17 00:00:00 2001 From: pingu Date: Mon, 30 Mar 2026 13:31:32 +0200 Subject: [PATCH] Remove them flips --- src/GB/CPU.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/GB/CPU.hs b/src/GB/CPU.hs index 9d5b4ba..bb563ba 100644 --- a/src/GB/CPU.hs +++ b/src/GB/CPU.hs @@ -34,10 +34,10 @@ carryFlagPosition = 4 instance Convert FlagRegister Word8 where convert r = - (flip shiftL zeroFlagPosition $ if r ^. zero then 1 else 0) + - (flip shiftL subtractFlagPosition $ if r ^. subtract then 1 else 0) + - (flip shiftL halfCarryFlagPosition $ if r ^. halfCarry then 1 else 0) + - (flip shiftL carryFlagPosition $ if r ^. carry then 1 else 0) + ((`shiftL` zeroFlagPosition) $ if r ^. zero then 1 else 0) + + ((`shiftL` subtractFlagPosition) $ if r ^. subtract then 1 else 0) + + ((`shiftL` halfCarryFlagPosition) $ if r ^. halfCarry then 1 else 0) + + ((`shiftL` carryFlagPosition) $ if r ^. carry then 1 else 0) instance Convert Word8 FlagRegister where convert w = @@ -153,7 +153,7 @@ execute cpu = \case (new, FlagRegister {..}) fetch :: CPU -> Word16 -> Word8 - fetch _cpu addr = flip V.index (fromIntegral addr) $ _cpu ^. bus + fetch _cpu addr = (`V.index` (fromIntegral addr)) $ _cpu ^. bus write :: CPU -> Word16 -> Word8 -> CPU - write _cpu target value = _cpu & bus %~ (flip V.update $ V.singleton (fromIntegral target, value)) + write _cpu target value = _cpu & bus %~ (`V.update` V.singleton (fromIntegral target, value))