aboutsummaryrefslogtreecommitdiff
path: root/src/Machine.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Machine.hs')
-rw-r--r--src/Machine.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Machine.hs b/src/Machine.hs
index 443482c..b254f7e 100644
--- a/src/Machine.hs
+++ b/src/Machine.hs
@@ -417,3 +417,16 @@ getOp 7 4 s = do
skipOp s
let naddr = addr + if s == 1 then 1 else 0
return (getMemory naddr s, setMemory naddr s)
+
+-------------------------------------------------------------------------------
+-- Size converter
+
+getSize :: Int -> Int
+getSize 0 = 1
+getSize 1 = 2
+getSize 2 = 4
+
+getMoveSize :: Int -> Int
+getMoveSize 1 = 1
+getMoveSize 3 = 2
+getMoveSize 2 = 4