git @ Cat's Eye Technologies SixtyPical / eec59ac
Make game more interesting (and 544 bytes long...) Cat's Eye Technologies 7 years ago
1 changed file(s) with 35 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1818
1919 reserve vector save_cinv
2020
21 // these are zero-page so that we can use them as indirect addresses
22 // through which we write to screen memory
2123 assign word position $fb
2224 assign word new_position $fd
2325
2628 reserve word compare_target
2729
2830 reserve word[16] actor_pos
31 reserve word[16] actor_delta
2932
3033 reserve vector dispatch_state
3134 reserve vector dispatch_logic
4245 sta >new_position
4346 }
4447
48 // output is carry
4549 routine compare_new_pos {
4650 lda >new_position
4751 cmp >compare_target
5256 }
5357 }
5458
59 // output is carry
5560 routine check_new_position_in_bounds {
5661 copy #$07e8 compare_target // just past bottom of screen
5762 jsr compare_new_pos
9196 }
9297 }
9398
94 routine read_stick {
99 routine read_stick outputs (delta) {
95100 lda #0
96101 sta <delta
97102 sta >delta
144149 asl .a
145150 asl .a
146151 copy .a <actor_pos, y
152
153 // sigh
154 // copy #$0001 actor_delta, y
155 copy #00 >actor_delta, y
156 copy #40 <actor_delta, y
157
147158 iny
148159 cpy #8
149160 }
183194 } else { }
184195 }
185196
197 routine reverse_delta {
198 lda #40
199 cmp <delta
200 if beq {
201 // copy #-40 delta
202 lda #216
203 sta <delta
204 lda #255
205 sta >delta
206 } else {
207 // copy #40 delta
208 lda #40
209 sta <delta
210 lda #0
211 sta >delta
212 }
213 }
214
186215 routine logic_obstacle {
187 lda #0
188 sta >delta
189 lda #1
190 sta <delta
191216 jsr calculate_new_position
192217 jsr check_new_position_in_bounds
193218 if bcs {
198223 lda #82
199224 ldy #0
200225 sta (position), y
201 } else { }
226 } else {
227 jsr reverse_delta
228 }
202229 }
203230
204231 routine indirect_jsr_logic {
212239 stx save_x
213240
214241 copy actor_pos, x position
242 copy actor_delta, x delta
215243
216244 cpx #0
217245 if beq {
223251
224252 ldx save_x
225253 copy position actor_pos, x
254 copy delta actor_delta, x
226255
227256 inx
228257 cpx #8