home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !FALCON / AGGRESSN / MOTION.ZIP / MOTION / DSP / HALO.S56 < prev    next >
Text File  |  1995-12-19  |  8KB  |  415 lines

  1. ; Explo-shadeclusters-motion blur (explo3.p56)
  2. ; bit faster DSP render, WizTom of Aggression
  3. ; screen 192*140 (70 lines x - 70 lines y)
  4. ; prescaled sizes
  5. ; split dsp screen
  6. ; shift motion blur
  7.  
  8. PBC    equ    $ffe0
  9. HSR    equ    $ffe9
  10. HTX    equ    $ffeb
  11.  
  12. v1    equ    0
  13. v2    equ    0
  14. v3    equ    0
  15. v4    equ    0
  16.  
  17.     org    p:$0
  18.     jmp    start
  19.  
  20.     dc    0,0,0,0,0,0,0,0,0,0
  21.     dc    0,0,0,0,0,0,0,0,0,0
  22.     dc    0,0,0,0,0,0,0,0,0,0
  23.     dc    0,0,0,0,0,0,0,0,0,0
  24.     dc    0,0,0,0,0,0,0,0,0,0
  25.     dc    0,0,0,0,0,0,0,0,0,0
  26.     dc    0,0,0,0
  27.  
  28. start    
  29.     jsr    fix_vakiot
  30.     move    #>$ffff,m0
  31.     nop
  32.     move    m0,m1
  33.     move    m0,m2
  34.     move    m0,m3
  35.     move    m0,m4
  36.     move    m0,m5
  37.     move    m0,m6
  38.     move    m0,m7
  39.  
  40.     movep    #0,x:$fffe        ;fix read
  41.     move    #>$babe,x0
  42. x_ready    jclr    #1,X:HSR,x_ready
  43.     move    x0,X:HTX        
  44.  
  45. kasky    movep    #1,X:PBC        
  46.     jclr    #0,x:HSR,kasky
  47.     move    x:HTX,a
  48.     tst    a    #>1,x0
  49.     jeq    key0            ;feed gfx to cpu
  50.     sub    x0,a
  51.     jeq    key1            ;draw shades of list
  52.     sub    x0,a
  53.     jeq    key2            ;precalced shadegfx from cpu,
  54.     sub    x0,a            ;prescales (x-y 32*32)
  55.                     ;n, n*colshades (0-255)
  56.     jeq    key3            ;motion blur
  57.     
  58.     jmp    start
  59.  
  60. ;-------------------------------
  61. ; motion + 24bit to 16bit conv -> CPU
  62. ;----------------------------------
  63.  
  64. key0
  65.     move    #screen,r0        ;motion buf
  66.     move    #vakio,r7
  67.     move    #3,n7
  68.     move    #HTX,r6
  69.  
  70.     move    x:(r0),x0
  71.     move    y:(r7+n7),a        ;prefeed first pixel
  72.  
  73.     move    #>192*70,n6
  74.     move    #>$200000,y1        ;2^20+1
  75.  
  76.     do    n6,m_loop        ;X ram part
  77. ;----------
  78. v1b    equ    $007c00
  79. v2b    equ    $010000            ;2^15+1
  80. v3b    equ    $080000            ;2^18+1
  81. v4b    equ    $7c007c
  82.  
  83.     and    x0,a    y:(r7)+,b        ;R_B
  84.     and    x0,b    a,x1    y:(r7)+,y0    ;_G_
  85.     mpy    y0,x1,a    x:(r0)+,x0        ;R
  86.     mac    y1,x1,a    b,x1    y:(r7)+,y0    ;B
  87.     mac    y0,x1,a    y:(r7)-n7,b        ;G
  88.  
  89. csync    jclr    #1,X:HSR,csync
  90.     tfr    b,a    a1,x:(r6)
  91. ;-------
  92. m_loop
  93.  
  94.     move    #screen,r0        ;
  95.     do    n6,m_loop2        ;Y ram part
  96. ;----------
  97.     and    x0,a    y:(r7)+,b        ;R_B
  98.     and    x0,b    a,x1    y:(r7)+,y0    ;_G_
  99.     mpy    y0,x1,a    y:(r0)+,x0        ;R
  100.     mac    y1,x1,a    b,x1    y:(r7)+,y0    ;B
  101.     mac    y0,x1,a    y:(r7)-n7,b        ;G
  102.  
  103. csync2    jclr    #1,X:HSR,csync2
  104.     tfr    b,a    a1,x:(r6)
  105. ;-------
  106. m_loop2
  107.  
  108.     jmp    start
  109.  
  110. ;------------------------------------
  111. ; render shadeparticles from list to virtual screen
  112. ;---------------------------------------------
  113.  
  114. key1
  115.     jsr    readparticles
  116.     jsr    renderparticles
  117.     jmp    start
  118.  
  119. ;-----------------------------------------------------------
  120. ; Hae particle-list prosulta
  121. ;-----------------------------------------------------------
  122.  
  123. readparticles
  124. ra    movep    #1,X:PBC
  125.     jclr    #0,x:HSR,ra        
  126.     move    x:HTX,a
  127.     move    a1,x:amount
  128.  
  129.     move    #shadelist,r0
  130.     lsl    a    a1,x1
  131.     lsl    a
  132.     add    x1,a        
  133.     do    a1,getx            ;amount*5
  134. ;----
  135. rc    movep    #1,X:PBC
  136.     jclr    #0,x:HSR,rc        ;get list from cpu
  137.     move    x:HTX,x0
  138.     move    x0,y:(r0)+        ;x,y,size,heat,col
  139. getx                    
  140. ;----
  141.     rts
  142.  
  143. ;------------------------------------
  144. ; kaikki rendaus rutiinit alkaa 
  145. ;---------------------------------------
  146.  
  147. renderparticles
  148.     move    #shadelist,r3
  149.     move    x:amount,x0
  150.     move    #vakio+4,r2        ;pointaa v5
  151.     move    #1,n2
  152.     do    x0,drawone
  153. ;--------------------------- ONE PARTICLE 
  154.  
  155.     move    y:(r3)+,a0        ;get X
  156.     move    y:(r3)+,x0        ;get y
  157.     move    #>192/2,x1
  158.     mac    x1,x0,a    #>screen,x0
  159.     move    a0,a
  160.     add    x0,a    
  161.     move    a1,r7            ;screen position (vasen ylakulma)
  162.  
  163.     move    y:(r3)+,x0        ;size
  164.  
  165.     clr    a
  166.     move    y:(r3)+,y1        ;heat (shadeval base) = Y1
  167.     move    y:(r3)+,y0        ;col*128
  168.     move    #>128/2,x1
  169.     mpy    y0,x1,a    
  170.     move    a0,y0
  171.     move    #>colslide,a
  172.     add    y0,a    
  173.     move    a1,r1            
  174.  
  175.     move    #>32/2,x1
  176.     move    #>scalerx,a0        ;x0 - size
  177.     mac    x0,x1,a            ;32 wide table
  178.     move    a0,n5    
  179.     move    #>scalery,a0
  180.     mac    x0,x1,a    x0,n6        ;n6 = size
  181.     move    a0,r6    
  182.     move    #>192,n7            ;virtual screen wide
  183.     move    #>192*70,n4
  184.     
  185.     move    n5,r5
  186.     move    l:(r2+n2),x
  187.     move    #>$007f,n3
  188.     
  189.     do    n6,drawline
  190. ;------------------------------ DRAW SCANLINE OF PARTICLE
  191. ; r0/n0 y/x pos on shadegfx
  192. ; r1/n0 colbase/gfx-index (heat val)
  193. ; r2 vakio
  194. ; r5,r6 x/y prescale tables
  195. ; r7 screen pos, r4 linepos
  196. v5    equ    $7f7f7f
  197. v5b    equ    $7f7f7f
  198. v6    equ    $7f0000
  199. v6b    equ    $007f00
  200.  
  201.     move    y:(r6)+,r0        ;get shadegfx line
  202.     move    y:(r5)+,n0        ;prefeed eka step
  203. ; zekkaa kumpi rammi (x:0-69/y:70-139)
  204.     move    r7,a
  205.     move    #>screen+70*192,y0
  206.     cmp    y0,a    r7,r4
  207.     jge    select
  208.     
  209.     do    n6,drawpixelx
  210. ;------------------------------ DRAW PIXEL OF SCANLINE to X-RAM
  211.     move    x:(r0+n0),y0                ;hae kirkkausarvo
  212.     mpy    y0,y1,a    x:(r4),b            ;old gfx
  213.     move    a1,n1
  214.     move    y:(r2),y0
  215.     and    y0,b    x:(r1+n1),y0            ;get new col    
  216.     add    y0,b    y:(r5)+,n0            ;shade RGB (x7,x7,x7)
  217.  
  218.     jclr    #23,b1,no_R_overx
  219.     or    x1,b
  220. no_R_overx    
  221.     jclr    #15,b1,no_G_overx
  222.     or    x0,b
  223. no_G_overx
  224.     jclr    #7,b1,no_B_overx
  225.     move    n3,y0
  226.     or    y0,b
  227. no_B_overx
  228.     move    b1,x:(r4)+            ;write gfx
  229. drawpixelx
  230.     jmp    selectover
  231.  
  232. ;------------------------------------
  233. select
  234.     move    (r4)-n4
  235.     do    n6,drawpixely
  236. ;------------------------------ DRAW PIXEL OF SCANLINE to Y-RAM
  237.     move    x:(r0+n0),y0                ;hae kirkkausarvo
  238.     mpy    y0,y1,a    y:(r4),b            ;old gfx
  239.     move    a1,n1
  240.     move    y:(r2),y0
  241.     and    y0,b    x:(r1+n1),y0            ;get new col    
  242.     add    y0,b    y:(r5)+,n0            ;shade RGB (x7,x7,x7)
  243.  
  244.     jclr    #23,b1,no_R_overy
  245.     or    x1,b
  246. no_R_overy    
  247.     jclr    #15,b1,no_G_overy
  248.     or    x0,b
  249. no_G_overy
  250.     jclr    #7,b1,no_B_overy
  251.     move    n3,y0
  252.     or    y0,b
  253. no_B_overy
  254.     move    b1,y:(r4)+            ;write gfx
  255. drawpixely
  256. ;--------
  257. selectover
  258.     move    (r7)+n7
  259.     move    n5,r5
  260. drawline
  261. ;--------
  262.     nop
  263.     nop
  264. drawone
  265.     rts
  266.  
  267. ;------------------------------------
  268. ; get shadegfx 
  269. ;---------------------------------
  270.  
  271. key2
  272.     move    #shadegfx,r0
  273.     do    #32*32,filler2
  274. getpix2    movep    #1,X:PBC        
  275.     jclr    #0,x:HSR,getpix2        ;get shadegfx
  276.     move    x:HTX,x0
  277.     move    x0,x:(r0)+
  278. filler2
  279.  
  280.     move    #scalerx,r0
  281.     do    #32*32,getscalex
  282. getpix3    movep    #1,X:PBC        
  283.     jclr    #0,x:HSR,getpix3        ;prescaled X
  284.     move    x:HTX,x0,
  285.     move    x0,y:(r0)+
  286. getscalex
  287.  
  288.     move    #scalery,r0
  289.     move    #>shadegfx,x0
  290.     do    #32*32,getscaley
  291. getpix4    movep    #1,X:PBC        
  292.     jclr    #0,x:HSR,getpix4        ;prescaled Y
  293.     move    x:HTX,a
  294.     add    x0,a
  295.     move    a1,y:(r0)+
  296. getscaley
  297.  
  298. getpix5    movep    #1,X:PBC        
  299.     jclr    #0,x:HSR,getpix5        ;number of slides
  300.     move    x:HTX,x0
  301.     move    #colslide,r0
  302.  
  303.     do    x0,getcolhi
  304.     do    #128,getcollo
  305.  
  306. getpix6    movep    #1,X:PBC        
  307.     jclr    #0,x:HSR,getpix6        ;colslides
  308.     move    x:HTX,x0
  309.     move    x0,x:(r0)+
  310. getcollo
  311.     nop
  312.     nop
  313. getcolhi            
  314.     jmp    start
  315. ;------------------------------------
  316. ; motion blur
  317. ;----------------------------------
  318.  
  319. key3            
  320. ;    move    #screen-1,r0
  321.     move    #screen,r0
  322.     move    #screen,r1
  323. ;    move    #>$7e7e7e,y0
  324.     move    #>$787878,y0
  325. ;    move    x:(r0),a        ;for dummy write
  326. ;    move    y:(r1),b
  327.     clr    a
  328.     clr    b
  329.     move    #>192*70,x0        ;
  330.     do    x0,blur1
  331. ;----
  332. ;    and    y0,b    a1,x:(r0)+
  333. ;    lsr    b    x:(r0),a
  334. ;    and    y0,a    b1,y:(r1)+
  335. ;    lsr    a    y:(r1),b
  336.  
  337.     move    x:(r0),a1
  338.     and    y0,a    a1,b1
  339.     lsr    a
  340.     lsr    a
  341.     lsr    a
  342.     sub    a,b
  343.     move    b1,x:(r0)+
  344.  
  345.     move    y:(r1),a1
  346.     and    y0,a    a1,b1
  347.     lsr    a
  348.     lsr    a
  349.     lsr    a
  350.     sub    a,b
  351.     move    b1,y:(r1)+
  352.     
  353. blur1    
  354. ;----
  355.     move    a1,x:(r0)
  356.     jmp    start
  357.  
  358.  
  359. ;------------------------------------
  360. ;------------------------------------
  361. fix_vakiot
  362.     move    #vakio,r0
  363.     move    #>v1,x1
  364.     move    #>v1b,x0
  365.     move    x,l:(r0)+
  366.     move    #>v2,x1
  367.     move    #>v2b,x0
  368.     move    x,l:(r0)+
  369.     move    #>v3,x1
  370.     move    #>v3b,x0
  371.     move    x,l:(r0)+
  372.     move    #>v4,x1
  373.     move    #>v4b,x0
  374.     move    x,l:(r0)+
  375.     move    #>v5,x1
  376.     move    #>v5b,x0
  377.     move    x,l:(r0)+
  378.     move    #>v6,x1
  379.     move    #>v6b,x0
  380.     move    x,l:(r0)+
  381.     
  382.     rts
  383. ;------------------------------------
  384. ;read_one
  385. ;    movep    #1,X:PBC        
  386. ;    jclr    #0,x:HSR,read_one
  387. ;    move    x:HTX,a1
  388. ;
  389. ;write_one
  390. ;    jclr    #1,X:HSR,write_one
  391. ;    move    a1,X:HTX        
  392. ;---------------------------------
  393.  
  394.     org    x:$0
  395. vakio
  396.     ds    6    ;v1
  397. amount    ds    1
  398. shadegfx
  399.     ds    32*32
  400. colslide
  401.     ds    128*5        ;max 7 scales?
  402.     org    x:$b80
  403.     ds    1        ;ennen screeneja vapaata 2.9k
  404. screen                ;virtual screen (192*70 x, 192*70 y ,2*13.44k)
  405.  
  406.     org    y:$0
  407. vakio2    ds    6
  408. shadelist    
  409.     ds    5*160    ;x,y,heat,col,size
  410. scalerx
  411.     ds    32*32
  412. scalery
  413.     ds    32*32
  414.     end
  415.