diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2021-04-02 22:45:20 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2021-04-02 22:45:20 +0300 |
commit | 1ab01adc8644f572d584332c07b2ce75f9aac657 (patch) | |
tree | 6de7f3b0e8a957425d1bc4146df70a7de057e659 /src | |
parent | 6ffbd01052cd989163b49861a4d96e2b551d1c70 (diff) | |
download | suem-1ab01adc8644f572d584332c07b2ce75f9aac657.tar suem-1ab01adc8644f572d584332c07b2ce75f9aac657.tar.xz suem-1ab01adc8644f572d584332c07b2ce75f9aac657.zip |
another fix
Diffstat (limited to 'src')
-rw-r--r-- | src/Machine.hs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/Machine.hs b/src/Machine.hs index 55c5294..443482c 100644 --- a/src/Machine.hs +++ b/src/Machine.hs @@ -365,16 +365,16 @@ getOp 3 ar s = do return (getMemory addr s, setMemory addr s) getOp 4 ar s = do addr <- readA ar 4 - let addr = addr - (fromIntegral s) + let naddr = addr - (fromIntegral s) writeA ar 4 addr - return (getMemory addr s, setMemory addr s) + return (getMemory naddr s, setMemory naddr s) getOp 5 ar s = do pc <- readPC skipOp 2 disp <- getMemory pc 2 addr <- readA ar 4 - let addr = addr + disp - return (getMemory addr s, setMemory addr s) + let naddr = addr + disp + return (getMemory naddr s, setMemory naddr s) getOp 6 ar s = do pc <- readPC skipOp 2 @@ -384,14 +384,14 @@ getOp 6 ar s = do ((extractBits prefix [4] + 1) * 2) disp <- getMemory (pc + 1) 1 addr <- readA ar 4 - let addr = addr + index + disp - return (getMemory addr s, setMemory addr s) + let naddr = addr + index + disp + return (getMemory naddr s, setMemory naddr s) getOp 7 2 s = do addr <- readPC skipOp 2 disp <- getMemory addr 2 - let addr = addr + disp - return (getMemory addr s, setMemory addr s) + let naddr = addr + disp + return (getMemory naddr s, setMemory naddr s) getOp 7 3 s = do addr <- readPC skipOp 2 @@ -400,8 +400,8 @@ getOp 7 3 s = do (extractBits prefix [1..3]) ((extractBits prefix [4] + 1) * 2) disp <- getMemory (addr + 1) 1 - let addr = addr + index + disp - return (getMemory addr s, setMemory addr s) + let naddr = addr + index + disp + return (getMemory naddr s, setMemory naddr s) getOp 7 0 s = do pc <- readPC skipOp 2 @@ -415,5 +415,5 @@ getOp 7 1 s = do getOp 7 4 s = do addr <- readPC skipOp s - let addr = addr + if s == 1 then 1 else 0 - return (getMemory addr s, setMemory addr s) + let naddr = addr + if s == 1 then 1 else 0 + return (getMemory naddr s, setMemory naddr s) |