summaryrefslogtreecommitdiff
path: root/fig-emulator-gb/src/Fig/Emulator/GB/Utils.hs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-04-23 21:50:15 -0400
committerLLLL Colonq <llll@colonq>2024-04-23 21:50:15 -0400
commit64624b52279bd76d473aa92b072a0e5ebd516530 (patch)
tree80e6c1a1586a42a138eb5440419a08c03797325e /fig-emulator-gb/src/Fig/Emulator/GB/Utils.hs
parent828b424422d8ba17322eb08a22ca4f3815cf0ed3 (diff)
Automated instruction testing using linked repo
https://github.com/adtennant/GameboyCPUTests
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