Z80: Add most basic primitives
authorLucian Mogosanu <lucian.mogosanu@gmail.com>
Sat, 13 Dec 2014 17:08:34 +0000 (19:08 +0200)
committerLucian Mogosanu <lucian.mogosanu@gmail.com>
Sat, 13 Dec 2014 17:08:34 +0000 (19:08 +0200)
src/Z80/CPU.hs
src/Z80/Primitives.hs [new file with mode: 0644]

index 2d34f11..9114d90 100644 (file)
@@ -29,29 +29,3 @@ data Prefixed =
   | 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 }
-setDE cpu w = cpu { de = w }
-setHL cpu w = cpu { hl = w }
-
-setAF', setBC', setDE', setHL' :: CPU -> Word16 -> CPU
-setAF' cpu w = cpu { af' = w }
-setBC' cpu w = cpu { bc' = w }
-setDE' cpu w = cpu { de' = w }
-setHL' cpu w = cpu { hl' = w }
-
-setIX, setIY, setSP, setPC :: CPU -> Word16 -> CPU
-setIX cpu w = cpu { ix = w }
-setIY cpu w = cpu { iy = w }
-setSP cpu w = cpu { sp = w }
-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 }
diff --git a/src/Z80/Primitives.hs b/src/Z80/Primitives.hs
new file mode 100644 (file)
index 0000000..a0be8df
--- /dev/null
@@ -0,0 +1,27 @@
+module Z80.Primitives where
+
+-- 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 }
+setDE cpu w = cpu { de = w }
+setHL cpu w = cpu { hl = w }
+
+setAF', setBC', setDE', setHL' :: CPU -> Word16 -> CPU
+setAF' cpu w = cpu { af' = w }
+setBC' cpu w = cpu { bc' = w }
+setDE' cpu w = cpu { de' = w }
+setHL' cpu w = cpu { hl' = w }
+
+setIX, setIY, setSP, setPC :: CPU -> Word16 -> CPU
+setIX cpu w = cpu { ix = w }
+setIY cpu w = cpu { iy = w }
+setSP cpu w = cpu { sp = w }
+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 }