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

Immediate, or register, on LHS of copy command.

This commit is contained in:
Cat's Eye Technologies 2014-04-13 12:12:53 +01:00
parent 26448ccce5
commit 13d38dc45f
3 changed files with 22 additions and 7 deletions

View File

@ -137,19 +137,14 @@ routine check_fire {
}
routine init_game {
// this shouldn't be needed!
reserve byte temp_a
ldy #0
repeat bne {
lda #$04
sta temp_a
copy temp_a >actor_pos, y
copy #$04 >actor_pos, y
tya
clc
asl .a
asl .a
sta temp_a
copy temp_a <actor_pos, y
copy .a <actor_pos, y
iny
cpy #8
}

View File

@ -119,6 +119,24 @@ emitInstr p r (COPY (NamedLocation (Just Byte) src)
"lda " ++ src ++ "\n" ++
" sta " ++ dst ++ "_hi, " ++ (regName reg)
emitInstr p r (COPY (Immediate value)
(LowByteOf (Indexed (NamedLocation (Just (Table Word _)) dst) reg))) =
"lda #" ++ (show value) ++ "\n" ++
" sta " ++ dst ++ "_lo, " ++ (regName reg)
emitInstr p r (COPY (Immediate value)
(HighByteOf (Indexed (NamedLocation (Just (Table Word _)) dst) reg))) =
"lda #" ++ (show value) ++ "\n" ++
" sta " ++ dst ++ "_hi, " ++ (regName reg)
emitInstr p r (COPY A
(LowByteOf (Indexed (NamedLocation (Just (Table Word _)) dst) reg))) =
"sta " ++ dst ++ "_lo, " ++ (regName reg)
emitInstr p r (COPY A
(HighByteOf (Indexed (NamedLocation (Just (Table Word _)) dst) reg))) =
"sta " ++ dst ++ "_hi, " ++ (regName reg)
emitInstr p r (COPY (LowByteOf (Indexed (NamedLocation (Just (Table Word _)) src) reg))
(NamedLocation (Just Byte) dst)) =
"lda " ++ src ++ "_lo, " ++ (regName reg) ++ "\n" ++

View File

@ -577,9 +577,11 @@ copy_general_statement = do
nspaces
src <- (immediate <|>
register_location <|>
low_byte_of_absolute <|> high_byte_of_absolute <|> direct_location)
srcI <- many index
lhs <- return $ case (src, srcI) of
((Implicitly reg), []) -> reg
((Immediately s), []) -> (Immediate s)
((Directly s), []) -> (NamedLocation Nothing s)
((Directly s), [reg]) -> (Indexed (NamedLocation Nothing s) reg)