Z80: CPU: Add Prefixed flag
authorLucian Mogosanu <lucian.mogosanu@gmail.com>
Thu, 11 Dec 2014 22:20:37 +0000 (00:20 +0200)
committerLucian Mogosanu <lucian.mogosanu@gmail.com>
Thu, 11 Dec 2014 22:20:37 +0000 (00:20 +0200)
src/Data/Z80/CPU.hs

index ca13a47..e40ed00 100644 (file)
@@ -17,9 +17,20 @@ data CPU = CPU
   , iy  :: Word16
   , sp  :: Word16
   , pc  :: Word16
+  , prefixed :: Prefixed
   } deriving (Show, Eq)
 
--- not really into lenses so we're using those for now
+data Prefixed =
+    Unprefixed
+  | CBPrefixed
+  | EDPrefixed
+  | DDPrefixed
+  | FDPrefixed
+  | DDCBPrefixed
+  | FDCBPrefixed
+  deriving (Show, Eq)
+
+-- not really into lenses so we're using these for now
 setAF, setBC, setDE, setHL :: CPU -> Word16 -> CPU
 setAF cpu w = cpu { af = w }
 setBC cpu w = cpu { bc = w }
@@ -41,3 +52,6 @@ setPC cpu w = cpu { pc = w }
 setI, setR :: CPU -> Word8 -> CPU
 setI cpu b = cpu { i = b }
 setR cpu b = cpu { r = b }
+
+setPrefixed :: CPU -> Prefixed -> CPU
+setPrefixed cpu p = cpu { prefixed = p }