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

Contents of /public/oric/demos/buggy_boy/LcpIntro/rasters.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: 6563 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 0 16 noir
4 1 17 rouge
5 2 18 vert
6 3 19 jaune
7 4 20 bleu
8 5 21 violet
9 6 22 cyan
10 7 23 blanc
11 */
12
13
14 .zero
15
16 _Rasters_AngleRed .dsb 1
17 _Rasters_AngleGreen .dsb 1
18 _Rasters_AngleBlue .dsb 1
19
20 _Rasters_CurAngleRed .dsb 1
21 _Rasters_CurAngleGreen .dsb 1
22 _Rasters_CurAngleBlue .dsb 1
23
24
25 .text
26
27 _RideauCount .byt 0
28 _RideauPos .byt 0
29 _Rasters_DisplayOffset
30 .byt 1
31
32
33
34
35
36 _Rasters_TableOrange
37 .byt 16+0
38 .byt 16+1
39 .byt 16+3
40 .byt 16+7
41 .byt 16+7
42 .byt 16+3
43 .byt 16+1
44 .byt 16+0
45
46 .byt 0
47
48
49 _Rasters_TableBleu
50 .byt 16+0
51 .byt 16+4
52 .byt 16+6
53 .byt 16+7
54 .byt 16+7
55 .byt 16+6
56 .byt 16+4
57 .byt 16+0
58
59 .byt 0
60
61
62 _RastersDitherTable
63 .byt 0
64 .byt 0
65 .byt 0
66 .byt 0
67 .byt 0
68 .byt 0
69 .byt 0
70 .byt 0
71 .byt 0
72 .byt 0
73 .byt 1
74 .byt 0
75 .byt 0
76 .byt 1
77 .byt 1
78 .byt 0
79 .byt 1
80 .byt 0
81 .byt 0
82 .byt 1
83 .byt 1
84 .byt 0
85 .byt 1
86 .byt 1
87 .byt 1
88 .byt 1
89 .byt 1
90 .byt 1
91 .byt 1
92 .byt 1
93 .byt 1
94 .byt 1
95
96
97
98
99 //Fg Bg
100 // 0-16 noir
101 // 1-17 rouge
102 // 2-18 vert
103 // 3-19 jaune
104 // 4-20 bleu
105 // 5-21 magenta
106 // 6-22 cyan
107 // 7-23 blanc
108 //
109
110 RasterRideau
111 // 16 noirs
112 .byt 16
113 .byt 16
114 .byt 16
115 .byt 16
116 .byt 16
117 .byt 16
118 .byt 16
119 .byt 16
120 .byt 16
121 .byt 16
122 .byt 16
123 .byt 16
124 .byt 16
125 .byt 16
126 .byt 16
127 .byt 16
128
129 // 16 noirs
130 .byt 16
131 .byt 16
132 .byt 16
133 .byt 16
134 .byt 16
135 .byt 16
136 .byt 16
137 .byt 16
138 .byt 16
139 .byt 16
140 .byt 16
141 .byt 16
142 .byt 16
143 .byt 16
144 .byt 16
145 .byt 16
146
147 // 16 noirs
148 .byt 16
149 .byt 16
150 .byt 16
151 .byt 16
152 .byt 16
153 .byt 16
154 .byt 16
155 .byt 16
156 .byt 16
157 .byt 16
158 .byt 16
159 // .byt 16
160 // .byt 16
161 // .byt 16
162 // .byt 16
163 // .byt 16
164
165 // Le raster
166 .byt 20
167 .byt 20
168 .byt 22
169 .byt 22
170 .byt 18
171 .byt 18
172 .byt 19
173 .byt 19
174 .byt 17
175 .byt 17
176 .byt 21
177 .byt 21
178 .byt 20
179 .byt 20
180 .byt 20
181 .byt 20
182
183 // 16 noirs
184 .byt 16
185 .byt 16
186 .byt 16
187 .byt 16
188 .byt 16
189 .byt 16
190 .byt 16
191 .byt 16
192 .byt 16
193 .byt 16
194 .byt 16
195 .byt 16
196 .byt 16
197 .byt 16
198 .byt 16
199 .byt 16
200
201
202 // 16 noirs
203 .byt 16
204 .byt 16
205 .byt 16
206 .byt 16
207 .byt 16
208 .byt 16
209 .byt 16
210 .byt 16
211 .byt 16
212 .byt 16
213 .byt 16
214 .byt 16
215 .byt 16
216 .byt 16
217 .byt 16
218 .byt 16
219
220
221 _Rasters_Initialise
222 .(
223 jsr _Rasters_InitialiseCostable
224 jsr _Rasters_InitialiseVideoMode
225 rts
226 .)
227
228
229
230
231
232 _Rasters_InitialiseVideoMode
233 .(
234 jsr _Rasters_InitialiseVideo
235
236
237 // Add some video inversion where required :)
238 .(
239 lda #<$bb80
240 sta tmp0+0
241 lda #>$bb80
242 sta tmp0+1
243
244 lda #<$a000
245 sta tmp2+0
246 lda #>$a000
247 sta tmp2+1
248
249
250 lda #24
251 sta tmp1
252 ldx #1
253 loop
254 dex
255 beq raster
256 noraster
257 lda #128
258 sta tmp1+1
259 jmp endraster
260 raster
261 ldx #6
262 lda #0
263 sta tmp1+1
264 endraster
265
266 // Hires mode
267 .(
268 lda #8
269 sta tmp3
270 ldy #3
271 loop_inner
272 lda #26
273 eor tmp1+1
274 sta (tmp2),y
275
276 .(
277 clc
278 lda tmp2+0
279 adc #40
280 sta tmp2+0
281 bcc skip
282 inc tmp2+1
283 skip
284 .)
285 dec tmp3
286 bne loop_inner
287 .)
288
289
290 // Text mode
291 lda #36
292 eor tmp1+1
293 ldy #4
294 sta (tmp0),y
295
296 lda #11
297 eor tmp1+1
298 ldy #20
299 sta (tmp0),y
300
301 lda #36
302 //eor tmp1+1
303 ldy #21
304 sta (tmp0),y
305
306 lda #36
307 //eor tmp1+1
308 ldy #37
309 sta (tmp0),y
310
311 lda #36
312 //eor tmp1+1
313 ldy #38
314 sta (tmp0),y
315
316
317 lda #36
318 eor tmp1+1
319 ldy #39
320 sta (tmp0),y
321
322 .(
323 clc
324 lda tmp0+0
325 adc #40
326 sta tmp0+0
327 bcc skip
328 inc tmp0+1
329 skip
330 .)
331
332 dec tmp1
333 bne loop
334 .)
335
336 /*
337 lda #36
338 sta $bb80+20
339 sta $bb80+40*6+20
340 sta $bb80+40*12+20
341 sta $bb80+40*18+20
342 sta $bb80+40*24+20
343
344 lda #9
345 sta $bb80+21
346 sta $bb80+40*6+21
347 sta $bb80+40*12+21
348 sta $bb80+40*18+21
349 sta $bb80+40*24+21
350
351 lda #36
352 sta $bb80+37
353 sta $bb80+40*6+37
354 sta $bb80+40*12+37
355 sta $bb80+40*18+37
356 sta $bb80+40*24+37
357
358 sta $bb80+38
359 sta $bb80+40*6+38
360 sta $bb80+40*12+38
361 sta $bb80+40*18+38
362 sta $bb80+40*24+38
363 */
364 .)
365
366
367 _Rasters_InitialiseCostable
368 .(
369 ldx #0
370 loop
371 lda _BaseCosTable,x
372 lsr
373 lsr
374 lsr
375 tay
376 lda _RastersDitherTable,y
377 sta _CosTable,x
378 dex
379 bne loop
380 rts
381 .)
382
383
384
385 // Clear the raster color buffer
386 _RastersClearBuffer
387 .(
388 // Clear all the buffers with
389 // - Black paper
390 // - White ink
391 // - neutral Z value
392 .(
393 // Perform some crazy gradient calculation
394 lda _Rasters_AngleRed
395 sta _Rasters_CurAngleRed
396 inc _Rasters_AngleRed
397
398 lda _Rasters_AngleGreen
399 sta _Rasters_CurAngleGreen
400 inc _Rasters_AngleGreen
401 inc _Rasters_AngleGreen
402
403 lda _Rasters_AngleBlue
404 sta _Rasters_CurAngleBlue
405 inc _Rasters_AngleBlue
406 inc _Rasters_AngleBlue
407 inc _Rasters_AngleBlue
408
409 // Initialize "rideau" value
410 ldx _RideauPos
411 inx
412 txa
413 and #63
414 sta _RideauPos
415
416 clc
417 lda #<RasterRideau-1
418 adc _RideauPos
419 sta __rideau+1
420 lda #>RasterRideau-1
421 adc #0
422 sta __rideau+2
423
424 lda #16
425 sta _RideauCount
426
427
428 ldx #0
429 loop
430 ldy _Rasters_CurAngleRed
431 lda _CosTable,y
432 sta tmp0
433
434 ldy _Rasters_CurAngleGreen
435 lda _CosTable,y
436 asl
437 ora tmp0
438 sta tmp0
439
440 ldy _Rasters_CurAngleBlue
441 lda _CosTable,y
442 asl
443 asl
444 ora tmp0
445
446 ora #16
447 sta _TableRastersPaper,x
448
449 .(
450 ldy _RideauCount
451 dey
452 bne skip
453 ldy #16
454 skip
455 sty _RideauCount
456 .)
457 __rideau
458 lda RasterRideau-1+16,y
459 and #7
460 sta _TableRastersInk,x
461
462
463 inc _Rasters_CurAngleRed
464 inc _Rasters_CurAngleGreen
465 inc _Rasters_CurAngleBlue
466
467
468 inx
469 cpx #200
470 bne loop
471 .)
472
473
474 .(
475 ldx #0
476 loop
477 lda _Rasters_TableOrange,x
478 beq end
479 sta _TableRastersPaper,x
480 sta _TableRastersPaper+96,x
481 sta _TableRastersPaper+200-8,x
482 and #7
483 sta _TableRastersInk+48,x
484 sta _TableRastersInk+144,x
485 lda _Rasters_TableBleu,x
486 sta _TableRastersPaper+48,x
487 sta _TableRastersPaper+144,x
488 and #7
489 sta _TableRastersInk,x
490 sta _TableRastersInk+96,x
491 sta _TableRastersInk+200-8,x
492 inx
493 jmp loop
494 end
495 .)
496 rts
497 .)
498
499
500
501
502 // Display the content of the buffer
503 // onto the screen
504 _RastersDisplayBuffer
505 .(
506 jsr _RastersClearBuffer
507
508 .(
509 clc
510 lda #<$a000
511 adc _Rasters_DisplayOffset
512 sta tmp0
513 lda #>$a000
514 adc #0
515 sta tmp0+1
516
517 ldx #0
518 loop
519 lda _TableRastersInk,x
520 ldy #0
521 sta (tmp0),y
522 lda _TableRastersPaper,x
523 inx
524 iny
525 sta (tmp0),y
526
527 lda _TableRastersInk,x
528 ldy #40
529 sta (tmp0),y
530 lda _TableRastersPaper,x
531 inx
532 iny
533 sta (tmp0),y
534
535 lda _TableRastersInk,x
536 ldy #80
537 sta (tmp0),y
538 lda _TableRastersPaper,x
539 inx
540 iny
541 sta (tmp0),y
542
543 lda _TableRastersInk,x
544 ldy #120
545 sta (tmp0),y
546 lda _TableRastersPaper,x
547 inx
548 iny
549 sta (tmp0),y
550
551 .(
552 clc
553 lda tmp0
554 adc #160
555 sta tmp0
556 bcc skip
557 inc tmp0+1
558 skip
559 .)
560
561 cpx #200
562 bne loop
563 .)
564
565 rts
566 .)
567
568

  ViewVC Help
Powered by ViewVC 1.1.26