aboutsummaryrefslogtreecommitdiff
path: root/src/Micro/Asm/Sdcc.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-25 16:15:08 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-25 16:15:08 +0100
commit1b74a39a40f5a746e58ef537564cb3986becb668 (patch)
treeb0ced508f539d409b795d19ffed04290a72ee981 /src/Micro/Asm/Sdcc.hs
parent139f9d9e354eaeb6e9f1ebf6bc5abe2e903a55e2 (diff)
downloadmicro-lang-hs-1b74a39a40f5a746e58ef537564cb3986becb668.tar.gz
micro-lang-hs-1b74a39a40f5a746e58ef537564cb3986becb668.zip
Clean up
Diffstat (limited to 'src/Micro/Asm/Sdcc.hs')
-rw-r--r--src/Micro/Asm/Sdcc.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Micro/Asm/Sdcc.hs b/src/Micro/Asm/Sdcc.hs
index b582819..8a2f26a 100644
--- a/src/Micro/Asm/Sdcc.hs
+++ b/src/Micro/Asm/Sdcc.hs
@@ -51,7 +51,7 @@ emit x =
(A.Module name _) -> o {oPre = [module' name, optsdcc, ""]}
(A.Var id typ val priv False _) ->
o
- { oPre = if priv then [] else [globl $ toIdent id],
+ { oPre = [globl $ toIdent id | not priv],
oData = [toLabel id priv, "\t" ++ toData typ],
oInit = ["__init" ++ toLabel id True, "\t" ++ toInit typ val]
}
@@ -82,9 +82,9 @@ emit x =
generate :: String -> [A.Expr] -> String
generate version ast = do
- out <- pure $ map emit ast
- pre <- pure $ concat $ map oPre out
- dat <- pure $ [area "_DATA", area "_INITIALIZED"] ++ concat (map oData out)
- code <- pure $ [area "_CODE"] ++ concat (map oCode out) ++ ["hlt0:", "\tjr hlt0"]
- init <- pure $ [area "_INITIALIZER"] ++ concat (map oInit out) ++ [area "_GSINIT", area "_GSFINAL"]
+ let out = map emit ast
+ let pre = concatMap oPre out
+ let dat = [area "_DATA", area "_INITIALIZED"] ++ concatMap oData out
+ let code = [area "_CODE"] ++ concatMap oCode out ++ ["hlt0:", "\tjr hlt0"]
+ let init = [area "_INITIALIZER"] ++ concatMap oInit out ++ [area "_GSINIT", area "_GSFINAL"]
unlines $ header version ++ pre ++ dat ++ code ++ init