ding
[cc1516.git] / gen.icl
diff --git a/gen.icl b/gen.icl
index 9f515c9..0707984 100644 (file)
--- a/gen.icl
+++ b/gen.icl
@@ -187,16 +187,19 @@ funnyStuff k es fs = getAdressbook >>= \ab->case 'Map'.get k ab of
        //Identifier points to function
        Just (LAB l arity fn) = if (arity <> (length es))
                //Function is not complete
-               (       tell
+               (       mapM_ g es
+                       >>| tell
                                [Instr "ldc" [Lit fn] "Store function number"
                                ,Instr "sth" [] ""
+                               ,Instr "str" [Raw "R7"] ""
                                ,Instr "ldc" [Lit $ length es] "Store arity"
                                ,Instr "sth" [] ""
-                               ,Instr "ajs" [Lit -1] ""]
-                       >>| mapM_ g es
+                               ,Instr "ajs" [Lit -1] ""
+                               ]
                        >>| if (isEmpty es) (pure ()) (tell 
                                [Instr "stmh" [Lit $ length es] "Store arguments"
-                               ,Instr "ajs" [Lit -1] ""]))
+                               ,Instr "ajs" [Lit -1] ""
+                               ,Instr "ldr" [Raw "R7"] ""]))
                //Function is complete
                (       mapM_ g es
                        >>| getAdressbook >>= \ab->(case 'Map'.get k ab of