+ ( fresh >>= \finish->
+ fresh >>= \start->
+ tell
+ [Instr "ldl" [Lit t] ""
+ ,Instr "ldma" [Lit 0, Lit 2] "Load funcall and arity"
+ ,Instr "ldc" [Lit $ length es] "Push extra arity on stack"
+ ,Instr "add" [] "Increase arity"
+ ,Instr "ldl" [Lit t] ""
+ ,Instr "ldh" [Lit 1] "Load available arguments"
+ ,Instr "str" [Raw "R5"] "Save available arguments"
+ ,Lab start
+ ,Instr "ldr" [Raw "R5"] "Load available arguments"
+ ,Instr "ldc" [Lit 0] ""
+ ,Instr "eq" [] ""
+ ,Instr "brt" [L finish] ""
+ ,Instr "ldc" [Lit 1] "Decrement available arguments"
+ ,Instr "sub" [] ""
+ ,Instr "str" [Raw "R5"] "Push available arguments"
+ ,Instr "bra" [L start] ""
+ ,Lab finish
+ ]
+ >>| mapM_ g es )
+ ( fresh >>= \finish->
+ fresh >>= \start->
+ tell
+ [Instr "ldl" [Lit t] ""
+ ,Instr "ldh" [Lit 1] "Load available arguments"
+ ,Instr "str" [Raw "R5"] "Store available args in register"
+ ,Instr "ldc" [Lit 0] "Store offset"
+ ,Instr "str" [Raw "R6"] "Store offset in register"
+
+ ,Lab start
+ ,Instr "ldr" [Raw "R5"] ""
+ ,Instr "ldc" [Lit 0] ""
+ ,Instr "eq" [] ""
+ ,Instr "brt" [L finish] "Done pushing arg, bye"
+ //Load heapadress
+ ,Instr "ldl" [Lit t] ""
+ ,Instr "ldr" [Raw "R6"] ""
+ ,Instr "add" [] "Corrected heapaddress"
+ ,Instr "ldh" [Lit 2] "Load argument"
+ //Decrease available arguments
+ ,Instr "ldr" [Raw "R5"] ""
+ ,Instr "ldc" [Lit 1] ""
+ ,Instr "sub" [] ""
+ ,Instr "str" [Raw "R5"] ""
+ //Increase available arguments
+ ,Instr "ldr" [Raw "R6"] ""
+ ,Instr "ldc" [Lit 1] ""
+ ,Instr "add" [] ""
+ ,Instr "str" [Raw "R6"] ""
+ ,Instr "bra" [L start] ""
+ ,Lab finish
+ ]
+ >>| mapM_ g es
+ >>| tell
+ [Instr "ldl" [Lit t] ""
+ ,Instr "ldh" [Lit 0] "Get function number"
+ ,Instr "str" [Raw "R5"] ""
+ ,Instr "bsr" [L "1func"] ""
+ ,Instr "ldr" [Raw "MP"] ""
+ ,Instr "ldc" [Lit t] ""
+ ,Instr "add" [] ""
+ ,Instr "str" [Raw "SP"] ""
+ ,Instr "ldr" [Raw "RR"] ""
+ ]
+ )