/[projet1]/public/oric/demos/buggy_boy/LcpIntro/filler.s
Defence Force logotype

Contents of /public/oric/demos/buggy_boy/LcpIntro/filler.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 903 - (show annotations)
Sun Jan 13 15:30:30 2013 UTC (6 years, 10 months ago) by dbug
File size: 4944 byte(s)
Added the Buggy Boy demo.
Please note that the building of the DSK file requires working versions of Tap2Dsk and Old2Mfm, they may not work on recent windows versions.
1
2
3
4
5 .zero
6
7 _FlagFirst .dsb 1
8 _X0 .dsb 1
9 _Y0 .dsb 1
10 _X1 .dsb 1
11 _Y1 .dsb 1
12
13 .text
14
15
16 #define _PolyY0 tmp7
17 #define _PolyY1 tmp7+1
18
19
20 #define _S0 tmp1
21 #define _S1 tmp1+1
22 #define _B0 tmp1+2
23 #define _B1 tmp1+3
24
25 #define _DY tmp1
26 #define _DX tmp2
27
28 #define _E tmp3
29
30 .dsb 256-(*&255)
31
32
33
34
35 _FillTablesASM
36 .(
37 //
38 // Compute the screen start adress
39 //
40 ldy _PolyY0
41 lda _HiresAddrLow,y
42 sta tmp0+0
43 lda _HiresAddrHigh,y
44 sta tmp0+1
45
46 draw_loop_y
47 ;
48 ; Start Y
49 ;
50
51 ;
52 ; Compute the position in the line
53 ;
54 lda _MinX,y ; Get X0
55 tax
56 lda _Mod6Left,x ; X offset 0
57 sta _B0
58 lda _TableDiv6,x ; X byte 0
59 sta _S0
60
61 lda _MaxX,y ; Get X1
62 ldy _S0 ; Start offset
63 tax
64 lda _Mod6Right,x ; X offset 1
65 sta _B1
66
67 sec
68 lda _TableDiv6,x ; X byte 1
69 sbc _S0
70 bne draw_multiple
71
72 draw_one
73 lda _B0
74 and _B1
75 eor (tmp0),y
76 sta (tmp0),y
77
78 jmp draw_end
79
80 draw_multiple
81 ;
82 ; X=Nb to draw
83 ;
84 tax ; Nb to draw
85
86 lda _B0
87 eor (tmp0),y
88 sta (tmp0),y
89 iny
90
91 dex
92 beq draw_x_final
93 draw_loop_x
94 lda (tmp0),y
95 eor #1+2+4+8+16+32
96 sta (tmp0),y
97 iny
98 dex
99 bne draw_loop_x
100
101 draw_x_final
102 lda _B1
103 eor (tmp0),y
104 sta (tmp0),y
105
106 draw_end
107 ;
108 ; End Y
109 ;
110 //
111 // Update screen ptr
112 //
113 .(
114 clc
115 lda tmp0+0
116 adc #40
117 sta tmp0+0
118 bcc skip
119 inc tmp0+1
120 skip
121 .)
122
123 //lda tmp0+1
124 //adc #0
125 //sta tmp0+1
126
127 ;
128 ; Update Y position and local mini/max
129 ;
130 ldy _PolyY0
131
132 lda #239
133 sta _MinX,y
134
135 lda #0
136 sta _MaxX,y
137
138 iny
139 sty _PolyY0
140
141 cpy _PolyY1
142 bcs end_draw
143 jmp draw_loop_y
144
145 end_draw
146 ;
147 ; Clear Global Y mini/maxi
148 ;
149 lda #200
150 sta _PolyY0
151 lda #0
152 sta _PolyY1
153 sta _FlagFirst
154 rts
155 .)
156
157
158
159
160 .dsb 256-(*&255)
161
162
163
164
165 _AddLineASM
166 .(
167 lda _Y0
168 cmp _Y1
169 bcc no_swap_values
170 bne swap_values
171
172 ; Null height, so, we leave
173 rts
174
175 swap_values
176
177 ; Swap X's
178 ldx _X0
179 ldy _X1
180 stx _X1
181 sty _X0
182
183 ; Swap Y's
184 ldx _Y0
185 ldy _Y1
186 stx _Y1
187 sty _Y0
188
189 no_swap_values
190 ; Store height
191 sec
192 lda _Y1
193 sbc _Y0
194 sta _DY
195
196 lda _Y0
197 cmp _PolyY0
198 bcs no_top
199 sta _PolyY0
200 no_top
201
202 lda _Y1
203 cmp _PolyY1
204 bcc no_bottom
205 sta _PolyY1
206 no_bottom
207
208 ;
209 ; Compute line width
210 ; And init E
211 ;
212 sec
213 lda _X1
214 sbc _X0
215 sta _DX
216 lda #0
217 sbc #0
218 sta _E
219 sta _E+1
220 sta _DX+1
221
222 ;
223 ; Common inits
224 ;
225 ldy _Y0
226 ldx _X0
227
228 txa
229 cmp _X1
230 bcs go_compute_right
231
232 go_compute_left
233 lda _FlagFirst
234 beq loop_y_left_first_init
235
236 loop_y_left
237 txa
238
239 cmp _MinX,y
240 bcs no_min_1
241 sta _MinX,y
242 no_min_1
243
244 cmp _MaxX,y
245 bcc no_max_1
246 sta _MaxX,y
247 no_max_1
248
249 clc
250 lda _E
251 adc _DX
252 sta _E
253 lda _E+1
254 adc _DX+1
255 sta _E+1
256 bmi end_loop_e_left
257 loop_e_left
258 inx
259 sec
260 lda _E
261 sbc _DY
262 sta _E
263 lda _E+1
264 sbc #0
265 sta _E+1
266 bpl loop_e_left
267
268 end_loop_e_left
269 iny
270 cpy _Y1
271 bcc loop_y_left
272 rts
273
274
275 go_compute_right
276 lda _FlagFirst
277 beq loop_y_right_first_init
278 loop_y_right
279 txa
280
281 cmp _MinX,y
282 bcs no_min_2
283 sta _MinX,y
284 no_min_2
285
286 cmp _MaxX,y
287 bcc no_max_2
288 sta _MaxX,y
289 no_max_2
290
291 sec
292 lda _E
293 sbc _DX
294 sta _E
295 lda _E+1
296 sbc _DX+1
297 sta _E+1
298 bmi end_loop_e_right
299 loop_e_right
300 dex
301 sec
302 lda _E
303 sbc _DY
304 sta _E
305 lda _E+1
306 sbc #0
307 sta _E+1
308 bpl loop_e_right
309
310 end_loop_e_right
311 iny
312 cpy _Y1
313 bcc loop_y_right
314 rts
315
316
317 loop_y_left_first_init
318 lda #1
319 sta _FlagFirst
320 clc
321 loop_y_left_first
322 txa ; NZ, not C
323 sta _MinX,y
324 sta _MaxX,y
325
326 lda _E
327 adc _DX
328 sta _E
329 lda _E+1
330 adc _DX+1
331 sta _E+1
332 bmi end_loop_e_left_first
333 loop_e_left_first
334 inx
335 sec
336 lda _E
337 sbc _DY
338 sta _E
339 lda _E+1
340 sbc #0
341 sta _E+1
342 bpl loop_e_left_first
343
344 end_loop_e_left_first
345 iny
346 cpy _Y1
347 bcc loop_y_left_first
348 rts
349
350
351 loop_y_right_first_init
352 lda #1
353 sta _FlagFirst
354 loop_y_right_first
355 txa
356 sta _MinX,y
357 sta _MaxX,y
358
359 sec
360 lda _E
361 sbc _DX
362 sta _E
363 lda _E+1
364 sbc _DX+1
365 sta _E+1
366 bmi end_loop_e_right_first
367 loop_e_right_first
368 dex
369 sec
370 lda _E
371 sbc _DY
372 sta _E
373 lda _E+1
374 sbc #0
375 sta _E+1
376 bpl loop_e_right_first
377
378 end_loop_e_right_first
379 iny
380 cpy _Y1
381 bcc loop_y_right_first
382 rts
383 .)
384
385
386
387
388
389
390
391
392 _Filler_ClearMinMaxTable
393 lda #200
394 sta _PolyY0
395 lda #0
396 sta _PolyY1
397
398 lda #239
399 ldx #200
400 loop_init_min
401 dex
402 sta _MinX,x
403 bne loop_init_min
404
405 lda #0
406 ldx #200
407 loop_init_max
408 dex
409 sta _MaxX,x
410 bne loop_init_max
411 rts
412
413
414
415
416
417
418
419
420
421
422
423
424
425 ; Calculate some RANDOM values
426 ; Not accurate at all, but who cares ?
427 ; For what I need it's enough.
428
429 _RandomValueLow
430 .byt 23
431 _RandomValue
432 _RandomValueHigh
433 .byt 35
434
435
436 _GetRand
437 lda _RandomValueHigh
438 sta tmp1
439 lda _RandomValueLow
440 asl
441 rol tmp1
442 asl
443 rol tmp1
444 ; asl
445 ; rol temp1
446 ; asl
447 ; rol temp1
448 clc
449 adc _RandomValueLow
450 pha
451 lda tmp1
452 adc _RandomValueHigh
453 sta _RandomValueHigh
454 pla
455 adc #$11
456 sta _RandomValueLow
457 lda _RandomValueHigh
458 adc #$36
459 sta _RandomValueHigh
460 jmp *+3
461 rts
462
463

  ViewVC Help
Powered by ViewVC 1.1.26