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

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