aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Commands.hs4
-rw-r--r--src/Machine.hs13
2 files changed, 14 insertions, 3 deletions
diff --git a/src/Commands.hs b/src/Commands.hs
index 6fce17b..32fc17f 100644
--- a/src/Commands.hs
+++ b/src/Commands.hs
@@ -114,11 +114,9 @@ doLINK _ = return ()
doUNLK :: Int -> Emulator ()
doUNLK a = do
+ incPC
addr <- readA a
val <- getLong addr
- with pc $ \pc -> do
- pcval <- readIORef pc
- writeIORef pc (pcval + 2)
writeA a val
writeA 7 (addr + 4)
diff --git a/src/Machine.hs b/src/Machine.hs
index 6a09be9..23b7872 100644
--- a/src/Machine.hs
+++ b/src/Machine.hs
@@ -166,6 +166,19 @@ writeA _ _ = return $ error "Incorrect Address register write"
-------------------------------------------------------------------------------
+-- PC Register Access
+readPC = with pc $ \pc -> do
+ return pc
+
+writePC r = with pc $ \pc -> do
+ writeIORef pc r
+
+incPC = with pc $ \pc -> do
+ pcval <- readIORef pc
+ writeIORef pc (pcval + 2)
+
+
+-------------------------------------------------------------------------------
-- Status Register Access
isTracing :: Emulator Bool