3a_asm: parse even more :>
[calu.git] / 3a_asm / DTFormat.hs
index aad67e01bab02379c123a573f9451e2942d1ceba..1c8d809331478d002696eef2db6e25cf73e3d2f7 100644 (file)
@@ -3,6 +3,8 @@ module DTFormat where
 import Data.Word
 import Text.Printf
 
+data DT_State = NoState | InData | InText deriving (Show,Eq)
+
 type Address = Word32
 type Value = Word32
 type ValueToParse = String
@@ -14,10 +16,12 @@ data DTF =
        DTF_Data Address Value Code Label Comment |
        DTF_Instr Address Value Code Label Comment |
        DTF_Comment Comment |
-       DTF_Label Label |
+       DTF_Label Label Comment Address |
        -- types for intern processing
-       DTF_ToParse Address ValueToParse Code Label Comment |
-       DTF_Org Address
+       DTF_InstrToParse Address ValueToParse Code Label Comment |
+       DTF_SectionToDet Address Value Code Label Comment |
+       DTF_Org Address |
+       DTF_State DT_State
 
 instance Show (DTF) where
        showsPrec n = showsDTF
@@ -26,9 +30,11 @@ showsDTF :: DTF -> ShowS
 showsDTF (DTF_Data a v c l s) = (++) (datins "0" a v c l s)
 showsDTF (DTF_Instr a v c l s) = (++) (datins "1" a v c l s)
 showsDTF (DTF_Comment c) = (++) (printf "2;%s\n" c)
-showsDTF (DTF_Label l) = (++) (printf "3;%s\n" l)
-showsDTF (DTF_ToParse a v c l s) = (++) (printf "lulz\n")
-
+showsDTF (DTF_Label l c _) = (++) (printf "3;%s;%s\n" l c)
+showsDTF (DTF_InstrToParse a v c l s) = (++) (printf "itp;%08x;%s;%s;%s;%s\n" a v c l s)
+showsDTF (DTF_SectionToDet a v c l s) = (++) (datins "std" a v c l s)
+showsDTF (DTF_Org a) = (++) (printf "org;%08x\n" a)
+showsDTF (DTF_State s) = (++) (printf "sta;%s\n" (show s))
 
 datins :: String -> Address -> Value -> Code -> Label -> Comment -> String
 datins = printf "%s;%08x;%08x;%s;%s;%s\n"