summaryrefslogtreecommitdiff
path: root/fig-emulator-gb/src/Fig/Emulator/GB/Component/RAM.hs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-06-01 19:07:25 -0400
committerLLLL Colonq <llll@colonq>2025-06-01 19:07:25 -0400
commit4bc8bd58e6f9a6ca509d4e6869ba10c65145775d (patch)
tree5bc97cc01e737f9cacba1f7c13570ce7846acf36 /fig-emulator-gb/src/Fig/Emulator/GB/Component/RAM.hs
parentf95d9bbde51ee26468177b2d34c669d9689fbea4 (diff)
Remove fig-emulator-gb
Diffstat (limited to 'fig-emulator-gb/src/Fig/Emulator/GB/Component/RAM.hs')
-rw-r--r--fig-emulator-gb/src/Fig/Emulator/GB/Component/RAM.hs40
1 files changed, 0 insertions, 40 deletions
diff --git a/fig-emulator-gb/src/Fig/Emulator/GB/Component/RAM.hs b/fig-emulator-gb/src/Fig/Emulator/GB/Component/RAM.hs
deleted file mode 100644
index 4dc5715..0000000
--- a/fig-emulator-gb/src/Fig/Emulator/GB/Component/RAM.hs
+++ /dev/null
@@ -1,40 +0,0 @@
-module Fig.Emulator.GB.Component.RAM
- ( compWRAM
- ) where
-
-import Fig.Prelude
-
-import qualified Data.Vector as V
-import qualified Data.Vector.Mutable as MV
-import Data.Word (Word8)
-
-import Fig.Emulator.GB.Bus
-
-newtype RAMError = RAMError Text
- deriving Show
-instance Exception RAMError
-instance Pretty RAMError where
- pretty (RAMError b) = mconcat
- [ "internal RAM error: "
- , b
- ]
-
-compWRAM :: Addr -> Int -> Component
-compWRAM start size = Component
- { compState = V.replicate size 0 :: V.Vector Word8
- , compMatches = \a ->
- a >= start && a <= end
- , compUpdate = \s _ -> {-# SCC "ComponentWRAMUpdate" #-} pure s
- , compWrite = \s ad v -> {-# SCC "ComponentWRAMWrite" #-} do
- let offset = fromIntegral . unAddr $ ad - start
- pure $ V.modify (\ms -> MV.write ms offset v) s
- , compRead = \s ad -> {-# SCC "ComponentWRAMRead" #-} do
- let offset = fromIntegral . unAddr $ ad - start
- case s V.!? offset of
- Nothing -> throwM . RAMError $ mconcat
- [ "address ", pretty ad, " out of bounds"
- ]
- Just v -> pure v
- }
- where
- end = start + Addr (fromIntegral (size - 1))