Advertisement
glokyfull

spr2024 postponed as hell

Apr 4th, 2024
858
0
152 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. ;
  3. ; routine de sprite jamais fini
  4. ; taille quelquonque
  5. ; 2 plan masqué sur 2 plan
  6. ;
  7. ;
  8. ;
  9. ;
  10.  
  11.  
  12.     BSS
  13. *
  14. maskW   ds.w 1
  15. maskB   ds.w 1
  16. motif   ds.w 2
  17. *
  18. largeurSprite   ds.w 1
  19. hauteurSprite   ds.w 1
  20. adrsprite   ds.l 1
  21.  
  22. listmask
  23.  
  24.     DATA
  25.  
  26.  
  27.     TEXT
  28.  
  29. createCodeGen
  30.     move.l adrsprite,a0
  31.     lea spritebuffer,a1
  32.     move.w largeurSprite,d0
  33.     move.w hauteurSprite,d1
  34.     moveq #0,d4
  35. .copySprite
  36.     move.w d1,d6
  37.     subq.w #1,d6
  38. .loopLigne
  39.     move.w d0,d7
  40.     subq #1,d7
  41. .loopLarg
  42.     move.l (a0)+,d2     ; plan 0 plan 1
  43.     move.l d2,(a1)+
  44.     dbf d7,.loopLarg
  45.     move.l d4,(a1)+
  46.     dbf d6,.loopLigne
  47.  
  48.     lea spritebuffer,a0
  49.     jsr makecodeGen
  50.  
  51.     jsr rollingSprite
  52.  
  53.  
  54.  
  55.  
  56. rollingSprite
  57.     lea spritebuffer,a0
  58.     move.w largeurSprite,d2
  59.     add d2,d2
  60.     add d2,d2
  61.     addq.w #4,d2        ; +1
  62.  
  63.     move.w hauteursprite,d1
  64.     subq #1,d1
  65.     move.l a0,a1
  66. .loopligne
  67.     move.w largeurSprite,d0
  68.     ;subq #1,d0
  69.     move.b #0,ccr
  70. .looprolplan0
  71.     roxr (a0)
  72.     lea 4(a0),a0
  73.     dbf d0,.looprolplan0
  74.  
  75.     lea 2(a1),a0            ; selection plan 2
  76.     move.w largeurSprite,d0
  77.     move.b #0,ccr
  78. .looprolplan1
  79.     roxr (a0)
  80.     lea 4(a0),a0
  81.     dbf d0,.looprolplan1
  82.  
  83.     add d2,a1
  84.     move.l a1,a0
  85.     dbf d1,.loopligne
  86.     rts
  87.  
  88. makecodeGen
  89.     ; analyse des masque
  90.     move.w hauteursprite,d0
  91.     move.w largeursprite,d1
  92.     add.w d1,d1
  93.     add.w d1,d1
  94.    
  95.  
  96.     lea maskW,a5
  97.     lea spritebuffer,a0
  98.     move.l a0,a1
  99.     lea listemaskcol,a1
  100.     move.w hauteursprite,d0
  101.     subq.w #1,d0
  102.     moveq #0,d4
  103. .loopmask
  104.     move.w (a0)+,d2
  105.     move.w d2,4(a5)     motif
  106.     move.w (a0)+,d3
  107.     move.w d3,6(a5)
  108.     or.w d3,d2
  109.     move.w d2,(a5)
  110.  
  111.    
  112.     move.w d4,(a1)+         ; numero de masque
  113.     move.w d2,(a1)+     ;   masque ajoute a la liste des masque nb ligne fois
  114.     addq.w #1,d4
  115.     add d1,a0
  116.     dbf d0,.loopmask
  117.     move.w #-1,(a1)+    ; marqueur de fin
  118.     move.w #0,(a1)+
  119.  
  120.  
  121.     move.w hauteursprite,d0
  122.     subq.w #1+1,d0
  123.     lea listemaskcol,a1
  124.     move.l a1,a2
  125.     lea listeoccurmask,a3
  126.  
  127.     listeposmask,a4
  128.  
  129.     move.w (a1),d4      ;et pas (a1)+   ; numero de masque
  130.     move.w 2(a1),d2     ; masque
  131.  
  132.     moveq #0,d5
  133. .search
  134.     move.w (a1)+,d4         ; numero de masque
  135.     tst.w d4
  136.     bmi.s .suite
  137.     move.w (a1)+,d3         ; masque
  138.     cmp.w d2,d3
  139.     bne.s .1
  140.     move.w d4,(a4)+         ; numero dans la liste qu'il faudra enlever
  141.     move.w #$4e71,-4(a1)    ; on met un marqueur dans la liste numero de masque, masque
  142.     addq.w #1,d5            ; nombre d'occurence du masque
  143. .1 
  144.     bra.s .search
  145. .suite
  146.     move.w #-1,(a4)+
  147. ; dans a4: liste numero de masque semblable le numero de masque seulement
  148. ; dans d2: masque
  149.  
  150. ; on compare le nombre d'occurence
  151.     cmp.w #3,d5
  152.     bgt.s .2
  153. ; ici d5>3 iteration de masque
  154.    
  155. .2
  156.     bsr testmaskd2
  157.     lea listeposmask,a4
  158. ; retire de la liste des masque
  159.     lea listemaskcol,a1
  160. .boucle1
  161.  
  162.     move.w (a4)+,d4
  163.     tst.w d4
  164.     bmi.s .suite2          
  165.     move.w (a1)+,d5
  166.     addq.l #2,a1
  167.     cmp.w d4,d5
  168.     beq.s .suprime
  169.     bra.s .boucle1
  170. .suprime
  171.  
  172.     move.l a1,a3
  173.     lea -4(a1),a1
  174.     move.l a1,a5
  175. .3  move.w (a3)+,d7
  176.     tst.w d7
  177.     bmi.s .termine
  178.     swap d7
  179.     move.w (a3)+,d7
  180.  
  181.     move.l d7,(a1)+
  182.     bra.s .3
  183. .termine
  184.     move.l #$FFFF0000,(a1)+
  185.     move.l a5,a1
  186.     bra.s .boucle1
  187. .suite2
  188.  
  189.  
  190. clearoccurence4e71
  191.     lea listemaskcol,a1
  192.     move.l a1,a2
  193. .loop
  194.     move.w (a2)+,d0
  195.     tst.w d0
  196.     bmi.s .finloop
  197.     move.w (a2)+,d1
  198.     cmp.w #$4e71,d0
  199.     bne.s .1
  200. .0  move.w (a2)+,d0
  201.     bmi.s .finloop
  202.     move.w (a2)+,d1
  203.     cmp.w #$4e71,d0
  204.     beq.s .0
  205. .1  move.w d0,(a1)+
  206.     move.w d1,(a1)+
  207.     bra.s .loop
  208. .finloop
  209.     move.l #$FFFF0000,(a1)+
  210.     rts
  211.  
  212.  
  213.  
  214.  
  215. testmaskd2
  216.     move.w d2,d3        ; d3 = masque
  217.     not.w d3            ; not mask
  218.     tst.w d3            ; mask = FFFF ? <=> not mask = 0
  219.     beq.s .labelFFFF
  220.     not.w d3            ,not not mask = mask
  221.     move.w d3,d6
  222.     tst.b d3            ; XX00
  223.     beq.s .labelaa00
  224.     ; d3.b contient quelquechose
  225.     rol.w #8,d3
  226.     tst.b d3
  227.     beq.s .label00aa
  228.     move.w d6,d3
  229.  
  230. .labelaabb
  231.     ; and.l #maskmask,dep(a0)       ; separable
  232.     ; or.l #orvalue,dep(a0)
  233.     st.b flagMaskLong
  234.     sf.b flagMaskWord
  235.     st.b separable
  236.     sf.b nomask
  237.     rts
  238. .labelaa00
  239.     cmp.w #$FF00,d3
  240.     beq.s .labelFF00
  241.     ; movep.w dep(a0),d6
  242.     ; and.w #valueFF,d6
  243.     ; or.w #value00,d6
  244.     ; movep.w d6,dep(a0)
  245.     sf.b flagMaskLong
  246.     st.b flagMaskWord
  247.     sf.b separable          ; n'est pas separable du bitmap a or-é
  248.     sf.b nomask
  249.     rts
  250. .labelFF00
  251.     ; no mask
  252.     move.w #valuevalue,d6
  253.     movep.w d6,dep(a0)
  254.     st.b nomask
  255.     rts
  256. .label00aa
  257.     move.w d6,d3
  258.     cmp.w #$00FF,d3
  259.     beq.s .label00FF
  260.      movep.w dep+1(a0),d6
  261.      and.w #aaaa,d6
  262.      or.w #value,d6
  263.      movep.w d6,dep+1(a0)
  264.      st.b flagMaskWord
  265.      sf.b flagMaskLong
  266.      sf.b separable
  267.      sf.b nomask
  268.  
  269.     rts
  270. .label00FF
  271.     ; move.w #aaaa,d6
  272.     ; movep.w d6,1+dep(a0)
  273.    
  274.    
  275.  
  276.     move.w d6,d3
  277.     and.w #$00FF,d3
  278.     tst.w d3
  279.     beq.s .labelFF00
  280. .other
  281.     ; masquage normal (?)
  282.     cmp.w #3,d4         ; nombre d'occurence >=3 occurence ?
  283.     bsr serialmasquage
  284.     bra.s .suite
  285.    
  286. .labelFFFF
  287.     ; move.l #value,dep(a0), pas de masquage donc on oublie les masque
  288. .label00FF
  289.     move.w #valuevalue,d6
  290.     movep.w d6,dep+1(a0)        ; pas de masquage non plus
  291. .labelFF00
  292.     move.w #valuevalue,d6
  293.     movep.w d6,dep(a0)
  294.    
  295.    
  296.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement