From 1b74a39a40f5a746e58ef537564cb3986becb668 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 25 Sep 2022 16:15:08 +0100 Subject: Clean up --- src/Micro/Asm/Sdcc.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Micro/Asm/Sdcc.hs') 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 -- cgit v1.2.3