summaryrefslogtreecommitdiff
path: root/fig-emulator-gb/src/Fig/Emulator/GB/Utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'fig-emulator-gb/src/Fig/Emulator/GB/Utils.hs')
-rw-r--r--fig-emulator-gb/src/Fig/Emulator/GB/Utils.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/fig-emulator-gb/src/Fig/Emulator/GB/Utils.hs b/fig-emulator-gb/src/Fig/Emulator/GB/Utils.hs
index 4d00743..b250068 100644
--- a/fig-emulator-gb/src/Fig/Emulator/GB/Utils.hs
+++ b/fig-emulator-gb/src/Fig/Emulator/GB/Utils.hs
@@ -44,6 +44,14 @@ flagsw8 z n h c =
.|. shiftL (if h then 1 else 0) 5
.|. shiftL (if c then 1 else 0) 4
+w8flags :: Word8 -> (Bool, Bool, Bool, Bool)
+w8flags x = (z, n, h, c)
+ where
+ z = w8bit 7 x
+ n = w8bit 6 x
+ h = w8bit 5 x
+ c = w8bit 4 x
+
zext :: Word8 -> Word16
zext = fromIntegral