1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-06-07 22:29:27 +00:00
This commit is contained in:
Cat's Eye Technologies 2014-04-02 09:11:39 +01:00
parent 1aea850043
commit 60287c3850
4 changed files with 37 additions and 4 deletions

View File

@ -217,8 +217,8 @@ In these, `absolute` must be a `reserve`d or `locate`d address.
nop
X ora #immediate
X ora absolute
ora #immediate
ora absolute
X pha { block }
@ -230,8 +230,8 @@ In these, `absolute` must be a `reserve`d or `locate`d address.
X ror
X ror absolute
X sbc #immediate
X sbc absolute
sbc #immediate
sbc absolute
sec
@ -457,6 +457,10 @@ We cannot absolute-indexed a word.
| adc screen
| and #8
| and screen
| sbc #8
| sbc screen
| ora #8
| ora screen
| }
= .org 0
= .word $0801
@ -504,6 +508,10 @@ We cannot absolute-indexed a word.
= adc screen
= and #8
= and screen
= sbc #8
= sbc screen
= ora #8
= ora screen
= rts
| assign word screen 1024

View File

@ -78,6 +78,12 @@ emitInstr p r (ADDIMM A 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 (SUB A (NamedLocation label)) = "sbc " ++ label
emitInstr p r (SUBIMM A 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 (DELTA X 1) = "inx"
emitInstr p r (DELTA X (-1)) = "dex"
emitInstr p r (DELTA Y 1) = "iny"

View File

@ -62,6 +62,10 @@ data Instruction = PUT 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
| JMPVECTOR StorageLocation

View File

@ -94,6 +94,7 @@ command = (try lda) <|>
(try inc) <|> (try dec) <|>
(try clc) <|> (try cld) <|> (try clv) <|> (try sec) <|> (try sed) <|>
(try adc) <|> (try SixtyPical.Parser.and) <|>
(try sbc) <|> (try ora) <|>
(try sei) <|>
(try jmp) <|>
(try copy_vector_statement) <|>
@ -202,6 +203,13 @@ adc = do
(try $ immediate (\v -> ADDIMM A v) <|>
absolute (\l -> ADD A (NamedLocation l)))
sbc :: Parser Instruction
sbc = do
string "sbc"
spaces
(try $ immediate (\v -> SUBIMM A v) <|>
absolute (\l -> SUB A (NamedLocation l)))
and :: Parser Instruction
and = do
string "and"
@ -209,6 +217,13 @@ and = do
(try $ immediate (\v -> ANDIMM A v) <|>
absolute (\l -> AND A (NamedLocation l)))
ora :: Parser Instruction
ora = do
string "ora"
spaces
(try $ immediate (\v -> ORIMM A v) <|>
absolute (\l -> OR A (NamedLocation l)))
immediate :: (DataValue -> Instruction) -> Parser Instruction
immediate f = do
string "#"