home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / gfx / piccon-2.20.lha / PicCon / Sources / 64pixSprite.s < prev    next >
Text File  |  1994-04-13  |  4KB  |  163 lines

  1. ; Simple sourcecode that moves four 64 pixels wide sprites on the screen.
  2. ; AGA only.
  3. ;
  4. ; Save a 128x111 frame as attached sprites with controlwords (binary) to the
  5. ; file 'sprite64.raw'.
  6.  
  7.     include    init.i
  8.  
  9. main
  10.     move.l    sinepointer,a0        ; insert new y coordinate
  11.     cmp.l    #eof_sine,a0
  12.     bne.s    no_wrap
  13.     move.l    #sine,a0
  14. no_wrap    moveq    #0,d0
  15.     move.w    (a0)+,d0
  16.     move.l    a0,sinepointer
  17.  
  18.     andi.w    #$ff00,sprite+(111+2)*8*2*0
  19.     andi.w    #$fffe,sprite+8+(111+2)*8*2*0
  20.     andi.w    #$ff00,sprite+(111+2)*8*2*1
  21.     andi.w    #$fffe,sprite+8+(111+2)*8*2*1
  22.     andi.w    #$ff00,sprite+(111+2)*8*2*2
  23.     andi.w    #$fffe,sprite+8+(111+2)*8*2*2
  24.     andi.w    #$ff00,sprite+(111+2)*8*2*3
  25.     andi.w    #$fffe,sprite+8+(111+2)*8*2*3
  26.  
  27.     move.w    d0,d1
  28.     andi.w    #$1,d1
  29.  
  30.     or.w    d1,sprite+8+(111+2)*8*2*0
  31.     or.w    d1,sprite+8+(111+2)*8*2*1
  32.     or.w    d1,sprite+8+(111+2)*8*2*2
  33.     or.w    d1,sprite+8+(111+2)*8*2*3
  34.  
  35.     lsr.w    #1,d0
  36.     or.w    d0,sprite+(111+2)*8*2*0
  37.     or.w    d0,sprite+(111+2)*8*2*1
  38.     add.w    #32,d0
  39.     or.w    d0,sprite+(111+2)*8*2*2
  40.     or.w    d0,sprite+(111+2)*8*2*3
  41.     move.l    #255,d0
  42.     rts
  43. ;***
  44. init
  45.     move.l    #empty,d0
  46.     lea    bplp,a0
  47.     move.w    d0,6(a0)        ; insert BPLPTR LOW
  48.     swap    d0
  49.     move.w    d0,2(a0)        ; insert BPLPTR HIGH
  50.  
  51.     move.w  #DMA_SETCLR!DMA_SPRITE!DMA_RASTER!DMA_COPPER!DMA_MASTER,dmacon+$dff000
  52.  
  53.     move.w    #100*256+100,sprite+(111+2)*8*2*0    ; spr0pos
  54.     move.w    #211*256,sprite+8+(111+2)*8*2*0        ; spr0ctl
  55.  
  56.     move.w    #100*256+100,sprite+(111+2)*8*2*1    ; spr1pos
  57.     move.w    #211*256+128,sprite+8+(111+2)*8*2*1    ; spr1ctl
  58.  
  59.     move.w    #100*256+132,sprite+(111+2)*8*2*2    ; spr2pos
  60.     move.w    #211*256,sprite+8+(111+2)*8*2*2        ; spr2ctl
  61.  
  62.     move.w    #100*256+132,sprite+(111+2)*8*2*3    ; spr3pos
  63.     move.w    #211*256+128,sprite+8+(111+2)*8*2*3    ; spr3ctl
  64.  
  65.     move.l    #sprite,d0        ; insert spritepointers for our
  66.     lea    sprp,a0            ; four sprites
  67.     moveq    #4-1,d1
  68. inslup    move.w    d0,6(a0)
  69.     swap    d0
  70.     move.w    d0,2(a0)
  71.     swap    d0
  72.     add.l    #8,a0
  73.     add.l    #(111+2)*8*2,d0
  74.     dbra    d1,inslup
  75.  
  76.     move.l    #copper,d0        ; move other spritepointers to a
  77.     lea    emptspr,a0        ; place where the sprites won't show
  78.     moveq    #4-1,d1
  79. sprlup    move.w    d0,6(a0)
  80.     swap    d0
  81.     move.w    d0,2(a0)
  82.     swap    d0
  83.     add.l    #8,a0
  84.     dbra    d1,sprlup    
  85.     rts
  86. ;***
  87.     Section    copper,DATA_C
  88. copper
  89.     dc.w    $0180,$0fff,$0182,$0fff
  90.  
  91.     ; sprite colors
  92.     dc.w    $01a0,$0fff,$01a2,$0324,$01a4,$0254,$01a6,$0952
  93.     dc.w    $01a8,$0651,$01aa,$0478,$01ac,$0932,$01ae,$0952
  94.     dc.w    $01b0,$0a55,$01b2,$0c62,$01b4,$0e77,$01b6,$097c
  95.     dc.w    $01b8,$0c78,$01ba,$0997,$01bc,$0fff,$01be,$0321
  96.  
  97.     dc.w    $010c,$0011 
  98.     dc.w    $008e,$2c81
  99.     dc.w    $0100,$1200
  100.     dc.w    $0104,$0224 
  101.     dc.w    $0106,$0c40 
  102.     dc.w    $0090,$2cc1 
  103.     dc.w    $0092,$0038 
  104.     dc.w    $0094,$00d8
  105.     dc.w    $0102,$0000 
  106.     dc.w    $0108,$fff8
  107.     dc.w    $010a,$fff8 
  108.  
  109. bplp    dc.w    $00e0,$0000,$00e2,$0000
  110.  
  111. sprp    dc.w    $0120,$0000,$0122,$0000
  112.     dc.w    $0124,$0000,$0126,$0000
  113.     dc.w    $0128,$0000,$012a,$0000
  114.     dc.w    $012c,$0000,$012e,$0000
  115.  
  116. emptspr    dc.w    $0130,$0000,$0132,$0000
  117.     dc.w    $0134,$0000,$0136,$0000
  118.     dc.w    $0138,$0000,$013a,$0000
  119.     dc.w    $013a,$0000,$013e,$0000
  120.  
  121.     dc.w    $01e4,$2100
  122.     dc.w    $01fc,$000f
  123.     dc.w    $ffff,$fffe
  124.  
  125. ;***
  126.     Section    empty,BSS_C
  127.     
  128. empty    ds.b    320/8*256
  129.  
  130. ;***
  131.     Section sprite,DATA_C
  132.  
  133. sprite        incbin    sprite64.raw        ; insert 4 64x111 sprites here
  134.  
  135. ;***
  136.     Section    sinetable,DATA
  137.  
  138. sine
  139.     dc.l    $0105010e,$01180122,$012b0134,$013e0147,$01500158,$01610169
  140.     dc.l    $01710179,$01800187,$018e0194,$019a019f,$01a501a9,$01ae01b2
  141.     dc.l    $01b501b8,$01bb01bd,$01be01bf,$01c001c0,$01c001bf,$01bd01bc
  142.     dc.l    $01b901b7,$01b301b0,$01ac01a7,$01a2019d,$01970191,$018a0183
  143.     dc.l    $017c0175,$016d0165,$015c0154,$014b0142,$01390130,$0126011d
  144.     dc.l    $0113010a,$010000f6,$00ed00e3,$00da00d0,$00c700be,$00b500ac
  145.     dc.l    $00a4009b,$0093008b,$0084007d,$0076006f,$00690063,$005e0059
  146.     dc.l    $00540050,$004d0049,$00470044,$00430041,$00400040,$00400041
  147.     dc.l    $00420043,$00450048,$004b004e,$00520057,$005b0061,$0066006c
  148.     dc.l    $00720079,$00800087,$008f0097,$009f00a8,$00b000b9,$00c200cc
  149.     dc.l    $00d500de,$00e800f2,$00fb0105,$010e0118,$0122012b,$0134013e
  150.     dc.l    $01470150,$01580161,$01690171,$01790180,$0187018e,$0194019a
  151.     dc.l    $019f01a5,$01a901ae,$01b201b5,$01b801bb,$01bd01be,$01bf01c0
  152.     dc.l    $01c001c0,$01bf01bd,$01bc01b9,$01b701b3,$01b001ac,$01a701a2
  153.     dc.l    $019d0197,$0191018a,$0183017c,$0175016d,$0165015c,$0154014b
  154.     dc.l    $01420139,$01300126,$011d0113,$010a0100,$00f600ed,$00e300da
  155.     dc.l    $00d000c7,$00be00b5,$00ac00a4,$009b0093,$008b0084,$007d0076
  156.     dc.l    $006f0069,$0063005e,$00590054,$0050004d,$00490047,$00440043
  157.     dc.l    $00410040,$00400040,$00410042,$00430045,$0048004b,$004e0052
  158.     dc.l    $0057005b,$00610066,$006c0072,$00790080,$0087008f,$0097009f
  159.     dc.l    $00a800b0,$00b900c2,$00cc00d5,$00de00e8,$00F200FB
  160. eof_sine
  161.  
  162. sinepointer    dc.l    sine
  163.