Make game even more interesting -- 619 bytes.
Cat's Eye Technologies
8 years ago
143 | 143 |
|
144 | 144 |
routine init_game {
|
145 | 145 |
ldy #0
|
|
146 |
ldx #0
|
146 | 147 |
repeat bne {
|
147 | 148 |
copy #$04 >actor_pos, y
|
148 | |
tya
|
149 | |
clc
|
150 | |
asl .a
|
151 | |
asl .a
|
|
149 |
txa
|
152 | 150 |
copy .a <actor_pos, y
|
|
151 |
inx
|
|
152 |
inx
|
|
153 |
inx
|
|
154 |
inx
|
|
155 |
inx
|
|
156 |
inx
|
|
157 |
inx
|
153 | 158 |
|
154 | 159 |
// sigh
|
155 | 160 |
// copy #$0001 actor_delta, y
|
|
164 | 169 |
}
|
165 | 170 |
|
166 | 171 |
iny
|
167 | |
cpy #8
|
|
172 |
cpy #16
|
168 | 173 |
}
|
169 | 174 |
}
|
170 | 175 |
|
171 | 176 |
routine state_title_screen {
|
|
177 |
lda #5
|
|
178 |
sta vic_border
|
|
179 |
lda #0
|
|
180 |
sta vic_bg
|
172 | 181 |
ldy #0
|
173 | 182 |
repeat bne {
|
174 | 183 |
lda press_fire_msg, y
|
|
187 | 196 |
jmp (save_cinv)
|
188 | 197 |
}
|
189 | 198 |
|
|
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 |
|
190 | 208 |
routine logic_player {
|
191 | 209 |
jsr read_stick
|
192 | 210 |
jsr calculate_new_position
|
193 | 211 |
jsr check_new_position_in_bounds
|
194 | 212 |
if bcs {
|
195 | |
lda #32
|
196 | 213 |
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 |
}
|
202 | 227 |
} else { }
|
203 | 228 |
}
|
204 | 229 |
|
|
224 | 249 |
jsr calculate_new_position
|
225 | 250 |
jsr check_new_position_in_bounds
|
226 | 251 |
if bcs {
|
227 | |
lda #32
|
228 | 252 |
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 |
}
|
234 | 266 |
} else {
|
235 | 267 |
jsr reverse_delta
|
236 | 268 |
}
|
|
257 | 289 |
copy delta actor_delta, x
|
258 | 290 |
|
259 | 291 |
inx
|
260 | |
cpx #8
|
|
292 |
cpx #16
|
261 | 293 |
}
|
262 | 294 |
jmp (save_cinv)
|
263 | 295 |
}
|
|
267 | 299 |
}
|
268 | 300 |
|
269 | 301 |
routine main {
|
270 | |
lda #5
|
271 | |
sta vic_border
|
272 | |
lda #0
|
273 | |
sta vic_bg
|
274 | |
|
275 | 302 |
jsr clear_screen
|
276 | 303 |
copy routine state_title_screen to dispatch_state
|
277 | 304 |
|
441 | 441 |
gen (Directly l) [] = COPY (NamedLocation Nothing l) A
|
442 | 442 |
gen (Directly l) [reg] = COPY (Indexed (NamedLocation Nothing l) reg) A
|
443 | 443 |
gen (Indirectly l) [reg] = COPY (IndirectIndexed (NamedLocation Nothing l) reg) A
|
|
444 |
gen x y = error ("Can't parse lda " ++ (show x) ++ (show y))
|
444 | 445 |
|
445 | 446 |
ldx :: Parser Instruction
|
446 | 447 |
ldx = do
|