diff --git a/src/SixtyPical/Emitter.hs b/src/SixtyPical/Emitter.hs index f368f46..fda1b06 100644 --- a/src/SixtyPical/Emitter.hs +++ b/src/SixtyPical/Emitter.hs @@ -66,21 +66,21 @@ emitInstr p r (CMP X (NamedLocation label)) = "cpx " ++ label emitInstr p r (CMP Y (NamedLocation label)) = "cpy " ++ label -emitInstr p r (CMPIMM A val) = "cmp #" ++ (show val) -emitInstr p r (CMPIMM X val) = "cpx #" ++ (show val) -emitInstr p r (CMPIMM Y val) = "cpy #" ++ (show val) +emitInstr p r (CMP A (Immediate val)) = "cmp #" ++ (show val) +emitInstr p r (CMP X (Immediate val)) = "cpx #" ++ (show val) +emitInstr p r (CMP Y (Immediate val)) = "cpy #" ++ (show val) emitInstr p r (ADD A (NamedLocation label)) = "adc " ++ label -emitInstr p r (ADDIMM A val) = "adc #" ++ (show val) +emitInstr p r (ADD A (Immediate val)) = "adc #" ++ (show val) emitInstr p r (AND A (NamedLocation label)) = "and " ++ label -emitInstr p r (ANDIMM A val) = "and #" ++ (show val) +emitInstr p r (AND A (Immediate val)) = "and #" ++ (show val) emitInstr p r (SUB A (NamedLocation label)) = "sbc " ++ label -emitInstr p r (SUBIMM A val) = "sbc #" ++ (show val) +emitInstr p r (SUB A (Immediate val)) = "sbc #" ++ (show val) emitInstr p r (OR A (NamedLocation label)) = "ora " ++ label -emitInstr p r (ORIMM A val) = "ora #" ++ (show val) +emitInstr p r (OR A (Immediate val)) = "ora #" ++ (show val) emitInstr p r (DELTA X 1) = "inx" emitInstr p r (DELTA X (-1)) = "dex" diff --git a/src/SixtyPical/Model.hs b/src/SixtyPical/Model.hs index 9513a92..7d7f4a7 100644 --- a/src/SixtyPical/Model.hs +++ b/src/SixtyPical/Model.hs @@ -59,15 +59,10 @@ deriving (Show, Ord, Eq) data Instruction = COPY StorageLocation StorageLocation - | CMPIMM StorageLocation DataValue | CMP StorageLocation StorageLocation - | ADDIMM StorageLocation DataValue | ADD StorageLocation StorageLocation - | ANDIMM StorageLocation DataValue | AND StorageLocation StorageLocation - | SUBIMM StorageLocation DataValue | SUB StorageLocation StorageLocation - | ORIMM StorageLocation DataValue | OR StorageLocation StorageLocation | JSR RoutineName -- | JSRVECTOR StorageLocation diff --git a/src/SixtyPical/Parser.hs b/src/SixtyPical/Parser.hs index 916131b..607b397 100644 --- a/src/SixtyPical/Parser.hs +++ b/src/SixtyPical/Parser.hs @@ -265,49 +265,49 @@ cmp = do string "cmp" spaces - (try $ immediate (\v -> CMPIMM A v) <|> + (try $ immediate (\v -> CMP A (Immediate v)) <|> absolute (\l -> CMP A (NamedLocation l))) cpx :: Parser Instruction cpx = do string "cpx" spaces - (try $ immediate (\v -> CMPIMM X v) <|> + (try $ immediate (\v -> CMP X (Immediate v)) <|> absolute (\l -> CMP X (NamedLocation l))) cpy :: Parser Instruction cpy = do string "cpy" spaces - (try $ immediate (\v -> CMPIMM Y v) <|> + (try $ immediate (\v -> CMP Y (Immediate v)) <|> absolute (\l -> CMP Y (NamedLocation l))) adc :: Parser Instruction adc = do string "adc" spaces - (try $ immediate (\v -> ADDIMM A v) <|> + (try $ immediate (\v -> ADD A (Immediate v)) <|> absolute (\l -> ADD A (NamedLocation l))) sbc :: Parser Instruction sbc = do string "sbc" spaces - (try $ immediate (\v -> SUBIMM A v) <|> + (try $ immediate (\v -> SUB A (Immediate v)) <|> absolute (\l -> SUB A (NamedLocation l))) and :: Parser Instruction and = do string "and" spaces - (try $ immediate (\v -> ANDIMM A v) <|> + (try $ immediate (\v -> AND A (Immediate v)) <|> absolute (\l -> AND A (NamedLocation l))) ora :: Parser Instruction ora = do string "ora" spaces - (try $ immediate (\v -> ORIMM A v) <|> + (try $ immediate (\v -> OR A (Immediate v)) <|> absolute (\l -> OR A (NamedLocation l))) lda :: Parser Instruction