From fd153b979a0bb15cfb581f54c211e242bbdd9bb6 Mon Sep 17 00:00:00 2001 From: Lucian Mogosanu Date: Tue, 23 Dec 2014 19:41:18 +0200 Subject: [PATCH] ZXS: Machine: Add more aux funcs getMainMemByte retrieves one byte from the main memory. --- src/ZXS/Machine.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ZXS/Machine.hs b/src/ZXS/Machine.hs index 3eaeff0..52842c4 100644 --- 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 } -- 1.7.10.4