git @ Cat's Eye Technologies SixtyPical / 730f9f1
Make game even more interesting -- 619 bytes. Cat's Eye Technologies 8 years ago
2 changed file(s) with 51 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
143143
144144 routine init_game {
145145 ldy #0
146 ldx #0
146147 repeat bne {
147148 copy #$04 >actor_pos, y
148 tya
149 clc
150 asl .a
151 asl .a
149 txa
152150 copy .a <actor_pos, y
151 inx
152 inx
153 inx
154 inx
155 inx
156 inx
157 inx
153158
154159 // sigh
155160 // copy #$0001 actor_delta, y
164169 }
165170
166171 iny
167 cpy #8
172 cpy #16
168173 }
169174 }
170175
171176 routine state_title_screen {
177 lda #5
178 sta vic_border
179 lda #0
180 sta vic_bg
172181 ldy #0
173182 repeat bne {
174183 lda press_fire_msg, y
187196 jmp (save_cinv)
188197 }
189198
199 routine state_game_over {
200 inc vic_border
201 jsr check_fire
202 if beq {
203 copy routine state_title_screen to dispatch_state
204 } else { }
205 jmp (save_cinv)
206 }
207
190208 routine logic_player {
191209 jsr read_stick
192210 jsr calculate_new_position
193211 jsr check_new_position_in_bounds
194212 if bcs {
195 lda #32
196213 ldy #0
197 sta (position), y
198 copy new_position position
199 lda #81
200 ldy #0
201 sta (position), y
214 lda (new_position), y
215 cmp #32
216 if beq {
217 lda #32
218 ldy #0
219 sta (position), y
220 copy new_position position
221 lda #81
222 ldy #0
223 sta (position), y
224 } else {
225 // copy routine state_game_over to dispatch_state
226 }
202227 } else { }
203228 }
204229
224249 jsr calculate_new_position
225250 jsr check_new_position_in_bounds
226251 if bcs {
227 lda #32
228252 ldy #0
229 sta (position), y
230 copy new_position position
231 lda #82
232 ldy #0
233 sta (position), y
253 lda (new_position), y
254 cmp #32
255 if beq {
256 lda #32
257 ldy #0
258 sta (position), y
259 copy new_position position
260 lda #82
261 ldy #0
262 sta (position), y
263 } else {
264 copy routine state_game_over to dispatch_state
265 }
234266 } else {
235267 jsr reverse_delta
236268 }
257289 copy delta actor_delta, x
258290
259291 inx
260 cpx #8
292 cpx #16
261293 }
262294 jmp (save_cinv)
263295 }
267299 }
268300
269301 routine main {
270 lda #5
271 sta vic_border
272 lda #0
273 sta vic_bg
274
275302 jsr clear_screen
276303 copy routine state_title_screen to dispatch_state
277304
441441 gen (Directly l) [] = COPY (NamedLocation Nothing l) A
442442 gen (Directly l) [reg] = COPY (Indexed (NamedLocation Nothing l) reg) A
443443 gen (Indirectly l) [reg] = COPY (IndirectIndexed (NamedLocation Nothing l) reg) A
444 gen x y = error ("Can't parse lda " ++ (show x) ++ (show y))
444445
445446 ldx :: Parser Instruction
446447 ldx = do