aboutsummaryrefslogtreecommitdiff
path: root/src/Micro/Asm/Sdcc.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-25 18:28:57 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-25 18:28:57 +0100
commit90125e9571b5281bb65c194211fb0c1b948e3393 (patch)
treeb1f0e8f84c0c3296e66eceb85d79ed1d26d9e1a3 /src/Micro/Asm/Sdcc.hs
parent1e9b8cf5d8eaa2de4f2af799d750cc39a5155ecc (diff)
downloadmicro-lang-hs-90125e9571b5281bb65c194211fb0c1b948e3393.tar.gz
micro-lang-hs-90125e9571b5281bb65c194211fb0c1b948e3393.zip
Cases for plus/minus
Diffstat (limited to 'src/Micro/Asm/Sdcc.hs')
-rw-r--r--src/Micro/Asm/Sdcc.hs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/Micro/Asm/Sdcc.hs b/src/Micro/Asm/Sdcc.hs
index 8b7feb7..238fe2e 100644
--- a/src/Micro/Asm/Sdcc.hs
+++ b/src/Micro/Asm/Sdcc.hs
@@ -64,14 +64,12 @@ emit x =
(A.BinOp A.Div _ (A.Num a _) (A.Num b _)) -> o {oCode = [show a ++ "/" ++ show b]}
(A.BinOp A.Plus _ a (A.Num 1 _)) ->
o {oCode = oCode (emit a) ++ ["\tinc a"]}
- (A.BinOp A.Plus _ a@(A.Variable _ _) (A.Num v _)) ->
+ (A.BinOp A.Plus _ a (A.Num v _)) ->
o {oCode = oCode (emit a) ++ ["\tadd #" ++ show v]}
(A.BinOp A.Plus _ a b) ->
o {oCode = oCode (emit a) ++ ["\tld c, a"] ++ oCode (emit b) ++ ["\tadd c"]}
(A.BinOp A.Minus _ a (A.Num 1 _)) ->
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) ->