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

Git rid of all modes of COPY.

This commit is contained in:
Cat's Eye Technologies 2014-04-02 18:00:35 +01:00
parent 40afeae0b6
commit 2684f65512
4 changed files with 9 additions and 11 deletions

View File

@ -69,7 +69,7 @@ noIndexedAccessOfNonTables p@(Program decls routines) =
in
mappedProgram == p
where
checkInstr j@(COPYINDEXED _ (NamedLocation g) _) =
checkInstr j@(COPY _ (Indexed (NamedLocation g) reg)) =
case lookupDecl p g of
Just (Assign _ ByteTable _) -> j
Just (Reserve _ ByteTable) -> j

View File

@ -54,13 +54,13 @@ emitInstr p r (COPY A Y) = "tay"
emitInstr p r (COPY X A) = "txa"
emitInstr p r (COPY Y A) = "tya"
emitInstr p r (COPYINDEXED A (NamedLocation label) X) = "sta " ++ label ++ ", x"
emitInstr p r (COPYINDEXED A (NamedLocation label) Y) = "sta " ++ label ++ ", y"
emitInstr p r (COPY A (Indexed (NamedLocation label) X)) = "sta " ++ label ++ ", x"
emitInstr p r (COPY A (Indexed (NamedLocation label) Y)) = "sta " ++ label ++ ", y"
emitInstr p r (COPYINDEXED (NamedLocation label) A X) = "lda " ++ label ++ ", x"
emitInstr p r (COPYINDEXED (NamedLocation label) A Y) = "lda " ++ label ++ ", y"
emitInstr p r (COPY (Indexed (NamedLocation label) X) A) = "lda " ++ label ++ ", x"
emitInstr p r (COPY (Indexed (NamedLocation label) Y) A) = "lda " ++ label ++ ", y"
emitInstr p r (COPYINDIRECTINDEXED A (NamedLocation label) Y) = "sta (" ++ label ++ "), y"
emitInstr p r (COPY A (IndirectIndexed (NamedLocation label) Y)) = "sta (" ++ label ++ "), y"
emitInstr p r (CMP A (NamedLocation label)) = "cmp " ++ label
emitInstr p r (CMP X (NamedLocation label)) = "cpx " ++ label

View File

@ -59,8 +59,6 @@ data Branch = BCC | BCS | BEQ | BMI | BNE | BPL | BVC | BVS
deriving (Show, Ord, Eq)
data Instruction = COPY StorageLocation StorageLocation
| COPYINDEXED StorageLocation StorageLocation StorageLocation
| COPYINDIRECTINDEXED StorageLocation StorageLocation StorageLocation
| CMPIMM StorageLocation DataValue
| CMP StorageLocation StorageLocation
| ADDIMM StorageLocation DataValue

View File

@ -317,7 +317,7 @@ lda = do
(try $ immediate (\v -> COPY (Immediate v) A) <|> absolute_indexed gen)
where
gen l [] = COPY (NamedLocation l) A
gen l [reg] = COPYINDEXED (NamedLocation l) A reg
gen l [reg] = COPY (Indexed (NamedLocation l) reg) A
ldx :: Parser Instruction
ldx = do
@ -340,8 +340,8 @@ sta = do
indirect_indexed gen
where
gen (Directly l) [] = COPY A (NamedLocation l)
gen (Directly l) [reg] = COPYINDEXED A (NamedLocation l) reg
gen (Indirectly l) [reg] = COPYINDIRECTINDEXED A (NamedLocation l) reg
gen (Directly l) [reg] = COPY A (Indexed (NamedLocation l) reg)
gen (Indirectly l) [reg] = COPY A (IndirectIndexed (NamedLocation l) reg)
stx :: Parser Instruction
stx = do