1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-06-26 16:29:28 +00:00

Get rid of more IMM commands.

This commit is contained in:
Cat's Eye Technologies 2014-04-02 18:03:25 +01:00
parent 2684f65512
commit 7fb454fb99
3 changed files with 14 additions and 19 deletions

View File

@ -66,21 +66,21 @@ emitInstr p r (CMP A (NamedLocation label)) = "cmp " ++ label
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"

View File

@ -59,15 +59,10 @@ data Branch = BCC | BCS | BEQ | BMI | BNE | BPL | BVC | BVS
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

View File

@ -265,49 +265,49 @@ cmp :: Parser Instruction
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