diff options
| author | LLLL Colonq <llll@colonq> | 2025-06-01 19:07:25 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-06-01 19:07:25 -0400 |
| commit | 4bc8bd58e6f9a6ca509d4e6869ba10c65145775d (patch) | |
| tree | 5bc97cc01e737f9cacba1f7c13570ce7846acf36 /fig-emulator-gb/src/Fig/Emulator/GB/Component/ROM.hs | |
| parent | f95d9bbde51ee26468177b2d34c669d9689fbea4 (diff) | |
Remove fig-emulator-gb
Diffstat (limited to 'fig-emulator-gb/src/Fig/Emulator/GB/Component/ROM.hs')
| -rw-r--r-- | fig-emulator-gb/src/Fig/Emulator/GB/Component/ROM.hs | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/fig-emulator-gb/src/Fig/Emulator/GB/Component/ROM.hs b/fig-emulator-gb/src/Fig/Emulator/GB/Component/ROM.hs deleted file mode 100644 index 6aafc46..0000000 --- a/fig-emulator-gb/src/Fig/Emulator/GB/Component/ROM.hs +++ /dev/null @@ -1,45 +0,0 @@ -module Fig.Emulator.GB.Component.ROM - ( compROM - ) where - -import Fig.Prelude -import Prelude (fromIntegral) - -import qualified Data.Vector as V -import qualified Data.ByteString as BS - -import Fig.Emulator.GB.Bus - -newtype ROMError = ROMError Text - deriving Show -instance Exception ROMError -instance Pretty ROMError where - pretty (ROMError b) = mconcat - [ "internal ROM error: " - , b - ] - --- | Initialize base ROM (no mapper) from a ByteString -compROM :: ByteString -> Component -compROM bs = Component - { compState = V.fromList $ BS.unpack bs - , compMatches = \a -> - a >= start && a < end - , compUpdate = \s _ -> pure s - , compWrite = \s _ad _v -> - pure s - -- throwM . ROMError $ mconcat - -- [ "tried to write to ROM at ", pretty ad - -- ] - , compRead = \s ad -> do - let offset = fromIntegral . unAddr $ ad - start - case s V.!? offset of - Nothing -> throwM . ROMError $ mconcat - [ "address ", pretty ad, " out of bounds" - ] - Just v -> pure v - } - where - start = 0x0000 - -- end = 0x4000 - end = 0x8000 |
