From 1e9b8cf5d8eaa2de4f2af799d750cc39a5155ecc Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 25 Sep 2022 16:41:43 +0100 Subject: Some sub cases --- src/Micro/Asm/Sdcc.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Micro/Asm/Sdcc.hs b/src/Micro/Asm/Sdcc.hs index 8a2f26a..8b7feb7 100644 --- a/src/Micro/Asm/Sdcc.hs +++ b/src/Micro/Asm/Sdcc.hs @@ -72,8 +72,10 @@ emit x = o {oCode = oCode (emit a) ++ ["\tdec a"]} (A.BinOp A.Minus _ a@(A.Variable _ _) (A.Num v _)) -> o {oCode = oCode (emit a) ++ ["\tsub #" ++ show v]} + (A.BinOp A.Minus _ a (A.Num v _)) -> + o {oCode = oCode (emit a) ++ ["\tsub #" ++ show v]} (A.BinOp A.Minus _ a b) -> - o {oCode = oCode (emit a) ++ ["\tld c, a"] ++ oCode (emit b) ++ ["\tsub c"]} + o {oCode = oCode (emit a) ++ ["\tld c, a"] ++ oCode (emit b) ++ ["\tld b, a", "\tld a, c", "\tsub b"]} (A.BinOp A.Assign _ (A.Variable id _) b) -> o {oCode = oCode (emit b) ++ ["\tld (" ++ toIdent id ++ "), a"]} _ -> o {oCode = [";; unimplemented " ++ show x]} -- cgit v1.2.3