Remove them flips
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user