From 7a2a25ce5d5d39ca0edbf69547587c1cf543ad88 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Wed, 3 Nov 2010 19:49:22 +0100 Subject: [PATCH] 3a_asm: print no debug msgs by default the switch '-d' force the assembler to be more verbose --- 3a_asm/Main.hs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/3a_asm/Main.hs b/3a_asm/Main.hs index f3a6fc1..974cbd4 100644 --- a/3a_asm/Main.hs +++ b/3a_asm/Main.hs @@ -1,6 +1,6 @@ -- as for deep thoughts ISA ----------------------------------------------------------------------------- -import DT +import DT hiding (not) import DTFormat import Expr_eval @@ -25,12 +25,16 @@ main = do content <- getContents let src = (filter (((/=) "") . snd) $ (zip [1..] (lines content))) let (dict,formatedsrc) = convertDTF src NoState 0x00 0x00 [("start_",0x00)] - printf "\nlabels:\n" - sequence_ [printf "%20s @ 0x%08x\n" l a | (l,a) <- (reverse dict)] - printf "\nparsed asm:\n" - sequence_ [printf "%s" (show x) | x <- formatedsrc] + if (not $ null args) && (head args == "-d") + then do + printf "\nlabels:\n" + sequence_ [printf "%20s @ 0x%08x\n" l a | (l,a) <- (reverse dict)] + printf "\nparsed asm:\n" + sequence_ [printf "%s" (show x) | x <- formatedsrc] + printf "\nafter parsing the instructions:\n" + else do + printf "" let parsed = parseInstr dict formatedsrc - printf "\nafter parsing the instructions:\n" sequence_ [printf "%s" (show x) | x <- parsed] -- 2.25.1