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

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