home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !FALCON / AGGRESSN / MOTION.ZIP / MOTION / DSP / BEZIER6B.S56 < prev    next >
Text File  |  1995-08-01  |  11KB  |  521 lines

  1. ; Bezier dots.. v3.2
  2. ; screen 320*240, 3 planes (+100 x ylivuoto, +50 y ylivuoto)
  3. ; matto matikat, texturet, matto-objectit...
  4. ; mattocords/vakiot/kerrointable alarammissa jottei pixel matikka hyytyisi, x + 325!
  5. ; centeroi kordinaatit sign wordeista..
  6.  
  7. ; 30*30 matot.. 30*4 controlbezierit
  8.  
  9. PBC    equ    $ffe0
  10. HSR    equ    $ffe9
  11. HTX    equ    $ffeb
  12.  
  13. v1    equ    $0
  14. v1b    equ    $000080
  15. v2    equ    $0
  16. v2b    equ    $ff0000
  17. v3    equ    $0000ff
  18. v3b    equ    $008000
  19. v4    equ    $00ffff
  20. v4b    equ    $00ff00
  21. v5    equ    $000080
  22. v5b    equ    $0000ff
  23.  
  24.     org    p:$0
  25.     jmp    start
  26.  
  27.     dc    0,0,0,0,0,0,0,0,0,0
  28.     dc    0,0,0,0,0,0,0,0,0,0
  29.     dc    0,0,0,0,0,0,0,0,0,0
  30.     dc    0,0,0,0,0,0,0,0,0,0
  31.     dc    0,0,0,0,0,0,0,0,0,0
  32.     dc    0,0,0,0,0,0,0,0,0,0
  33.     dc    0,0,0,0
  34. start    
  35.     move    #>$ffff,m0
  36.     movep    #$0,x:$fffe        ;fix read
  37.     move    m0,m1        
  38.     move    m0,m2        
  39.     move    m0,m3        
  40.     move    m0,m4        
  41.     move    m0,m5        
  42.     move    m0,m6        
  43.     move    m0,m7        
  44.     jsr    fixvakiot
  45.  
  46.     move    #>$babe,x0
  47. x_ready    jclr    #1,X:HSR,x_ready
  48.     move    x0,X:HTX        
  49.  
  50. kasky    movep    #1,X:PBC        
  51.     jclr    #0,x:HSR,kasky
  52.     move    x:HTX,a
  53.     tst    a    #>1,x0
  54.     jeq    key0        ;feed matto cordinates (N,[txt number,16 x-y cord])
  55.     sub    x0,a
  56.     jeq    key1        ;render beziers to dsp screens
  57.     sub    x0,a
  58.     jeq    key2        ;feed screens to CPU, clear screens + scrol planeorder
  59.     sub    x0,a
  60.     jeq    key3        ;feed kerroin, make offset        
  61.     sub    x0,a
  62.     jeq    key4        ;cleraa ruutu ekalle framelle
  63.     sub    x0,a
  64.     jeq    key5        ;feed one texture (txt number 0-11,32*32 3 bit data)
  65.  
  66.     jmp    start
  67. ;---------------------------------------
  68. key0
  69. wsync    movep    #1,X:PBC        ;get matto N
  70.     jclr    #0,x:HSR,wsync
  71.     move    x:HTX,x1
  72.     move    x1,y:mattoN
  73.  
  74.     move    #control,r0
  75.     move    #txtlist,r1
  76.     do    x1,getmattodata
  77.  
  78. wsync2    movep    #1,X:PBC        ;get txt number > txt address to list
  79.     jclr    #0,x:HSR,wsync2
  80.     move    x:HTX,x1
  81.     move    #>450,x0        ;30*30 /2
  82.     move    #>texture,a0
  83.     mac    x0,x1,a    
  84.     move    a0,y:(r1)+
  85.     
  86.     do    #16,getcords
  87. wsync3    movep    #1,X:PBC        ;get x
  88.     jclr    #0,x:HSR,wsync3
  89.     move    x:HTX,x0
  90.     move    x0,x:(r0)+
  91. wsync4    movep    #1,X:PBC        ;get y
  92.     jclr    #0,x:HSR,wsync4
  93.     move    x:HTX,x0
  94.     move    x0,x:(r0)+
  95. getcords
  96.     nop
  97. getmattodata
  98.  
  99.     move    #control,r0
  100.     move    #>$7fff-(offset+260),y0            ; x fix
  101.     move    y:mattoN,n7
  102.     move    #>$7fff-170,y1                ; y fix
  103.     move    #>offset+519,x1                ; x max 100+320+100
  104.     move    #>offset,n1                ; x min
  105.     move    #>339,n0                ; y max 50+240+50 
  106.     clr    b
  107.  
  108.     do    n7,scalecords
  109.     do    #16,scaleones
  110.     move    x:(r0),a        ;x
  111.     sub    y0,a    n1,x0        ;zenteroi
  112. ;    cmp    x0,a
  113. ;    tlt    x0,a            ;x ali
  114. ;    cmp    x1,a
  115. ;    tgt    x1,a            ;X yli
  116.     move    a1,x:(r0)+
  117.     move    x:(r0),a        ;y
  118.     sub    y1,a    n0,x0        ;zenteroi
  119. ;    tmi    b,a            ;y ali
  120. ;    cmp    x0,a
  121. ;    tgt    x0,a            ;y yli
  122.     move    a1,x:(r0)+
  123.  
  124. scaleones
  125.     nop
  126.     nop
  127. scalecords
  128.     jmp    start
  129. ;---------------------------------------
  130. key1
  131.     move    #>txtlist,x0        ;settaa listat
  132.     move    x0,y:Dtxtlist
  133.     move    #>control,x0
  134.     move    x0,y:Dcontrol
  135.  
  136.     move    y:mattoN,x0
  137.     do    x0,loop_matot
  138.     jsr    calc.control
  139.     jsr    render.matto    
  140.     nop
  141.     nop
  142. loop_matot
  143.     jmp    start
  144. ;-------------------
  145. calc.control
  146.     move    y:Dcontrol,r0
  147.     move    #7,n0
  148.     move    #kerroin,r4
  149.     move    #120,n4
  150.     move    #mattocontrol,r1
  151.     move    #5,n1            ;steppi seuraavan bezierin samaan kontrollipisteeseen
  152.  
  153. ;----- X1/Y1 controlpoints -----------
  154.     do    #30,controlpixel1
  155.     move        x:(r0)+,x1    y:(r4)+,y0
  156.     mpy    y0,x1,a    x:(r0)+,x0
  157.     mpy    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  158.  
  159.     mac    y0,x1,a    x:(r0)+,x0
  160.     mac    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  161.  
  162.     mac    y0,x1,a    x:(r0)+,x0
  163.     mac    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  164.  
  165.     mac    y0,x1,a    x:(r0)-n0,x0
  166.     mac    y0,x0,b    a1,x:(r1)+
  167.     move        b1,x:(r1)+n1
  168. controlpixel1
  169. ;-------------
  170.     move    (r0)+n0                ;seuraavat lahtokontrollit
  171.     move    (r0)+
  172.     move    (r4)-n4                ;kerroin alkuun
  173.     move    #mattocontrol+2,r1
  174. ;----- X2/Y2 controlpoints -----------
  175.     do    #30,controlpixel2
  176.     move        x:(r0)+,x1    y:(r4)+,y0
  177.     mpy    y0,x1,a    x:(r0)+,x0
  178.     mpy    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  179.  
  180.     mac    y0,x1,a    x:(r0)+,x0
  181.     mac    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  182.  
  183.     mac    y0,x1,a    x:(r0)+,x0
  184.     mac    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  185.  
  186.     mac    y0,x1,a    x:(r0)-n0,x0
  187.     mac    y0,x0,b    a1,x:(r1)+
  188.     move        b1,y:(r1)+n1
  189. controlpixel2
  190. ;-------------
  191.     move    (r0)+n0                ;seuraavat lahtokontrollit
  192.     move    (r0)+
  193.     move    (r4)-n4                ;kerroin alkuun
  194.     move    #mattocontrol+3,r1
  195. ;----- X3/Y3 controlpoints -----------
  196.     do    #30,controlpixel3
  197.     move        x:(r0)+,x1    y:(r4)+,y0
  198.     mpy    y0,x1,a    x:(r0)+,x0
  199.     mpy    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  200.  
  201.     mac    y0,x1,a    x:(r0)+,x0
  202.     mac    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  203.  
  204.     mac    y0,x1,a    x:(r0)+,x0
  205.     mac    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  206.  
  207.     mac    y0,x1,a    x:(r0)-n0,x0
  208.     mac    y0,x0,b    a1,x:(r1)+
  209.     move        b1,x:(r1)+n1
  210. controlpixel3
  211. ;-------------
  212.     move    (r0)+n0                ;seuraavat lahtokontrollit
  213.     move    (r0)+
  214.     move    (r4)-n4                ;kerroin alkuun
  215.     move    #7,n1
  216.     move    #mattocontrol+5,r1
  217. ;----- X4/Y4 controlpoints -----------
  218.     do    #30,controlpixel4
  219.     move        x:(r0)+,x1    y:(r4)+,y0
  220.     mpy    y0,x1,a    x:(r0)+,x0
  221.     mpy    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  222.  
  223.     mac    y0,x1,a    x:(r0)+,x0
  224.     mac    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  225.  
  226.     mac    y0,x1,a    x:(r0)+,x0
  227.     mac    y0,x0,b    x:(r0)+,x1    y:(r4)+,y0
  228.  
  229.     mac    y0,x1,a    x:(r0)-n0,x0
  230.     mac    y0,x0,b    a1,x:(r1)-
  231.     move        b1,y:(r1)+n1
  232. controlpixel4
  233. ;-------------
  234.     move    (r0)+n0
  235.     move    (r0)+
  236.     move    r0,y:Dcontrol
  237.     rts
  238.  
  239. ;-------------------------------------------------
  240. render.matto
  241.     move    y:Dtxtlist,r4
  242.     move    #mattocontrol,r0            ;4 * x,y
  243.     move    y:(r4)+,r6                ;get txt address
  244.     move    r4,y:Dtxtlist
  245.     move    #mattocontrol+3,r5
  246.     move    #kerroin,r4
  247.     move    #120,n4
  248.     move    #-5,n0
  249.     move    #6,n5
  250.     do    #30,render32beziers
  251. ;-------------------------------------- piirra yksi bezier
  252.     move    #screen,r3                ;hukkapixel
  253.     move        x:(r0)+,x0    y:(r4)+,y0    ;con1x, kerroin1
  254.     mpy    y0,x0,a    x:(r0)+,x1            ;con1y
  255.     mpy    y0,x1,b    x:(r0)+,x0    y:(r4)+,y1    ;con2x, kerroin 2    
  256.  
  257.     mac    y1,x0,a            y:(r5)+,y0    ;con2y
  258.     mac    y1,y0,b    x:(r0)+,x1    y:(r4)+,y0    ;con3x, kerroin3
  259.  
  260.     mac    y0,x1,a    x:(r0)+,x1    y:(r4)+,y1    ;con3y, kerroin4
  261.     mac    y0,x1,b    x:(r0)+n0,x1    y:(r5)-,y0    ;con4x, con4y
  262.  
  263.     mac    y1,x1,a    y:(r6)+,n7    
  264.     mac    y1,y0,b    a1,r7
  265.  
  266.     move                y:(r4)+,y0    ;kerroin1
  267.     move        x:(r0)+,x0    y:(r7)+n7,y1    ;con1x, Xinc
  268.  
  269.     do    #29,render32pixels
  270. ;------------------------------- piirra yksi dotti
  271.     add    y1,b    x:(r0)+,x1    y:(r4)+,y1    ;con1y, kerroin2
  272.  
  273.     mpy    y0,x0,a    a1,x:(r3)
  274.     mpy    y0,x1,b    b1,r3
  275.  
  276.     move        x:(r0)+,x0    y:(r5)+,y0    ;con2x, con2y
  277.     mac    y1,x0,a    x:(r7),x0            ;bit mask
  278.     mac    y1,y0,b    x:(r0)+,x1    y:(r4)+,y0    ;con3x, kerroin3
  279.  
  280.     mac    y0,x1,a    x:(r0)+,x1    y:(r4)+,y1    ;con3y, kerroin4
  281.     mac    y0,x1,b    x:(r0)+n0,x1    y:(r5)-,y0    ;con4x, con4y
  282.  
  283.     mac    y1,x1,a    y:(r6)+,n7
  284.     mac    y1,y0,b    a1,r7
  285.  
  286.     move        x:(r3),a    y:(r4)+,y0    ;kerroin1
  287.     or    x0,a    x:(r0)+,x0    y:(r7)+n7,y1    ;con1x, Xinc > point mask
  288. render32pixels    
  289. ;----------------
  290.     add    y1,b    a1,x:(r3)            ;write old back
  291.     move        b1,r3    
  292.     move        x:(r7),x0
  293.     move        x:(r3),a
  294.     or    x0,a    (r4)-n4                ;kerrointaulun alkuun
  295.     move        a1,x:(r3)
  296.     move    (r4)-                ;fixaa vika kerroin1 lisays
  297.     move    (r0)-n0
  298.     move    (r5)+n5                ;siirry seuraaviin kontrollipisteisiin
  299. render32beziers
  300. ;------------    
  301.     rts
  302. ;------------------------------------
  303. key2
  304.     move    #screen+50,r1
  305.     move    #290,n0            ;240+50
  306.     move    #vakio,r7
  307.     move    #4,n7
  308.     move    #>238,x1
  309.     do    x1,givescreen2
  310. ; Y loop ----------------
  311.  
  312.     move    r1,r0
  313.     move    (r1)+
  314.     move    x:(r0)+n0,x1
  315.     move    #>20,y0                ;kelaa kaikki scanlinet columneista
  316.     do    y0,givescreen1
  317. ; X loop ----------------
  318. ;123 123 - screeni byteplanarina, 3 planea
  319. ;a   b     feed conv gfx to cpu + shift/clear screen (lsl #8,gfx)
  320. ;
  321. ;b   xx1.230
  322. ;&a  100.000
  323. ;&b  001.230    >toka clear
  324. ;+a  x11.230    >cpu eka
  325. ;
  326. ;&b  023.000
  327. ;&a  020.000
  328. ;+a  022.300    >cpu toka  
  329. ;
  330. ;<<a xx1.230    >eka clear
  331. ;&b  003.000
  332. ;+b  233.000    >cpu kolmas
  333.  
  334.     move        x:(r0),x0    y:(r7)+,y1    ;2^7
  335.     mpy    y1,x0,b            y:(r7)+,a1    ;$ff0000
  336.     and    x1,a    l:(r7)+,y            ;$0000ff, 2^15
  337.     and    y1,b    a1,y1
  338.     mac    y0,y1,b    b0,x:(r0)-n0            ;toka write back
  339.  
  340. w1    jclr    #1,x:HSR,w1
  341.     move    b1,x:HTX            ;eka plane
  342.  
  343.     move        x:(r7),b            ;$00ffff
  344.     and    x0,b            y:(r7)+,a    ;$00ff00
  345.     and    x1,a    b1,y1
  346.     mac    y0,y1,a    x:(r7),y0            ;y0 - 2^15 , new 2^7
  347.  
  348. w2    jclr    #1,x:HSR,w2
  349.     move    a1,x:HTX            ;toka plane
  350.  
  351.     mpy    y0,x1,a    y:(r7)-n7,b            ;$0000ff
  352.     and    x0,b    a0,y0
  353.     add    y0,b    a0,x:(r0)+n0        ;eka write back
  354.     move    (r0)+n0
  355.     move    x:(r0)+n0,x1
  356.  
  357. w3    jclr    #1,x:HSR,w3
  358.     move    b1,x:HTX            ;kolmas plane
  359.  
  360. givescreen1
  361. ;--------
  362.     nop
  363. givescreen2
  364.     jmp    start
  365. ;------------------------------------
  366. fixvakiot
  367.     move    #vakio,r0
  368.     move    #>v1,x1
  369.     move    #>v1b,x0
  370.     move    x,l:(r0)+
  371.     move    #>v2,x1
  372.     move    #>v2b,x0
  373.     move    x,l:(r0)+
  374.     move    #>v3,x1
  375.     move    #>v3b,x0
  376.     move    x,l:(r0)+
  377.     move    #>v4,x1
  378.     move    #>v4b,x0
  379.     move    x,l:(r0)+
  380.     move    #>v5,x1
  381.     move    #>v5b,x0
  382.     move    x,l:(r0)+
  383.     rts
  384. ;-------------------
  385. key3
  386.     move    #kerroin,r0
  387.     move    #>120,x0            ;30 * 4
  388.     do    x0,qqqw2
  389.     
  390. qqq2    movep    #1,X:PBC        
  391.     jclr    #0,x:HSR,qqq2
  392.     move    x:HTX,x0
  393.     move    x0,y:(r0)+
  394. qqqw2
  395.  
  396. make_offset
  397.     move    #offset,r0
  398.  
  399.     move    #siftit,r1        ;color-table, next color-table
  400.     do    #8,gencolor
  401.  
  402.     move    #>screen,a1
  403.     clr    b    #>100,x0
  404.     do    x0,vara1
  405.     move    b1,x:(r0)        ;nollaa X 0-99
  406.     move    a1,y:(r0)+
  407. vara1
  408.  
  409.     move    p:(r1)+,y0
  410.     move    #>290,x0        ;240+50
  411.     move    #>screen,a
  412.     do    #40,gener        ;320/8
  413.  
  414.     move    y0,b1        ;3 planes
  415.  
  416.     do    #8,gen2
  417.     move    a1,y:(r0)    
  418.     move    b1,x:(r0)+
  419.     lsr    b
  420. gen2
  421.     add    x0,a
  422.     nop
  423. gener
  424.     move    #>screen,a1
  425.     clr    b    #>100,x0
  426.     do    x0,vara2
  427.     move    b1,x:(r0)        ;nollaa X 0-99
  428.     move    a1,y:(r0)+
  429. vara2
  430.     nop
  431.     nop
  432. gencolor
  433.     jmp    start
  434.  
  435. siftit
  436.     dc    $000000
  437.     dc    $800000
  438.     dc    $008000
  439.     dc    $808000
  440.     dc    $000080
  441.     dc    $800080
  442.     dc    $008080
  443.     dc    $808080
  444. ;-------------------
  445. key4
  446.     move    #screen+50,r0
  447.     clr    a    #50,n0
  448.     move    #>240,x0
  449.     do    #40,clearloop
  450.     rep    x0
  451.     move    a,x:(r0)+
  452.     move    (r0)+n0
  453.     nop
  454. clearloop
  455.     jmp    start
  456. ;-------------------
  457. key5
  458. txtpos    movep    #1,X:PBC        
  459.     jclr    #0,x:HSR,txtpos
  460.     move    x:HTX,x0
  461.     move    #>450,x1        ;30*30/2
  462.     move    #texture,a0
  463.     mac    x0,x1,a
  464.     move    a0,r0            ;texture position
  465.  
  466.     move    #>900,x0
  467.     move    #>260,x1        ;x offset_table wide/2!
  468.     do    x0,qqqw
  469.         
  470. qqq    movep    #1,X:PBC        
  471.     jclr    #0,x:HSR,qqq
  472.     move    x:HTX,x0
  473.     mpy    x1,x0,a
  474.     move    a0,y:(r0)+
  475. qqqw
  476.     jmp    start
  477. ;-------------------
  478. ;read_one
  479. ;    movep    #1,X:PBC        
  480. ;    jclr    #0,x:HSR,read_one
  481. ;    move    x:HTX,a1
  482. ;write_one
  483. ;    jclr    #1,X:HSR,write_one
  484. ;    move    a1,X:HTX        
  485. ;---------------------
  486. ;jako                        ;divs x0,a (signed $123.456)
  487. ;    rep    #12
  488. ;    asr    a
  489. ;    andi    #$fe,ccr            ;clear carry
  490. ;    rep    #24
  491. ;    div    x0,a
  492. ;    asl    a
  493. ;    jclr    #23,x0,pos_diver
  494. ;    neg    a
  495. ;pos_diver
  496. ;    rts        ;signed result in a0 (finally WORKS!!!)
  497. ;---------------------------------
  498.     org    x:$0
  499. mattocontrol    ds    180
  500. vakio        ds    5
  501.         ds    120
  502. offset        ds    4160        ;bittimaskit (8)
  503.  
  504. control        ds    320        ;matoillelle x,y
  505. screen        ds    11600        ;320*240+50/8 (ekat 50 alivuotovaraa)
  506.         ds    50        ;ylivuoto screenvara 50 lines 
  507.  
  508.  
  509.     org    y:$0
  510. mattocontrol2    ds    180
  511. vakiob        ds    5
  512. kerroin        ds    120
  513. offset2        ds    4160        ;100+320+100 x positionia (520*8)
  514.  
  515. mattoN        ds    1
  516. txtlist        ds    10
  517. Dcontrol    ds    1        ;pointerit N maton control/txtlistaan
  518. Dtxtlist    ds    1
  519. texture        ds    11700        ;13 30*30 mappia
  520.     end
  521.