Last active
November 24, 2015 06:28
-
-
Save roboguy13/ccc8ab946efa5abccf10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Word | |
import Control.Applicative | |
import Data.Vector (Vector) | |
type EmuWord = Word32 | |
data Emu a -- ... | |
instance Functor Emu | |
instance Applicative Emu | |
instance Monad Emu | |
instance MonadIO Emu | |
loadProgram :: Vector EmuWord -> Emu () | |
nextInstruction :: Emu EmuWord | |
reset :: Emu () | |
halt :: Emu () | |
memGet :: EmuWord -> Emu EmuWord | |
memSet :: EmuWord -> EmuWord -> Emu () | |
-- | Apply the given function over the given memory location range. Since | |
-- this is a pure function, this operation could be parallelized relatively | |
-- easily. | |
memSets :: (EmuWord -> EmuWord) -> EmuWord -> EmuWord -> Emu () | |
-- | Add a memory map hook to the given range of memory locations | |
addMemMapHook :: (EmuWord -> Emu EmuWord) -> EmuWord -> EmuWord -> Emu () | |
instrMemGet :: EmuWord -> Emu EmuWord | |
instrMemSet :: EmuWord -> EmuWord -> Emu () | |
-- | Reorder two instructions by swapping them in the instruction memory | |
instrMemSwap :: EmuWord -> EmuWord -> Emu () | |
regGet :: EmuWord -> Emu EmuWord | |
regSet :: EmuWord -> EmuWord -> Emu () | |
getTicks :: Emu EmuWord | |
sliceWord :: Word8 -> Word8 -> EmuWord -> EmuWord | |
runEmu :: Emu a -> IO a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment