diff --git a/app/Assembler.hs b/app/Assembler.hs index da159f3..fe4aa1c 100644 --- a/app/Assembler.hs +++ b/app/Assembler.hs @@ -18,6 +18,9 @@ import Compiler type Bytecode = BL.ByteString +version1 :: Bu.Builder +version1 = P.execPut $ B.putWord8 1 + toBinary :: Command -> P.Put toBinary (Const i) = do P.putWord8 0x0001 @@ -28,4 +31,4 @@ toBinary Mult = P.putWord8 0x0006 toBinary Div = P.putWord8 0x0007 assemble :: [Command] -> Bytecode -assemble cmds = Bu.toLazyByteString $ mconcat (map (P.execPut . toBinary) cmds) +assemble cmds = Bu.toLazyByteString $ mconcat $ version1:map (P.execPut . toBinary) cmds