1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-12-23 21:33:05 +00:00

Support for all instructions!

This commit is contained in:
Cat's Eye Technologies 2014-04-03 18:59:37 +01:00
parent 571b3d403b
commit f4a77ae5c4
3 changed files with 27 additions and 2 deletions

View File

@ -134,6 +134,16 @@ emitInstr p r (SEI blk) =
emitInstrs p r blk ++
" cli"
emitInstr p r (PUSH A blk) =
"pha\n" ++
emitInstrs p r blk ++
" pla"
emitInstr p r (PUSH FlagC blk) =
"php\n" ++
emitInstrs p r blk ++
" plp"
emitInstr p r (COPYVECTOR (NamedLocation (Just Vector) src) (NamedLocation (Just Vector) dst)) =
"lda " ++ src ++ "\n" ++
" sta " ++ dst ++ "\n" ++

View File

@ -77,6 +77,7 @@ data Instruction = COPY StorageLocation StorageLocation
| REPEAT InternalID Branch [Instruction]
| DELTA StorageLocation DataValue
| SEI [Instruction]
| PUSH StorageLocation [Instruction]
| COPYVECTOR StorageLocation StorageLocation
| COPYROUTINE RoutineName StorageLocation
| NOP

View File

@ -27,7 +27,7 @@ Command := "if" Branch Block "else" Block
| "cpy" (LocationName | Immediate)
| "inx" | "iny" | "dex" | "dey" | "inc" Location | "dec" Location
| "clc" | "cld" | "clv" | "sec" | "sed"
| "sei" Block
| "sei" Block | "pha" Block | "php" Block
| "jmp" LocationName
| "jsr" RoutineName
| "nop".
@ -196,7 +196,7 @@ command = (try lda) <|>
(try sbc) <|> (try ora) <|>
(try asl) <|> (try bit) <|> (try eor) <|> (try lsr) <|>
(try rol) <|> (try ror) <|>
(try sei) <|>
(try sei) <|> (try pha) <|> (try php) <|>
(try jmp) <|> (try jsr) <|>
(try copy_vector_statement) <|>
(try copy_routine_statement) <|>
@ -486,6 +486,20 @@ sei = do
blk <- block
return (SEI blk)
pha :: Parser Instruction
pha = do
string "pha"
spaces
blk <- block
return (PUSH A blk)
php :: Parser Instruction
php = do
string "php"
spaces
blk <- block
return (PUSH FlagC blk)
jmp :: Parser Instruction
jmp = do
string "jmp"