/[projet1]/public/oric/games/Space 1999/Sources/game source/NOISE/occlusions.s
Defence Force logotype

Contents of /public/oric/games/Space 1999/Sources/game source/NOISE/occlusions.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 76 - (show annotations)
Tue May 26 07:45:25 2009 UTC (10 years, 6 months ago) by Chema
File size: 18319 byte(s)


1
2 ;#define DUMPMASK
3
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5 ; Clears the buffer
6 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
8 clear_occ
9
10 lda #HI(buffer_occ)
11 sta tmp0+1
12 lda #LO(buffer_occ)
13 sta tmp0
14
15 lda #0
16 sta tmp
17 clc
18 ldx _clip_rgn+3
19 dex
20 txa
21 #ifdef EIGTHSCANS
22 asl
23 rol tmp
24 asl
25 rol tmp
26 asl
27 rol tmp
28
29 adc tmp0
30 sta tmp0
31 lda tmp
32 adc tmp0+1
33 sta tmp0+1
34
35 #else
36 asl
37 sta tmp
38 asl
39 clc
40 adc tmp
41 adc tmp0
42 sta tmp0
43 bcc nocarryt4
44 inc tmp0+1
45 nocarryt4
46 #endif
47
48
49 ;; Pointer in tmp0
50 ldx _clip_rgn+3 ; get lines
51
52 co_looplines
53 lda #$40;7f
54 ldy _clip_rgn+2 ; get scans
55 dey
56 co_loopscans
57 sta (tmp0),y
58 dey
59 bpl co_loopscans
60
61 lda tmp0
62 sec
63 ;sbc #8 ; Point to previous line
64 sbc #SCANSINBUFF ; Point to previous line
65 bcs co_no_carry
66 dec tmp0+1
67 co_no_carry
68 sta tmp0
69 dex
70 bne co_looplines
71
72 rts ; We're done
73
74
75 ;; End of clear_buff
76
77
78 calc_occlusion_mask
79 ;; KLUDGE: Repaint what has been corrupted...
80
81 lda double_buff
82 bne k_cont
83 jmp endkludge
84
85 k_cont
86
87 lda #1
88 sta in_kludge_height+1
89
90 ;Save params
91 inc sp
92 bne k_done
93 inc sp+1
94 k_done
95
96 jsr clear_occ
97
98 ldy iloop2
99 iny
100 sty block_i
101 ldy tiley
102 dey
103 sty block_j
104
105
106 lda #0
107 sta block_k ; Initial heigth to start looking for objects in front
108
109
110 #if LAYER_HEIGHT<>8
111 #echo WARNING: LAYER HEIGHT IS NOT 8. CHANGE KLUDGE @ OCCLUSIONS.S
112 #endif
113
114 ; We have in block_i: i+1 and in block_j: j-1
115
116 k_loop1
117 jsr add_block_mask
118 inc block_k
119 lda block_k
120 cmp #NUM_LAYERS
121 bcc k_loop1
122
123 ;; Now objects that might be on top
124
125 lda sizecode ; Initialised at paint_sprites before calling here
126 and #%00111111
127 tax
128 lda _sizes_k,x
129 asl ; Double the size...
130 sec
131 sbc #1
132 clc
133 adc who_k
134 lsr
135 lsr
136 lsr
137 sta block_k
138 cmp #(NUM_LAYERS-1)
139 bcs k_noup
140
141 inc block_k
142 ;inc block_j
143 dec block_i ; We are now at (i,j-1)
144 k_loop2
145 ; Start at (i,j-1)
146 jsr add_block_mask
147 dec block_i
148 jsr add_block_mask ; Now at (i-1,j-1)
149
150 inc block_j
151 jsr add_block_mask ; Now at (i-1, j)
152
153 dec block_j
154 inc block_i ; Back at (i,j-i) for next loop
155
156 inc block_k
157 lda block_k
158 cmp #NUM_LAYERS
159 bcc k_loop2
160
161 k_noup
162
163 jsr add_sprites_mask
164
165 lda #0
166 sta in_kludge_height+1
167
168 #ifdef DUMPMASK
169 jsr dump_mask
170 #endif
171
172 nokludge
173 ;Restore sp
174 lda sp
175 bne k_declsp
176 dec sp+1
177 k_declsp
178 dec sp
179
180 endkludge
181 rts
182
183
184 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
185 ; add_block_mask
186 ; Add a mask of a given block to the sprite mask
187 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
188
189 block_i .byte $00
190 block_j .byte $00
191 block_k .byte $00
192 block_index .byte $00
193
194 add_block_mask
195
196 #if LAYER_HEIGHT<>8
197 #echo WARNING: LAYER HEIGHT IS NOT 8. CHANGE ADD_BLOCK_MASK @ OCCLUSIONS.S
198 #endif
199 ; X and Y parameters for put_sprite
200 lda block_i
201 cmp #10
202 bcs abm_nothing2do
203 sta op1
204 lda block_j
205 cmp #10
206 bcs abm_nothing2do
207
208 sta op2
209 jsr ij2xy
210 tya
211 clc
212 adc #12
213 ldy #2
214 sta (sp),y ; store
215 txa
216 ldy #0
217 sta (sp),y ; store
218
219
220 ; Initialize heigth
221 lda block_k
222 asl
223 asl
224 asl ; Multiply by 8
225 sta tmp
226
227 ; New heigth means changing y
228 ldy #2
229 lda (sp),y ; get y
230 sec
231 sbc tmp
232 sta (sp),y ; store
233
234
235 ; fetch block to draw
236
237 ; Get the block to draw... that is i*10+j (NOT i+j*10 as it would seem BEWARE!)
238 lda block_i
239 asl ; i*2
240 sta tmp
241 asl
242 asl ; i*8
243 clc
244 adc tmp ; i*10
245 clc
246 adc block_j ; i*10+j
247 sta block_index
248
249 ; Get pointer to map of current layer
250 lda block_k
251 asl ; double index for 16-bit entries
252 tax
253 lda _layers,x ; get MSB
254 sta tmp
255 lda _layers+1,x ; get LSB
256 sta tmp+1
257 ldy block_index
258 lda (tmp),y ; get tile
259 and #%01111111 ; Remove SPECIAL bit
260 beq abm_nothing2do
261
262 jsr draw_block
263
264 abm_nothing2do
265
266 rts ; We're done
267
268
269 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
270 ; add_sprites_mask
271 ; Helper funcion that searches for sprites that should
272 ; add their masks to the occlusion mask
273 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
274
275 as_num_sp .byte $00
276
277 add_sprites_mask
278 lda _num_chars
279 sta as_num_sp
280
281 as_loopchars
282 ldx as_num_sp
283 dex
284 lda _chars_in_room,x ; Get new object
285 cmp cur_char ; Is it the current one?
286 beq as_nextchar ; It is... so ignore
287
288 ;jmp as_nextchar
289
290 asl ; Multiply by 4 (sizeof(moving_object_t))
291 asl
292 tax
293
294 ; Should this sprite be treated for occlusions?
295
296 ldy sizecode
297 lda _sizes_i,y
298 sta tmp
299 lda _characters,x ; cur_sp_i+sp_width_i-sp_i-1 < 18?
300 clc
301 adc tmp
302 clc ; DONE ON PURPOSE
303 sbc who_i
304 bmi as_nextchar
305 cmp #18
306 bcs as_nextchar
307
308 inx
309 lda _sizes_j,y
310 sta tmp
311 lda _characters,x ; cur_sp_j+sp_width_j-sp_j-1 < 18
312 clc
313 adc tmp
314 clc ; DONE ON PURPOSE
315 sbc who_j
316 bmi as_nextchar
317 cmp #18
318 bcs as_nextchar
319
320 inx
321 inx
322 lda _characters,x
323 and #%0011111 ; Get size code
324 tay
325 lda _sizes_k,y
326 asl
327 dex
328
329 ; inx
330 ; lda _sizes_k,y
331 ; asl
332 adc _characters,x
333 sec
334 sbc #1
335 cmp who_k
336 bcc as_nextchar ; The sprite is below...
337
338 jsr add_this_sprite
339
340 as_nextchar
341 dec as_num_sp
342 beq as_end
343 jmp as_loopchars
344 as_end
345 rts
346
347
348
349
350 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
351 ;; put_mask2(char x_pos, y_pos, sprite_t * sprite, char invert)
352 ;; Saving the mask for occlusions. No rotations.
353 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
354 put_mask2
355
356 ;; Do the minimum necessary to call intersect_rect,
357 ;; so if painting is not needed we return as fast as possible
358
359 #ifdef TINYNOISE
360 jsr fetch_coords
361 #else
362 ;; Fetch x and y coordinates
363 ldy #0
364 lda(sp),y
365 sta op1
366 ldy #2
367 lda(sp),y
368 sta op2
369
370 ldy #4 ; Get sprite pointer
371 lda (sp),y
372 sta tmp2
373 iny
374 lda (sp),y
375 sta tmp2+1
376
377 ldy #0
378 lda (tmp2),y ; # of lines
379 sta tmp3
380 iny
381 lda (tmp2),y
382 sta tmp3+1 ; # of scans
383 #endif
384
385 jsr intersect_rect
386 beq pm2_cont1
387 rts
388 pm2_cont1
389 ldy #6 ; Paint inverted
390 lda(sp),y
391 sta invert3+1
392
393 lda tmp3+1
394 sta scans_to_draw
395
396 lda #0
397 sta scan_to_start
398
399 ldy tmp3+1 ;scans
400 dey
401 sty tmp
402
403
404 ldy #4
405 lda (tmp2),y
406 sta tmp5
407 iny
408 lda (tmp2),y
409 sta tmp5+1 ; Pointer to sprite mask
410
411 lda tmp5
412 sec
413 sbc tmp
414 bcs pm2_nocarry3
415 dec tmp5+1
416 pm2_nocarry3
417 sta tmp5
418
419 ; Test parameter to see if we use double buffer or not...
420
421 jsr adjust_clip
422 jsr pixel_address
423
424 ; Adjust to buffer_occ
425 lda tmp0
426 clc
427 adc #LO(buffer_occ-scr_buffer)
428 sta tmp0
429 lda tmp0+1
430 adc #HI(buffer_occ-scr_buffer)
431 sta tmp0+1
432
433 ;; We have in tmp1 the code of the pixel in scan
434 ;; and in tmp0 the destination address
435
436 lda scan_to_start
437 sta scan2start3+1
438
439 pm2_loop1
440 ;; Some initializations...
441 ldy scans_to_draw
442 dey
443
444 pm2_loop2
445 scan2start3
446 cpy #0
447 bmi pm2_nopaint
448
449
450 lda (tmp0),y ; Take screen contents
451 sta tmp
452
453 invert3
454 lda #0
455 beq pm2_noinvert
456
457 sty aux
458 lda tmp3+1
459 clc ; DONE ON PURPOSE, BEWARE!
460 sbc aux ; (scans-current_scan)
461 tay
462
463 lda (tmp5),y ; Get mask
464 tax
465 lda tab_inverted_bytes,x
466 ora #%010000000 ; :: HAS TO BE DONE?
467 ora tmp ; AND screen
468
469 ldy aux
470
471 bvc pm2_paint ; Branches allways
472
473 pm2_noinvert
474 lda (tmp5),y ; Get mask
475 ora tmp ; AND screen
476
477 pm2_paint
478
479 sta (tmp0),y ; Put everything in screen
480
481 pm2_nopaint
482 dey
483 bpl pm2_loop2 ; End of scans loop
484 pm2_noloop2
485
486 lda tmp0
487 sec
488 ;sbc #8 ; Point to previous line
489 sbc #SCANSINBUFF ; Point to previous line
490 bcs pm2_no_carry1
491 dec tmp0+1
492 pm2_no_carry1
493 sta tmp0
494
495 ;; Decrement pointers
496 lda tmp5
497 sec
498 sbc tmp3+1
499 bcs pm2_dec5
500 dec tmp5+1
501 pm2_dec5
502 sta tmp5
503
504 ;; Next line
505 dec tmp3
506 beq pm2_end
507 jmp pm2_loop1 ; End of lines loop
508
509 pm2_end
510 rts ; We're done!
511
512
513
514
515 ats_cur_char .byte $00
516 ats_who_i .byte $00
517 ats_who_j .byte $00
518 ats_who_k .byte $00
519 ats_sizecode .byte $00
520
521 add_this_sprite
522 ldx as_num_sp
523 dex
524 ;txa
525 lda _chars_in_room,x
526 sta ats_cur_char
527
528 asl ; Multiply by 4 (sizeof(moving_object_t))
529 asl
530 tay
531
532 lda _characters,y ; .fine_coord_i
533 sta ats_who_i
534 iny
535 lda _characters,y ; .fine_coord_j
536 sta ats_who_j
537 iny
538 lda _characters,y ; .fine_coord_k
539 sta ats_who_k
540 iny
541 lda _characters,y ; .type
542 and #%00111111
543 sta ats_sizecode
544
545 ; Get inverted flag
546 lda _characters,y ; .type
547 and #%01000000
548 beq ats_noinvert
549 lda #1
550 ats_noinvert
551 ldy #6
552 sta (sp),y
553
554 lda xo
555 pha
556 lda yo
557 pha
558 lda xx
559 pha
560 lda scry
561 pha
562
563
564 ;; Calculate x,y screen position from fine coordinates i,j,k
565 ;; Cannot use ij2xy as it is for tile coordinates
566
567 lda ats_who_i
568 jsr do_div6
569 sta xo
570 sta op1
571
572 lda ats_who_j
573 jsr do_div6
574 sta yo
575 sta op2
576
577 jsr ij2xy
578
579 tya
580 clc
581 adc #12
582 ldy #2
583 sta scry
584
585 txa
586 ldy #0
587 sta xx
588
589 lda xo
590 asl
591 sta xo
592 asl
593 clc
594 adc xo
595 sta xo ; xo=xo*6
596 lda ats_who_i
597 clc
598 adc #1
599 sec
600 sbc xo
601 sta tmp ; tmp=who_i-xo*6
602
603 lda yo
604 asl
605 sta yo
606 asl
607 clc
608 adc yo
609 sta yo ; yo=yo*6
610 lda ats_who_j
611 clc
612 adc #1
613 sec
614 sbc yo
615 sta yo ; yo=who_j-yo*6
616
617 lda tmp
618 sec
619 sbc yo
620 asl
621 sta xo ; xo=(yo-tmp)*2
622
623 lda yo
624 clc
625 adc tmp
626 ; Z-pos of sprite
627 sec
628 sbc ats_who_k
629 sta yo ; yo=tmp+yo-zpos
630
631
632 ;; Now the pointer to graphics...
633 lda ats_cur_char
634 ;; Multiply by 6 (size_of(sprite_t))
635 asl
636 asl
637 sta tmp
638 lda ats_cur_char
639 asl
640 clc
641 adc tmp
642 sta tmp
643
644 ;; Pointer in tmp1
645 lda #LO(_char_pics)
646 sta tmp1
647 lda #HI(_char_pics)
648 sta tmp1+1
649
650 clc
651 lda tmp
652 adc tmp1
653 sta tmp1
654 bcc ats_nocarry
655 inc tmp1+1
656 ats_nocarry
657
658 ldy #4
659 lda tmp1
660 sta (sp),y
661 lda tmp1+1
662 iny
663 sta (sp),y
664
665
666
667 ; And the coordinates ....
668 lda xx
669 clc
670 adc xo
671
672 ; Adjust with the sprite size also...
673 clc
674 adc #ancho_tile/2
675 ;tay
676 ;ldx ats_sizecode
677 ;lda _sizes_i,x
678 ;asl
679 ;sta tmp
680 ;tya
681
682 tax
683 ldy #1
684 lda (tmp1),y ; Get number of scans
685 sta tmp
686 asl
687 clc
688 adc tmp ; Multiply by 3 (6 pix per scan /2)
689 sta tmp
690 txa
691
692 sec
693 sbc tmp
694
695 ldy #0
696 sta (sp),y
697
698 ldy #2
699 lda scry
700 sec
701 sbc #alto_tile
702 clc
703 adc yo
704
705 sta (sp),y
706
707
708 jsr put_mask
709
710
711 ;; Done. Let's restore contents of sp
712 pla
713 sta scry
714 pla
715 sta xx
716 pla
717 sta yo
718 pla
719 sta xo
720
721
722 rts
723
724
725
726 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
727 ;; put_mask(char x_pos, y_pos, sprite_t * sprite, char invert)
728 ;; Saves mask of a sprite. Rotates if necessary
729 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
730 put_mask
731
732 ;; Do the minimum necessary to call intersect_rect,
733 ;; so if painting is not needed we return as fast as possible
734 #ifdef TINYNOISE
735 jsr fetch_coords
736 #else
737 ;; Fetch x and y coordinates
738 ldy #0
739 lda (sp),y
740 sta op1
741 ldy #2
742 lda (sp),y
743 sta op2
744
745 ldy #4 ; Get sprite pointer
746 lda (sp),y
747 sta tmp2
748 iny
749 lda (sp),y
750 sta tmp2+1
751
752 ldy #0
753 lda (tmp2),y ; # of lines
754 sta tmp3
755 iny
756 lda (tmp2),y
757 sta tmp3+1 ; # of scans
758 #endif
759 clc
760 adc #1
761 sta scans_to_draw
762
763 jsr intersect_rect
764 beq pm_cont1
765 rts
766 pm_cont1
767
768 ldy #6 ; Paint inverted
769 lda(sp),y
770 sta invert4+1
771
772
773 lda #0
774 sta scan_to_start
775
776 ldy #4
777 lda (tmp2),y
778 sta tmp5
779 iny
780 lda (tmp2),y
781 sta tmp5+1 ; Pointer to sprite mask
782
783
784 lda tmp5
785 sec
786 sbc tmp3+1 ; Was tmp... a copy of tmp3+1 (?)
787 bcs pm_nocarry3
788 dec tmp5+1
789 pm_nocarry3
790 sta tmp5
791
792 jsr adjust_clip
793 jsr pixel_address
794
795 ; Adjust to buffer_occ
796 lda tmp0
797 clc
798 adc #LO(buffer_occ-scr_buffer)
799 sta tmp0
800 lda tmp0+1
801 adc #HI(buffer_occ-scr_buffer)
802 sta tmp0+1
803
804
805 ;; We have in tmp1 the code of the pixel in scan
806 ;; and in tmp0 the destination address
807
808 ;; Adjust number of rotations per byte
809 lda tmp1
810 asl
811 asl
812 ldx #0
813 pm_preparerot
814 asl
815 bcs pm_endpreparerot
816 inx
817 jmp pm_preparerot
818 pm_endpreparerot
819 stx tmp1
820
821 lda tmp3+1
822 cmp scans_to_draw
823 bcc pm_loop1about
824 lda scans_to_draw
825 pm_loop1about
826 sta reg14
827
828 lda scan_to_start
829 sta scan2start4+1
830 sta scan2start4b+1
831
832 lda scans_to_draw
833 sta scans2draw2+1
834 sta scans2draw2b+1
835
836
837 pm_loop1
838 ;; Some initializations...
839 ldy #0
840 sty reg15
841 ldy reg14
842
843 pm_loop2
844 lda (tmp0),y ; Take screen contents
845 sta tmp
846
847 invert4
848 lda #0
849 beq pm_noinvert
850
851 sty aux
852 lda tmp3+1
853 sec
854 sbc aux ; (scans-current_scan)
855 tay
856 iny
857
858 lda (tmp5),y ; Take scan of mask
859 tax
860 lda tab_inverted_bytes,x
861 sta reg13
862
863 ldy aux
864 bvc pm_rotate ; Branches allways
865
866 pm_noinvert
867 lda (tmp5),y ; Take scan of mask
868 sta reg13
869
870 pm_rotate
871 ;; Initializations for rotation loop
872 lda #0
873 ldx tmp1
874 beq pm_end_rot
875 pm_looprot
876
877 clc
878 ror reg13
879 ror
880
881 dex
882 bne pm_looprot
883 pm_end_rot
884
885 scans2draw2
886 cpy #0
887 bpl pm_nopaint
888
889 ;; As an scan is composed by the less-significant 6 bits
890 ;; of the byte we should rotate this twice more...
891
892 ror
893 ror
894
895
896 ;; Now we have:
897 ;; For the mask;
898 ;; in a the new value for this scan
899 ;; in reg15 the value calculated previosly for this scan (to be ORed)
900 ;; in reg13 the value to be ORed to the next scan to be calculated
901
902 ora reg15 ; Complete mask for this scan
903 ora tmp
904
905
906 sta (tmp0),y ; Put everything in screen
907 pm_nopaint
908
909 ldx reg13
910 stx reg15 ; Ready for next loop
911
912 dey
913 beq pm_noloop2
914 scan2start4
915 cpy #0
916 bmi pm_nopaint2
917
918 jmp pm_loop2 ; End of scans loop
919 pm_noloop2
920 ;; THERE IS ONE SCAN LEFT TO GO
921 scans2draw2b
922 cpy #0
923 bpl pm_nopaint2
924
925 scan2start4b
926 cpy #0
927 bmi pm_nopaint2
928
929
930 lda (tmp0),y ; Take screen contents
931 sta tmp
932
933 lda reg15 ; Get mask for this scan
934 ora tmp
935 sta (tmp0),y ; Put everything in screen
936 pm_nopaint2
937
938 lda tmp0
939 sec
940 ;sbc #8 ; Point to previous line
941 sbc #SCANSINBUFF ; Point to previous line
942 bcs pm_no_carry1
943 dec tmp0+1
944 pm_no_carry1
945 sta tmp0
946
947 lda tmp5
948 sec
949 sbc tmp3+1
950 bcs pm_dec5
951 dec tmp5+1
952 pm_dec5
953 sta tmp5
954
955 ;; Next line
956 dec tmp3
957 beq pm_end
958 jmp pm_loop1 ; End of lines loop
959
960 pm_end
961 rts ; We're done!
962
963
964 ; End of put_mask
965
966
967
968
969
970 #ifdef DUMPMASK
971 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
972 ; void dump_mask()
973 ; paints the dump mask buffer on screen
974 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
975 +dump_mask
976
977 lda double_buff
978 pha
979 lda #0
980 sta double_buff
981
982 lda #120
983 sta op1
984 lda #190
985 sta op2
986 jsr pixel_address
987
988
989 ;; Pointer in tmp1
990 lda #LO(buffer_occ)
991 sta tmp1
992 lda #HI(buffer_occ)
993 sta tmp1+1
994
995 lda #0
996 sta tmp
997 ldx _clip_rgn+3
998 dex
999 txa
1000 #ifdef EIGTHSCANS
1001 asl
1002 rol tmp
1003 asl
1004 rol tmp
1005 asl
1006 rol tmp
1007
1008 adc tmp1
1009 sta tmp1
1010 lda tmp
1011 adc tmp1+1
1012 sta tmp1+1
1013
1014 #else
1015 asl
1016 sta tmp
1017 asl
1018 clc
1019 adc tmp
1020 adc tmp1
1021 sta tmp1
1022 bcc nocarryt6
1023 inc tmp1+1
1024 nocarryt6
1025 #endif
1026
1027 ldx _clip_rgn+3 ; get lines
1028
1029 dm_looplines
1030 ldy _clip_rgn+2 ; get scans
1031 dey
1032 dm_loopscans
1033 lda (tmp1),y
1034 sta (tmp0),y
1035 dey
1036 bpl dm_loopscans
1037
1038 lda tmp0
1039 sec
1040 sbc #40 ; Point to previous line
1041 bcs dm_no_carry
1042 dec tmp0+1
1043 dm_no_carry
1044 sta tmp0
1045
1046 lda tmp1
1047 sec
1048 ; sbc #8 ; Point to previous line
1049 sbc #SCANSINBUFF ; Point to previous line
1050 bcs dm_no_carry2
1051 dec tmp1+1
1052 dm_no_carry2
1053 sta tmp1
1054
1055 dex
1056 bne dm_looplines
1057
1058 pla
1059 sta double_buff
1060
1061 ;rts ; We're done
1062
1063 ;; End of paint_buff
1064
1065
1066 dump_clip
1067 lda double_buff
1068 pha
1069 lda #0
1070 sta double_buff
1071
1072 lda #20
1073 sta op1
1074 lda #190
1075 sta op2
1076 jsr pixel_address
1077
1078
1079 ;; Pointer in tmp1
1080 lda #LO(scr_buffer)
1081 sta tmp1
1082 lda #HI(scr_buffer)
1083 sta tmp1+1
1084
1085 lda #0
1086 sta tmp
1087 ldx _clip_rgn+3
1088 dex
1089 txa
1090 #ifdef EIGTHSCANS
1091 asl
1092 rol tmp
1093 asl
1094 rol tmp
1095 asl
1096 rol tmp
1097
1098 adc tmp1
1099 sta tmp1
1100 lda tmp
1101 adc tmp1+1
1102 sta tmp1+1
1103 #else
1104 asl
1105 sta tmp
1106 asl
1107 clc
1108 adc tmp
1109 adc tmp1
1110 sta tmp1
1111 bcc nocarryt5
1112 inc tmp1+1
1113 nocarryt5
1114 #endif
1115
1116
1117
1118 ldx _clip_rgn+3 ; get lines
1119
1120 dc_looplines
1121 ldy _clip_rgn+2 ; get scans
1122 dey
1123 dc_loopscans
1124 lda (tmp1),y
1125 sta (tmp0),y
1126 dey
1127 bpl dc_loopscans
1128
1129 lda tmp0
1130 sec
1131 sbc #40 ; Point to previous line
1132 bcs dc_no_carry
1133 dec tmp0+1
1134 dc_no_carry
1135 sta tmp0
1136
1137 lda tmp1
1138 sec
1139 ; sbc #8 ; Point to previous line
1140 sbc #SCANSINBUFF ; Point to previous line
1141 bcs dc_no_carry2
1142 dec tmp1+1
1143 dc_no_carry2
1144 sta tmp1
1145
1146 dex
1147 bne dc_looplines
1148
1149 pla
1150 sta double_buff
1151
1152 rts ; We're done
1153
1154 #endif
1155
1156
1157

  ViewVC Help
Powered by ViewVC 1.1.26