funes-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Nes.CPU.Monad

Synopsis

Monad

newtype CPU r a Source #

Note: we use IO because it is likely to readwrite fromto memory, which is not pure

Constructors

MkCPU 

Fields

Instances

Instances details
MonadState BusState (CPU r) Source # 
Instance details

Defined in Nes.CPU.Monad

Methods

get :: CPU r BusState Source #

set :: BusState -> CPU r () Source #

MonadState CPUState (CPU r) Source # 
Instance details

Defined in Nes.CPU.Monad

Methods

get :: CPU r CPUState Source #

set :: CPUState -> CPU r () Source #

MonadState InterruptStatus (CPU r) Source # 
Instance details

Defined in Nes.CPU.Monad

MemoryInterface () (CPU r) Source # 
Instance details

Defined in Nes.CPU.Monad

Methods

readByte :: Addr -> () -> CPU r Byte Source #

readAddr :: Addr -> () -> CPU r Addr Source #

writeByte :: Byte -> Addr -> () -> CPU r () Source #

writeAddr :: Addr -> Addr -> () -> CPU r () Source #

MonadFail (CPU r) Source # 
Instance details

Defined in Nes.CPU.Monad

Methods

fail :: String -> CPU r a #

MonadIO (CPU r) Source # 
Instance details

Defined in Nes.CPU.Monad

Methods

liftIO :: IO a -> CPU r a #

Applicative (CPU r) Source # 
Instance details

Defined in Nes.CPU.Monad

Methods

pure :: a -> CPU r a #

(<*>) :: CPU r (a -> b) -> CPU r a -> CPU r b #

liftA2 :: (a -> b -> c) -> CPU r a -> CPU r b -> CPU r c #

(*>) :: CPU r a -> CPU r b -> CPU r b #

(<*) :: CPU r a -> CPU r b -> CPU r a #

Functor (CPU r) Source # 
Instance details

Defined in Nes.CPU.Monad

Methods

fmap :: (a -> b) -> CPU r a -> CPU r b #

(<$) :: a -> CPU r b -> CPU r a #

Monad (CPU r) Source # 
Instance details

Defined in Nes.CPU.Monad

Methods

(>>=) :: CPU r a -> (a -> CPU r b) -> CPU r b #

(>>) :: CPU r a -> CPU r b -> CPU r b #

return :: a -> CPU r a #

State

reset :: CPU r () Source #

Resets the state of the CPU

Program counter

readAtPC :: CPU r Byte Source #

Read Word8 from memory, using the program counter as offset

tick :: Int -> CPU r () Source #

Stack

Status register

popStatusRegister :: CPU r () Source #

Pops value on the stack, clear BFlag and sets the results value as status register

pushStatusRegister :: Bool -> CPU r () Source #

If the argument is True, the pushed value will have the B Flag set

Bus

liftBus :: Bus (a, BusState) a -> CPU r a Source #

unsafeLiftBus :: Bus (a, BusState) a -> CPU r a Source #

Unsafe action that provides access to Bus

When using it, ticks ARE NOT taken into account. For testing purposes