git @ Cat's Eye Technologies SixtyPical / 13d38dc
Immediate, or register, on LHS of `copy` command. Cat's Eye Technologies 8 years ago
3 changed file(s) with 22 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
136136 }
137137
138138 routine init_game {
139 // this shouldn't be needed!
140 reserve byte temp_a
141139 ldy #0
142140 repeat bne {
143 lda #$04
144 sta temp_a
145 copy temp_a >actor_pos, y
141 copy #$04 >actor_pos, y
146142 tya
147143 clc
148144 asl .a
149145 asl .a
150 sta temp_a
151 copy temp_a <actor_pos, y
146 copy .a <actor_pos, y
152147 iny
153148 cpy #8
154149 }
118118 "lda " ++ src ++ "\n" ++
119119 " sta " ++ dst ++ "_hi, " ++ (regName reg)
120120
121 emitInstr p r (COPY (Immediate value)
122 (LowByteOf (Indexed (NamedLocation (Just (Table Word _)) dst) reg))) =
123 "lda #" ++ (show value) ++ "\n" ++
124 " sta " ++ dst ++ "_lo, " ++ (regName reg)
125
126 emitInstr p r (COPY (Immediate value)
127 (HighByteOf (Indexed (NamedLocation (Just (Table Word _)) dst) reg))) =
128 "lda #" ++ (show value) ++ "\n" ++
129 " sta " ++ dst ++ "_hi, " ++ (regName reg)
130
131 emitInstr p r (COPY A
132 (LowByteOf (Indexed (NamedLocation (Just (Table Word _)) dst) reg))) =
133 "sta " ++ dst ++ "_lo, " ++ (regName reg)
134
135 emitInstr p r (COPY A
136 (HighByteOf (Indexed (NamedLocation (Just (Table Word _)) dst) reg))) =
137 "sta " ++ dst ++ "_hi, " ++ (regName reg)
138
121139 emitInstr p r (COPY (LowByteOf (Indexed (NamedLocation (Just (Table Word _)) src) reg))
122140 (NamedLocation (Just Byte) dst)) =
123141 "lda " ++ src ++ "_lo, " ++ (regName reg) ++ "\n" ++
576576 nspaces
577577
578578 src <- (immediate <|>
579 register_location <|>
579580 low_byte_of_absolute <|> high_byte_of_absolute <|> direct_location)
580581 srcI <- many index
581582 lhs <- return $ case (src, srcI) of
583 ((Implicitly reg), []) -> reg
582584 ((Immediately s), []) -> (Immediate s)
583585 ((Directly s), []) -> (NamedLocation Nothing s)
584586 ((Directly s), [reg]) -> (Indexed (NamedLocation Nothing s) reg)