-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
joystick.asm
384 lines (298 loc) · 5.57 KB
/
joystick.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
//obsługa sterowania
.local joy
tab_spadanie dta a(246),a(246),a(215),a(215),a(160),a(160),a(160),a(160),a(80),a(80),a(40),a(40),a(20),a(20),a(10),a(10)
end_spadanie equ *
LEN_SPADANIE=(end_spadanie-tab_spadanie)/2-1
move_jack
lda spadanie
bne @+
lda sprite_y
cmp #POSY_MAX
bcc *+3
rts
//jack chodzi po rampie
;clc
adc #1
sta cl.sprite0y
lda sprite_x
sta cl.sprite0x
jsr cl.sprawdz_pod_gackiem
bcc *+4
bne *+3
rts
mva #1 spadanie ;jack zszedł z rampy
mva #LEN_SPADANIE predkosc_spadanie
mva #-1 sprite_anim_speed
mva #shp_jstoi sprite_shape
mva #0 ruch_poziom
rts
@ lda predkosc_spadanie
beq @+
lda ramka
and #1
bne @+
dec predkosc_spadanie ;zwieksza predkosc spadania
@ lda spadanie
jmi movej_gora
movej_dol
mva #3 pom0 ;jak szybko spadamy
mvd0 lda predkosc_spadanie
asl
tax
clc
lda sprite_dy
adc tab_spadanie,x
sta pom0a
lda sprite_y
adc tab_spadanie+1,x
sta cl.sprite0y
lda sprite_x
sta cl.sprite0x
jsr cl.sprawdz_pod_gackiem
bcc @+
bne @+
mvd1
mva #0 spadanie ;koniec spadania
sta ruch_poziom
mva #shp_jstoi sprite_shape
lda #1
ldy #fx_ladowanie
jsr sfx.add_fx
rts
@
lda pom0a
sta sprite_dy
lda cl.sprite0y
sta sprite_y
dec pom0
bne mvd0
rts
tab_lot dta a(12),a(24),a(48),a(48),a(96),a(96),a(192),a(340)
joystick_down
lda porta
and #15
cmp #13
beq @+1
@ rts
@
lda spadanie
bmi mvg1b
lda predkosc_spadanie
beq @+
dec predkosc_spadanie
@ rts
mvg1
lda #1
jsr score_add ;punkty po uderzeniu
jsr zmien_kolor_P
lda #1
ldy #fx_uderzenie
jsr sfx.add_fx
mvg1b
mva #1 spadanie ;koniec ekranu , zaczyna się spadanie
mva #LEN_SPADANIE predkosc_spadanie
mva #shp_jdol_srodek sprite_shape
mva #0 ruch_poziom
rts
movej_gora mva #3 pom0
mvg0
@ dec wysokosc_lotu
beq mvg1b
lda wysokosc_lotu
_lot16 cmp #LOT_START-16
bcc @+
eor #255
_lot1 adc #LOT_START-1
lsr
jmp @+1
@ lsr
lsr
lsr
cmp #8
bcc @+
lda #7
@ asl
tax
sec
lda sprite_dy
sbc tab_lot,x
sta pom0a
lda sprite_y
sbc tab_lot+1,x
sta cl.sprite0y
lda sprite_x
sta cl.sprite0x
jsr cl.sprawdz_nad_gackiem
beq mvg1
mva cl.sprite0y sprite_y
mva pom0a sprite_dy
dec pom0
bne mvg0
rts
fire
lda trig0
cmp trig0s
beq @+
cmp #0
sta trig0s
beq @+1
lda spadanie
bpl @+
lda wysokosc_lotu
cmp #120-40
bcc @+
mva #120-40 wysokosc_lotu
@ rts
@ lda spadanie
beq lot_w_gore1
mva #LEN_SPADANIE predkosc_spadanie ;zmniejsz poczatkowa predkosc spadania
mva #0 ruch_poziom
mva #1 spadanie
rts
LOT_START=246
zmien_kolor_P
lda kolor_P
beq @+ ;=0 nie ma paralizu
clc
adc #1
cmp #8
bne *+4
lda #1
sta kolor_P ;od 1 do 7
tax
lda paraliz_tab0,x
sta sprite_c0+7
lda paraliz_tab1,x
sta sprite_c1+7
@ rts
lot_w_gore1
lda #1
jsr score_add ;punkty po uderzeniu
jsr zmien_kolor_P
lot_w_gore
ldx sprite_y
dex
stx cl.sprite0y
mva sprite_x cl.sprite0x
jsr cl.sprawdz_nad_gackiem
beq @+
;jsr cl.sprite_vs_rampa ;sprawdz czy mozna lecieć w górę.
;bpl @+
_lot0 mva #LOT_START wysokosc_lotu
mva sprite_shape last_shape
mva #-1 spadanie
mva #-1 sprite_anim_speed ;nie animuj postaci
mva #shp_jgora_srodek sprite_shape
mva #0 ruch_poziom
@ rts
joy_tab0 dta shp_jgora_srodek,shp_jstoi,shp_jdol_srodek
joystick
lda porta
and #$0c
cmp #$0c
bne @+1
mva #-1 sprite_anim_speed
mva #0 ruch_poziom
ldy spadanie
beq @+
iny
lda joy_tab0,y
sta sprite_shape
sta sprite_shape0
@ rts
@ bit bit2 ;lewo
jne @+1
lda ruch_poziom
cmp #1
beq @+
lda spadanie
beq j0
bpl j2
mva #shp_jgora_lewo sprite_shape
sta sprite_shape0
mva #-1 sprite_anim_speed
jmp j1
j2 mva #shp_jdol_lewo sprite_shape
sta sprite_shape0
mva #-1 sprite_anim_speed
jmp j1
j0 mva #shp_jlewo sprite_shape
sta sprite_shape0
mva #3 sprite_anim_speed
mva #%11 sprite_mask
j1 mva #1 ruch_poziom
@
sec
lda sprite_dx
jlewo_m sbc #0
sta pom0a
lda sprite_x
jlewo_s sbc #1
sta cl.sprite0x
lda sprite_y
sta cl.sprite0y
jsr cl.sprawdz_lewo_gacek
beq j10
lda pom0a
sta sprite_dx
lda cl.sprite0x
sta sprite_x
lda sprite_shape0
cmp #shp_jlewo
bne j10
ldy #fx_krok
lda #0
jsr sfx.add_fx
j10 rts
@ bit bit3
beq *+3
rts
lda ruch_poziom ;prawo
cmp #2
beq @+
lda spadanie
beq j3
bpl j4
mva #shp_jgora_prawo sprite_shape
sta sprite_shape0
mva #-1 sprite_anim_speed
jmp j5
j4 mva #shp_jdol_prawo sprite_shape
sta sprite_shape0
mva #-1 sprite_anim_speed
jmp j5
j3 mva #shp_jprawo sprite_shape
sta sprite_shape0
mva #3 sprite_anim_speed
mva #%11 sprite_mask
j5 mva #2 ruch_poziom
@
clc
lda sprite_dx
jprawo_m adc #0
sta pom0a
lda sprite_x
jprawo_s adc #1
sta cl.sprite0x
;ldy sprite_x
;iny
;sty cl.sprite0x
lda sprite_y
sta cl.sprite0y
jsr cl.sprawdz_prawo_gacek
beq j50
;jsr cl.sprite_vs_rampa
;bpl j50
lda pom0a
sta sprite_dx
lda cl.sprite0x
sta sprite_x
;inc sprite_x
lda sprite_shape0
cmp #shp_jprawo
bne j50
ldy #fx_krok
lda #0
jsr sfx.add_fx
j50 rts
.endl