projects
/
z80.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
087d0a4
)
ZXS: Machine: Add more aux funcs
author
Lucian Mogosanu
<lucian.mogosanu@gmail.com>
Tue, 23 Dec 2014 17:41:18 +0000
(19:41 +0200)
committer
Lucian Mogosanu
<lucian.mogosanu@gmail.com>
Tue, 23 Dec 2014 17:41:34 +0000
(19:41 +0200)
getMainMemByte retrieves one byte from the main memory.
src/ZXS/Machine.hs
patch
|
blob
|
history
diff --git
a/src/ZXS/Machine.hs
b/src/ZXS/Machine.hs
index
3eaeff0
..
52842c4
100644
(file)
--- a/
src/ZXS/Machine.hs
+++ b/
src/ZXS/Machine.hs
@@
-1,6
+1,8
@@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module ZXS.Machine where
+import Data.Word
+import Control.Monad.IO.Class (liftIO)
import Control.Monad.State
import Control.Applicative (Applicative)
@@
-33,6
+35,10
@@
type ZXS a = ZXST IO a
getsCPU :: (CPU -> a) -> ZXS a
getsCPU f = gets zxCPU >>= return . f
+getMainMemByte :: Word16 -> ZXS Word8
+getMainMemByte addr = gets zxMainMem
+ >>= \ mem -> liftIO $ ramGetByte mem addr
+
modifyCPU :: (CPU -> CPU) -> ZXS ()
modifyCPU f = modify $ \ spc -> spc { zxCPU = f $ zxCPU spc }