diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-09-25 16:41:43 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-09-25 16:41:43 +0100 |
commit | 1e9b8cf5d8eaa2de4f2af799d750cc39a5155ecc (patch) | |
tree | 95831dbe9bade37435c8f42ba87a387b13c883da /src/Micro/Asm/Sdcc.hs | |
parent | 1b74a39a40f5a746e58ef537564cb3986becb668 (diff) | |
download | micro-lang-hs-1e9b8cf5d8eaa2de4f2af799d750cc39a5155ecc.tar.gz micro-lang-hs-1e9b8cf5d8eaa2de4f2af799d750cc39a5155ecc.zip |
Some sub cases
Diffstat (limited to 'src/Micro/Asm/Sdcc.hs')
-rw-r--r-- | src/Micro/Asm/Sdcc.hs | 4 |
1 files changed, 3 insertions, 1 deletions
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]} |