aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2021-03-22 16:45:26 +0300
committerAleksey Veresov <aleksey@veresov.pro>2021-03-22 16:45:26 +0300
commit77b2540293dea4b6c348b3154e62c095de780142 (patch)
treee2cec7002d04c92bfa8e2438703e1319fb37e6f2 /src
parent1328d948ba1d3e4d72ceb8a4a01db7bb982535b4 (diff)
downloadsuem-77b2540293dea4b6c348b3154e62c095de780142.tar
suem-77b2540293dea4b6c348b3154e62c095de780142.tar.xz
suem-77b2540293dea4b6c348b3154e62c095de780142.zip
.
Diffstat (limited to 'src')
-rw-r--r--src/Commands.hs7
-rw-r--r--src/Machine.hs1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/Commands.hs b/src/Commands.hs
index 32fc17f..e12cfdf 100644
--- a/src/Commands.hs
+++ b/src/Commands.hs
@@ -110,7 +110,12 @@ doTRAP :: Int -> Emulator ()
doTRAP _ = return ()
doLINK :: Int -> Emulator ()
-doLINK _ = return ()
+doLINK a = do
+ incPC
+ addr <- readA a
+ sp <- readA 7
+ writeA 7 (sp-4)
+ setLong (sp-4) addr
doUNLK :: Int -> Emulator ()
doUNLK a = do
diff --git a/src/Machine.hs b/src/Machine.hs
index 23b7872..947d43a 100644
--- a/src/Machine.hs
+++ b/src/Machine.hs
@@ -167,6 +167,7 @@ writeA _ _ = return $ error "Incorrect Address register write"
-------------------------------------------------------------------------------
-- PC Register Access
+
readPC = with pc $ \pc -> do
return pc