summaryrefslogtreecommitdiff
path: root/fig-emulator-gb/src/Fig/Emulator/GB/Component/Joystick.hs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-04-17 22:45:19 -0400
committerLLLL Colonq <llll@colonq>2024-04-17 22:45:19 -0400
commit9d875ab8fb539246e3aea0aae58d2c9f227c8276 (patch)
treeba14b76a69fa39ec5cdb614d76ff6fdd02c81e94 /fig-emulator-gb/src/Fig/Emulator/GB/Component/Joystick.hs
parent3a0a7b0a89fd841edd5f25f79cdb877051d0e948 (diff)
Some basic emulator graphics
Diffstat (limited to 'fig-emulator-gb/src/Fig/Emulator/GB/Component/Joystick.hs')
-rw-r--r--fig-emulator-gb/src/Fig/Emulator/GB/Component/Joystick.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/fig-emulator-gb/src/Fig/Emulator/GB/Component/Joystick.hs b/fig-emulator-gb/src/Fig/Emulator/GB/Component/Joystick.hs
new file mode 100644
index 0000000..84785b6
--- /dev/null
+++ b/fig-emulator-gb/src/Fig/Emulator/GB/Component/Joystick.hs
@@ -0,0 +1,23 @@
+module Fig.Emulator.GB.Component.Joystick where
+
+import Fig.Prelude
+
+import Fig.Emulator.GB.Bus
+
+newtype JoystickError = JoystickError Text
+ deriving Show
+instance Exception JoystickError
+instance Pretty JoystickError where
+ pretty (JoystickError b) = mconcat
+ [ "joystick error: "
+ , b
+ ]
+
+compJoystick :: (MonadIO m, MonadThrow m) => Component m
+compJoystick = Component
+ { compState = ()
+ , compMatches = (== 0xff00)
+ , compUpdate = \s _ -> pure s
+ , compWrite = \s _ _ -> pure s
+ , compRead = \_ _ -> pure 0x00
+ }