home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Source / pheno.lha / pha / StrBars.S < prev    next >
Encoding:
Text File  |  1987-12-17  |  12.1 KB  |  485 lines

  1. ;------------------------------------------------------------------------
  2. ;-                                    -
  3. ;-                 Vector-Stars                -
  4. ;-                                    -
  5. ;------------------------------------------------------------------------
  6.  
  7. org    $20000
  8. load    $20000
  9.  
  10. AntBars:    =    6
  11.  
  12. ;------------------------------------------------------------------------
  13.  
  14. S:        movem.l    d0-d7/a0-a6,-(sp)
  15.         lea.l    $dff000,a6
  16.         bsr    Startup
  17.         bsr    InitRutin
  18.         bsr    StartCop
  19.         bsr    MainLoop
  20.         bsr    RestoreCop
  21.         movem.l    (sp)+,d0-d7/a0-a6
  22.         rts
  23.  
  24. Startup:    move.w    2(a6),d0
  25.         bset    #15,d0
  26.         move.w    d0,OldDma
  27.         move.w    $1c(a6),d0
  28.         bset    #15,d0
  29.         move.w    d0,OldIrq
  30.         move.l    $4,a6
  31.         lea.l    Lib(pc),a1
  32.         moveq    #0,d0
  33.         jsr    -408(a6)
  34.         move.l    d0,a0
  35.         move.l    $26(a0),OldCop
  36.         lea.l    $dff000,a6
  37.         rts
  38.  
  39. StartCop:    move.l    #CopperList,$80(a6)
  40.         tst.w    $88(a6)
  41.         move.w    #$7fff,$96(a6)
  42.         move.w    #$87c0,$96(a6)
  43.         move.w    #$7fff,$9a(a6)
  44.         move.w    #$c000,$9a(a6)
  45.         rts
  46.  
  47. RestoreCop:    move.l    OldCop(pc),$80(a6)
  48.         tst.w    $88(a6)
  49.         move.w    OldDma(pc),$96(a6)
  50.         move.w    OldIrq(pc),$9a(a6)
  51.         rts
  52.  
  53.     ;-----------------------------------------------------
  54.         OldCop:        dc.l    0
  55.         OldDma:        dc.w    0
  56.         OldIrq:        dc.w    0
  57.         Lib:        dc.b    'graphics.library',0
  58.                 even
  59.     ;-----------------------------------------------------
  60.  
  61. ;------------------------------------------------------------------------
  62.  
  63. BlitWait:    btst    #14,2(a6)
  64.         bne.S    BlitWait
  65.         rts
  66.  
  67. ClearScreen:    bsr.S    BlitWait
  68.         move.l    #-1,$44(a6)
  69.         move.l    #$01000000,$40(a6)
  70.         move.w    d2,$66(a6)
  71.         move.l    d0,$54(a6)
  72.         move.w    d1,$58(a6)
  73.         rts
  74.  
  75. ;------------------------------------------------------------------------
  76.  
  77. InitRutin:    move.l    CopAdr(pc),a0
  78.         move.l    CopAdr+4(pc),a1
  79.         lea.l    CopperList(pc),a2
  80. MLoop:        move.l    (a2),(a0)+
  81.         move.l    (a2)+,(a1)+
  82.         cmp.l    #-2,(a2)
  83.         bne.S    MLoop
  84.  
  85.         move.l    a0,d0
  86.         sub.l    CopAdr,d0
  87.         move.l    d0,CopAdd
  88.  
  89.         move.l    #$2007fffe,d0
  90.         move.l    #$01800000,d1
  91.         move.l    #$20ddfffe,d2
  92.         move.l    #$01000000,d3
  93.         move.w    #280-1,d7
  94. MLoop2:        move.l    d0,(a0)+
  95.         move.l    d0,(a1)+
  96.         move.l    d1,(a0)+
  97.         move.l    d1,(a1)+
  98.         move.l    d2,(a0)+
  99.         move.l    d2,(a1)+
  100.         add.l    d3,d0
  101.         add.l    d3,d2
  102.         dbra    d7,MLoop2
  103.         move.l    #-2,(a0)+
  104.         move.l    #-2,(a1)+
  105.  
  106.         lea.l    Sinus(pc),a0
  107.         lea.l    SinAdr,a1
  108.         move.w    #300-1,d7
  109. SLoop1:        move.w    (a0)+,d0
  110.         lsr.w    #1,d0
  111.         move.w    d0,(a1)+
  112.         dbra    d7,SLoop1
  113.         lea.l    SinAdr,a0
  114.         move.w    #300*9,d7
  115. SLoop2:        move.w    (a0)+,(a1)+
  116.         dbra    d7,SLoop2
  117.  
  118.         lea    MulsList,a0
  119.         moveq    #0,d0
  120.         move.w    #300-1,d7
  121. MLoop3:        move.w    d0,(a0)+
  122.         add.w    #12,d0
  123.         dbra    d7,MLoop3
  124.         rts
  125.  
  126. CopAdr:        dc.l    $60000
  127.         dc.l    $70000
  128. SinAdr:        =    $75000
  129. MulsList:    =    $7a000
  130.  
  131. CopAdd:        dc.l    0
  132.  
  133. ;------------------------------------------------------------------------
  134.  
  135. MainLoop:    cmp.b    #-1,$6(a6)
  136.         bne.S    MainLoop
  137. MainLoop2:    cmp.b    #$38,$6(a6)
  138.         bne.S    MainLoop2
  139.  
  140.         ;move.w    #$ff,$180(a6)
  141.         bsr    Bars
  142.         ;move.w    #$fff,$180(a6)
  143.  
  144.         btst    #6,$bfe001
  145.         bne.S    MainLoop
  146.         rts
  147.  
  148. ;------------------------------------------------------------------------
  149.  
  150. Bars:        bsr    Buffra
  151.         bsr    Rensa
  152.         bsr    NewSin
  153.         bsr    CalcPosses
  154.         bsr    Sortera
  155.         bsr    Blitta
  156.         rts
  157.  
  158. Sortera:    lea.l    Posses+2(pc),a0
  159.         lea.l    Posses2(pc),a1
  160.         moveq    #4,d6
  161.         moveq    #0,d2
  162.         move.w    #AntBars-1,d7
  163.         move.w    -2(a0),(a1)
  164.         move.w    (a0),2(a1)
  165.         move.w    (a0),d2
  166.         addq.l    #4,a0
  167.         subq.w    #1,d7
  168.  
  169.         bsr    BlitWait
  170.         move.l    #-1,$44(a6)
  171.         move.l    #$09f00002,$40(a6)
  172.         clr.l    $64(a6)
  173.         move.l    a1,$50(a6)
  174.         move.l    a1,$54(a6)
  175.  
  176. SortLoop:    move.w    (a0),d0
  177.         move.w    d6,d5
  178.         move.l    a1,a2
  179.         addq.w    #2,a2
  180.         cmp.w    d0,d2
  181.         blo.S    NoLow
  182.         move.w    -2(a0),(a1,d6.W)
  183.         addq.w    #2,d6
  184.         move.w    d0,(a1,d6.W)
  185.         addq.w    #2,d6
  186.         move.w    d0,d2
  187.         bra.S    Next
  188. NoLow:        cmp.w    (a2),d0
  189.         bge.S    MoveIt
  190.         addq.w    #4,a2
  191.         subq.w    #4,d5
  192.         bne.S    NoLow
  193. MoveIt:        move.l    a2,a4
  194.         add.w    d5,a2
  195.         move.l    a2,a3
  196.         addq.w    #4,a3
  197.         lsr.w    #1,d5
  198.         addq.w    #2,d5
  199.         lsl.w    #6,d5
  200.         addq.w    #1,d5
  201.         move.l    a2,$50(a6)
  202.         move.l    a3,$54(a6)
  203.         move.w    d5,$58(a6)
  204. WW:        btst    #14,$2(a6)
  205.         bne.S    WW
  206.         move.w    d0,(a4)
  207.         move.w    -2(a0),-2(a4)
  208.         addq.w    #4,d6
  209. Next:        addq.w    #4,a0
  210.         dbra    d7,SortLoop
  211.         rts
  212.  
  213. Buffra:        move.l    CopAdr(pc),d0
  214.         move.l    CopAdr+4(pc),CopAdr
  215.         move.l    d0,CopAdr+4
  216.         move.l    d0,$80(a6)
  217.         tst.w    $88(a6)
  218.         rts
  219.  
  220. Rensa:        move.l    CopAdr(pc),d0
  221.         add.l    CopAdd(pc),d0
  222.         addq.l    #6,d0
  223.         move.w    #12-2,d2
  224.         move.w    #280*64+1,d1
  225.         bsr    ClearScreen
  226.         rts
  227.  
  228. NewSin:        moveq    #0,d0
  229.         move.w    Oldie(pc),d0
  230.         add.w    #297,d0
  231.         cmp.w    #300,d0
  232.         bls.S    NoD
  233.         sub.w    #300,d0
  234. NoD:        move.w    d0,Oldie
  235.         add.w    d0,d0
  236.         add.l    #SinAdr,d0
  237.         move.l    d0,SinSave
  238.         moveq    #0,d0
  239.         move.w    Oldie2(pc),d0
  240.         addq.w    #2,d0
  241.         cmp.w    #300,d0
  242.         bls.S    NoD2
  243.         sub.w    #300,d0
  244. NoD2:        move.w    d0,Oldie2
  245.         add.w    d0,d0
  246.         add.l    #SinAdr,d0
  247.         move.l    d0,SinSave2
  248.  
  249.         move.w    ZVinkel(pc),d0
  250.         addq.w    #2,d0
  251.         cmp.w    #720,d0
  252.         bls.S    NoV1
  253.         sub.w    #720,d0
  254. NoV1:        move.w    d0,ZVinkel
  255.         rts
  256.  
  257. CalcPosses:    move.l    SinSave(pc),a0
  258.         move.l    SinSave2(pc),a1
  259.         lea.l    VecSin(pc),a2
  260.         lea.l    Posses(pc),a3
  261.         lea.l    MulsList,a4
  262.         move.w    ZVinkel(pc),d1
  263.         move.w    (a2,d1.W),d0
  264.         add.l    #180,a2
  265.         move.w    (a2,d1.W),d1
  266.         move.w    #-200,d2
  267.         move.w    #0,d6
  268.         move.w    #AntBars-1,d7
  269. CalcLoop:    move.w    d6,d3
  270.         move.w    d1,d4
  271.         muls    d3,d4
  272.         move.w    d0,d5
  273.         muls    d2,d5
  274.         sub.l    d5,d4
  275.         asl.l    #2,d4
  276.         swap    d4        ;Y
  277.         muls    d0,d3
  278.         move.w    d2,d5
  279.         muls    d1,d5
  280.         add.l    d3,d5
  281.         asl.l    #2,d5
  282.         swap    d5        ;Z
  283.         add.w    #140,d4
  284.         add.w    d4,d4
  285.         move.w    (a4,d4.W),(a3)+
  286.         add.w    #250,d5
  287.         move.w    d5,(a3)+
  288.         add.w    #46,d2
  289.         add.w    #12,a0
  290.         add.w    #18,a1
  291.         add.w    #32,d6
  292.         dbra    d7,CalcLoop
  293.         rts
  294.  
  295. Blitta:        move.l    CopAdr(pc),d0
  296.         add.l    CopAdd(pc),d0
  297.         addq.l    #6,d0
  298.         move.l    #Bar,d1
  299.         lea.l    Posses2(pc),a0
  300.         move.w    #32*64+1,d3
  301.         bsr    BlitWait
  302.         move.l    #-1,$44(a6)
  303.         move.l    #$09f00000,$40(a6)
  304.         move.w    #12-2,$66(a6)
  305.         clr.w    $64(a6)
  306.         move.l    d0,$54(a6)
  307.         move.l    d1,$50(a6)
  308.         lea.l    $52(a6),a1
  309.         lea.l    $56(a6),a2
  310.         lea.l    $58(a6),a3
  311.         move.w    #AntBars-1,d7
  312.  
  313. BLoop:        move.w    d0,d2
  314.         add.w    (a0),d2
  315.         move.w    d1,(a1)
  316.         move.w    d2,(a2)
  317.         move.w    d3,(a3)
  318.         addq.w    #4,a0
  319.         dbra    d7,BLoop
  320.         rts
  321.  
  322. Oldie:        dc.w    0
  323. SinSave:    dc.l    0
  324. Oldie2:        dc.w    0
  325. SinSave2:    dc.l    0
  326.  
  327. ZVinkel:    dc.w    0
  328.  
  329. Posses:        blk.w    AntBars*4,0
  330. Posses2:    blk.w    AntBars*4,0
  331.  
  332. Bar:        dc.w    0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
  333.         dc.w    $ff0,$ee0,$dd0,$cc0,$bb0,$aa0,$990,$880
  334.         dc.w    $770,$660,$550,$440,$330,$220,$110,$000
  335.  
  336. ;------------------------------------------------------------------------
  337.  
  338. CopperList:    dc.l    $008e4866,$009010c6,$00920030,$009400d8
  339.         dc.l    $01020000,$01040000,$01080000,$010a0000
  340.  
  341.         dc.l    $01800000
  342.         dc.l    $01000000
  343.  
  344.         dc.l    -2
  345.  
  346. ;------------------------------------------------------------------------
  347.  
  348. Sinus:    dc.w    240,240,240,240,240,239,239,239
  349.     dc.w    238,238,237,237,236,236,235,234
  350.     dc.w    233,232,232,231,230,229,227,226
  351.     dc.w    225,224,223,221,220,219,217,216
  352.     dc.w    214,212,211,209,207,206,204,202
  353.     dc.w    200,198,196,195,193,191,188,186
  354.     dc.w    184,182,180,178,176,173,171,169
  355.     dc.w    167,164,162,159,157,155,152,150
  356.     dc.w    147,145,142,140,138,135,133,130
  357.     dc.w    128,125,123,120,117,115,112,110
  358.     dc.w    107,105,102,100,98,95,93,90
  359.     dc.w    88,85,83,81,78,76,73,71
  360.     dc.w    69,67,64,62,60,58,56,54
  361.     dc.w    52,49,47,45,44,42,40,38
  362.     dc.w    36,34,33,31,29,28,26,24
  363.     dc.w    23,21,20,19,17,16,15,14
  364.     dc.w    13,11,10,9,8,8,7,6
  365.     dc.w    5,4,4,3,3,2,2,1
  366.     dc.w    1,1,0,0,0,0,0,0
  367.     dc.w    0,0,0,1,1,1,2,2
  368.     dc.w    3,3,4,4,5,6,7,8
  369.     dc.w    8,9,10,11,13,14,15,16
  370.     dc.w    17,19,20,21,23,24,26,28
  371.     dc.w    29,31,33,34,36,38,40,42
  372.     dc.w    44,45,47,49,52,54,56,58
  373.     dc.w    60,62,64,67,69,71,73,76
  374.     dc.w    78,81,83,85,88,90,93,95
  375.     dc.w    98,100,102,105,107,110,112,115
  376.     dc.w    117,120,123,125,128,130,133,135
  377.     dc.w    138,140,142,145,147,150,152,155
  378.     dc.w    157,159,162,164,167,169,171,173
  379.     dc.w    176,178,180,182,184,186,188,191
  380.     dc.w    193,195,196,198,200,202,204,206
  381.     dc.w    207,209,211,212,214,216,217,219
  382.     dc.w    220,221,223,224,225,226,227,229
  383.     dc.w    230,231,232,232,233,234,235,236
  384.     dc.w    236,237,237,238,238,239,239,239
  385.     dc.w    240,240,240,240
  386.  
  387.  
  388. VecSin:    dc.w    16384,16382,16374,16362,16344,16322,16294,16262
  389.     dc.w    16225,16182,16135,16083,16026,15964,15897,15826
  390.     dc.w    15749,15668,15582,15491,15396,15296,15191,15082
  391.     dc.w    14967,14849,14726,14598,14466,14330,14189,14044
  392.     dc.w    13894,13741,13583,13421,13255,13085,12911,12733
  393.     dc.w    12551,12365,12176,11982,11786,11585,11381,11174
  394.     dc.w    10963,10749,10531,10311,10087,9860,9630,9397
  395.     dc.w    9162,8923,8682,8438,8192,7943,7692,7438
  396.     dc.w    7182,6924,6664,6401,6137,5871,5603,5334
  397.     dc.w    5063,4790,4516,4240,3963,3685,3406,3126
  398.     dc.w    2845,2563,2280,1996,1712,1427,1142,857
  399.     dc.w    571,285,0,-285,-571,-857,-1142,-1428
  400.     dc.w    -1712,-1996,-2280,-2563,-2845,-3126,-3406,-3685
  401.     dc.w    -3963,-4240,-4516,-4790,-5063,-5334,-5603,-5871
  402.     dc.w    -6137,-6401,-6664,-6924,-7182,-7438,-7692,-7943
  403.     dc.w    -8192,-8438,-8682,-8923,-9162,-9397,-9630,-9860
  404.     dc.w    -10087,-10311,-10531,-10749,-10963,-11174,-11381,-11585
  405.     dc.w    -11786,-11982,-12176,-12365,-12551,-12733,-12911,-13085
  406.     dc.w    -13255,-13421,-13583,-13741,-13894,-14044,-14189,-14330
  407.     dc.w    -14466,-14598,-14726,-14849,-14967,-15082,-15191,-15296
  408.     dc.w    -15396,-15491,-15582,-15668,-15749,-15826,-15897,-15964
  409.     dc.w    -16026,-16083,-16135,-16182,-16225,-16262,-16294,-16322
  410.     dc.w    -16344,-16362,-16374,-16382,-16384,-16382,-16374,-16362
  411.     dc.w    -16344,-16322,-16294,-16262,-16225,-16182,-16135,-16083
  412.     dc.w    -16026,-15964,-15897,-15826,-15749,-15668,-15582,-15491
  413.     dc.w    -15396,-15296,-15191,-15082,-14968,-14849,-14726,-14598
  414.     dc.w    -14466,-14330,-14189,-14044,-13894,-13741,-13583,-13421
  415.     dc.w    -13255,-13085,-12911,-12733,-12551,-12365,-12176,-11982
  416.     dc.w    -11786,-11585,-11381,-11174,-10963,-10749,-10531,-10311
  417.     dc.w    -10087,-9860,-9630,-9397,-9162,-8923,-8682,-8438
  418.     dc.w    -8192,-7943,-7692,-7438,-7182,-6924,-6664,-6402
  419.     dc.w    -6137,-5871,-5604,-5334,-5063,-4790,-4516,-4240
  420.     dc.w    -3963,-3685,-3406,-3126,-2845,-2563,-2280,-1996
  421.     dc.w    -1712,-1428,-1143,-857,-572,-286,0,285
  422.     dc.w    571,857,1142,1427,1712,1996,2280,2562
  423.     dc.w    2844,3126,3406,3685,3963,4240,4515,4790
  424.     dc.w    5062,5334,5603,5871,6137,6401,6663,6924
  425.     dc.w    7182,7438,7691,7943,8192,8438,8682,8923
  426.     dc.w    9161,9397,9630,9860,10087,10310,10531,10748
  427.     dc.w    10963,11173,11381,11585,11785,11982,12175,12365
  428.     dc.w    12551,12732,12910,13085,13255,13421,13583,13740
  429.     dc.w    13894,14044,14189,14330,14466,14598,14726,14849
  430.     dc.w    14967,15081,15191,15296,15396,15491,15582,15668
  431.     dc.w    15749,15826,15897,15964,16026,16083,16135,16182
  432.     dc.w    16224,16262,16294,16322,16344,16361,16374,16382
  433.  
  434.     dc.w    16384,16382,16374,16362,16344,16322,16294,16262
  435.     dc.w    16225,16182,16135,16083,16026,15964,15897,15826
  436.     dc.w    15749,15668,15582,15491,15396,15296,15191,15082
  437.     dc.w    14967,14849,14726,14598,14466,14330,14189,14044
  438.     dc.w    13894,13741,13583,13421,13255,13085,12911,12733
  439.     dc.w    12551,12365,12176,11982,11786,11585,11381,11174
  440.     dc.w    10963,10749,10531,10311,10087,9860,9630,9397
  441.     dc.w    9162,8923,8682,8438,8192,7943,7692,7438
  442.     dc.w    7182,6924,6664,6401,6137,5871,5603,5334
  443.     dc.w    5063,4790,4516,4240,3963,3685,3406,3126
  444.     dc.w    2845,2563,2280,1996,1712,1427,1142,857
  445.     dc.w    571,285,0,-285,-571,-857,-1142,-1428
  446.     dc.w    -1712,-1996,-2280,-2563,-2845,-3126,-3406,-3685
  447.     dc.w    -3963,-4240,-4516,-4790,-5063,-5334,-5603,-5871
  448.     dc.w    -6137,-6401,-6664,-6924,-7182,-7438,-7692,-7943
  449.     dc.w    -8192,-8438,-8682,-8923,-9162,-9397,-9630,-9860
  450.     dc.w    -10087,-10311,-10531,-10749,-10963,-11174,-11381,-11585
  451.     dc.w    -11786,-11982,-12176,-12365,-12551,-12733,-12911,-13085
  452.     dc.w    -13255,-13421,-13583,-13741,-13894,-14044,-14189,-14330
  453.     dc.w    -14466,-14598,-14726,-14849,-14967,-15082,-15191,-15296
  454.     dc.w    -15396,-15491,-15582,-15668,-15749,-15826,-15897,-15964
  455.     dc.w    -16026,-16083,-16135,-16182,-16225,-16262,-16294,-16322
  456.     dc.w    -16344,-16362,-16374,-16382,-16384,-16382,-16374,-16362
  457.     dc.w    -16344,-16322,-16294,-16262,-16225,-16182,-16135,-16083
  458.     dc.w    -16026,-15964,-15897,-15826,-15749,-15668,-15582,-15491
  459.     dc.w    -15396,-15296,-15191,-15082,-14968,-14849,-14726,-14598
  460.     dc.w    -14466,-14330,-14189,-14044,-13894,-13741,-13583,-13421
  461.     dc.w    -13255,-13085,-12911,-12733,-12551,-12365,-12176,-11982
  462.     dc.w    -11786,-11585,-11381,-11174,-10963,-10749,-10531,-10311
  463.     dc.w    -10087,-9860,-9630,-9397,-9162,-8923,-8682,-8438
  464.     dc.w    -8192,-7943,-7692,-7438,-7182,-6924,-6664,-6402
  465.     dc.w    -6137,-5871,-5604,-5334,-5063,-4790,-4516,-4240
  466.     dc.w    -3963,-3685,-3406,-3126,-2845,-2563,-2280,-1996
  467.     dc.w    -1712,-1428,-1143,-857,-572,-286,0,285
  468.     dc.w    571,857,1142,1427,1712,1996,2280,2562
  469.     dc.w    2844,3126,3406,3685,3963,4240,4515,4790
  470.     dc.w    5062,5334,5603,5871,6137,6401,6663,6924
  471.     dc.w    7182,7438,7691,7943,8192,8438,8682,8923
  472.     dc.w    9161,9397,9630,9860,10087,10310,10531,10748
  473.     dc.w    10963,11173,11381,11585,11785,11982,12175,12365
  474.     dc.w    12551,12732,12910,13085,13255,13421,13583,13740
  475.     dc.w    13894,14044,14189,14330,14466,14598,14726,14849
  476.     dc.w    14967,15081,15191,15296,15396,15491,15582,15668
  477.     dc.w    15749,15826,15897,15964,16026,16083,16135,16182
  478.     dc.w    16224,16262,16294,16322,16344,16361,16374,16382
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.