home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Source / pheno.lha / pha / VectorBobs2.S < prev    next >
Encoding:
Text File  |  1987-12-17  |  12.3 KB  |  535 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.  
  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.         moveq    #44-40,d2
  204.         move.w    #200*64*3+20,d1
  205.         bsr    ClearScreen
  206.         rts
  207.  
  208. VinkelAdd:    lea.l    Vinklar(pc),a0
  209.         lea.l    VAdds(pc),a1
  210.         move.w    #720,d1
  211.         moveq    #3-1,d7
  212. VAddLoop:    move.w    (a0),d0
  213.         add.w    (a1)+,d0
  214.         cmp.w    d1,d0
  215.         bls.S    Nothing
  216.         sub.w    d1,d0
  217. Nothing:    move.w    d0,(a0)+
  218.         dbra    d7,VAddLoop
  219.         rts
  220.  
  221. Rakna:        lea.l    Sinus+180(pc),a1
  222.         lea.l    Sinus(pc),a2
  223.         lea.l    Vinklar(pc),a3
  224.         lea.l    Posses(pc),a4
  225.         lea.l    Per,a5
  226.  
  227.         lea.l    CalcUp(pc),a6
  228.         move.w    (a3),d0
  229.         move.w    (a1,d0.W),(a6)+
  230.         move.w    (a2,d0.W),(a6)+
  231.         move.w    4(a3),d0
  232.         move.w    (a1,d0.W),(a6)+
  233.         move.w    (a2,d0.W),(a6)+
  234.         move.w    2(a3),d0
  235.         move.w    (a1,d0.W),(a6)+
  236.         move.w    (a2,d0.W),(a6)+
  237.  
  238.         lea.l    CalcUp(pc),a1
  239.         lea.l    MulsList,a6
  240.         move.l    a7,SPSave
  241.         lea.l    ObjX(pc),a0
  242.         lea.l    ObjY(pc),a2
  243.         lea.l    ObjZ(pc),a7
  244.         move.w    AntBobs,d7
  245.  
  246. RakneLoop:    move.w    (a1)+,d1
  247.         move.w    (a1)+,d2
  248.  
  249.         move.w    (a2),d3
  250.         muls    d2,d3
  251.         move.w    (a7),d4
  252.         muls    d1,d4
  253.         sub.l    d4,d3
  254.         asl.l    #2,d3
  255.         swap    d3        ;Y
  256.         move.w    (a2)+,d4
  257.         muls    d1,d4
  258.         move.w    (a7)+,d5
  259.         muls    d2,d5
  260.         add.l    d5,d4
  261.         asl.l    #2,d4
  262.         swap    d4        ;Z
  263.  
  264.         move.w    (a1)+,d1
  265.         move.w    (a1)+,d2
  266.         move.w    (a0),d5
  267.         muls    d2,d5
  268.         move.w    d3,d6
  269.         muls    d1,d6
  270.         sub.l    d6,d5
  271.         asl.l    #2,d5
  272.         swap    d5        ;X
  273.         move.w    (a0)+,d6
  274.         muls    d1,d6
  275.         muls    d2,d3
  276.         add.l    d6,d3
  277.         asl.l    #2,d3
  278.         swap    d3        ;Y
  279.  
  280.         move.w    (a1)+,d1
  281.         move.w    (a1)+,d2
  282.         move.w    d5,d0
  283.         muls    d2,d0
  284.         move.w    d4,d6
  285.         muls    d1,d6
  286.         sub.l    d6,d0
  287.         asl.l    #2,d0
  288.         swap    d0        ;X
  289.         muls    d1,d5
  290.         muls    d2,d4
  291.         add.l    d5,d4
  292.         asl.l    #2,d4
  293.         swap    d4        ;Z
  294.  
  295.         add.w    #256,d4
  296.         add.w    d4,d4
  297.         move.w    (a5,d4.W),d2
  298.         muls    d2,d0
  299.         muls    d2,d3
  300.         lsl.l    #6,d0
  301.         lsl.l    #6,d3
  302.         swap    d0
  303.         swap    d3
  304.  
  305.         add.w    #176,d0
  306.         add.w    #100,d3
  307.  
  308.         move.w    d0,d1
  309.         lsr.w    #3,d0
  310.         and.w    #$f,d1
  311.         ror.w    #4,d1
  312.         add.w    d3,d3
  313.         move.w    (a6,d3.W),d3
  314.         add.w    d3,d0
  315.  
  316.         move.w    d0,(a4)+
  317.         move.w    d1,(a4)+
  318.         move.w    d4,(a4)+
  319.         lea.l    -12(a1),a1
  320.         dbra    d7,RakneLoop
  321.         lea.l    $dff000,a6
  322.         move.l    SPSave(pc),a7
  323.         rts
  324.  
  325. SPSave:        dc.l    0
  326.  
  327. Plotta:        lea.l    Posses2(pc),a0
  328.         move.l    Screen(pc),d0
  329.         move.l    BobAdr(pc),d1
  330.         move.l    d1,d2
  331.         add.l    #15*2*3,d2
  332.         move.w    #15*64*3+2,d3
  333.         move.w    #$fca,d6
  334.  
  335.         bsr    BlitWait
  336.         move.l    #$ffff0000,$44(a6)
  337.         move.w    #2-4,$62(a6)
  338.         move.w    #2-4,$64(a6)
  339.         move.w    #44-4,$60(a6)
  340.         move.w    #44-4,$66(a6)
  341.         move.l    d0,$48(a6)
  342.         move.l    d0,$54(a6)
  343.         move.l    d1,$4c(a6)
  344.         move.l    d2,$50(a6)
  345.  
  346.         lea.l    $40(a6),a1
  347.         lea.l    $4a(a6),a2
  348.         lea.l    $4e(a6),a3
  349.         lea.l    $52(a6),a4
  350.         lea.l    $56(a6),a5
  351.         lea.l    $58(a6),a6
  352.  
  353.         move.w    AntBobs(pc),d7
  354.  
  355. PlotLoop:    move.w    d0,d4
  356.         add.w    (a0)+,d4
  357.         move.w    (a0)+,d5
  358.         move.w    d5,2(a1)
  359.         add.w    d6,d5
  360.         move.w    d5,(a1)
  361.         move.w    d4,(a2)
  362.         move.w    d4,(a5)
  363.         move.w    d1,(a3)
  364.         move.w    d2,(a4)
  365.         move.w    d3,(a6)
  366.         addq.w    #2,a0
  367.         dbra    d7,PlotLoop
  368.         lea.l    $dff000,a6
  369.         rts
  370.  
  371.     ;--------------------------------------------------
  372.  
  373.         Screen:        dc.l    $60000
  374.                 dc.l    $70000
  375.  
  376.         BMapSize:    =    280*44
  377.  
  378.         Posses:        blk.w    400*3,0
  379.         Posses2:    blk.w    400*3,0
  380.         CalcUp:        blk.w    3*2,0
  381.         BobAdr:        dc.l    0
  382.  
  383.         Vinklar:    dc.w    0
  384.                 dc.w    0
  385.                 dc.w    0
  386.  
  387.         VAdds:        dc.w    12
  388.                 dc.w    4
  389.                 dc.w    6
  390.  
  391.     ;--------------------------------------------------
  392.  
  393. ObjX:
  394. dc.w    40,20,0,-20,-40,40,20,0,-20,-40,40,20,0,-20,-40,40,20,0,-20,-40
  395. blk.w    12,40
  396. blk.w    12,-40
  397. blk.w    8,0
  398. dc.w    70,50,30,10,-10,-30,-50,-70
  399. blk.w    8,0
  400.  
  401. ObjY:
  402. blk.w    10,40
  403. blk.w    10,-40
  404. dc.w    40,40,40,20,0,-20,-40,-40,-40,-20,0,20
  405. dc.w    40,40,40,20,0,-20,-40,-40,-40,-20,0,20
  406. dc.w    70,50,30,10,-10,-30,-50,-70
  407. blk.w    8,0
  408. blk.w    8,0
  409.  
  410. ObjZ:
  411. blk.w    5,40
  412. blk.w    5,-40
  413. blk.w    5,40
  414. blk.w    5,-40
  415. dc.w    -20,0,20,40,40,40,20,0,-20,-40,-40,-40
  416. dc.w    -20,0,20,40,40,40,20,0,-20,-40,-40,-40
  417. blk.w    8,0
  418. blk.w    8,0
  419. dc.w    70,50,30,10,-10,-30,-50,-70
  420.  
  421. AntBobs:    dc.w    68-1
  422.  
  423. ;------------------------------------------------------------------------
  424.  
  425. CopperList:    dc.l    $008e4866,$009010c6,$00920030,$009400d8
  426.         dc.l    $01020000,$01040000,$01080058,$010a0058
  427.  
  428. Cols:        dc.l    $01800000,$01820000,$01840000,$01860000
  429.         dc.l    $01880000,$018a0000,$018c0000,$018e0000
  430. BMap:        dc.l    $00e00000,$00e20000,$00e40000,$00e60000
  431.         dc.l    $00e80000,$00ea0000
  432.         dc.l    $01003000
  433.  
  434.         dc.l    -2
  435.  
  436. ;------------------------------------------------------------------------
  437.  
  438. Per:        =    $30000
  439. Bob:        =    $33000
  440.  
  441. Sinus:    dc.w    16384,16382,16374,16362,16344,16322,16294,16262
  442.     dc.w    16225,16182,16135,16083,16026,15964,15897,15826
  443.     dc.w    15749,15668,15582,15491,15396,15296,15191,15082
  444.     dc.w    14967,14849,14726,14598,14466,14330,14189,14044
  445.     dc.w    13894,13741,13583,13421,13255,13085,12911,12733
  446.     dc.w    12551,12365,12176,11982,11786,11585,11381,11174
  447.     dc.w    10963,10749,10531,10311,10087,9860,9630,9397
  448.     dc.w    9162,8923,8682,8438,8192,7943,7692,7438
  449.     dc.w    7182,6924,6664,6401,6137,5871,5603,5334
  450.     dc.w    5063,4790,4516,4240,3963,3685,3406,3126
  451.     dc.w    2845,2563,2280,1996,1712,1427,1142,857
  452.     dc.w    571,285,0,-285,-571,-857,-1142,-1428
  453.     dc.w    -1712,-1996,-2280,-2563,-2845,-3126,-3406,-3685
  454.     dc.w    -3963,-4240,-4516,-4790,-5063,-5334,-5603,-5871
  455.     dc.w    -6137,-6401,-6664,-6924,-7182,-7438,-7692,-7943
  456.     dc.w    -8192,-8438,-8682,-8923,-9162,-9397,-9630,-9860
  457.     dc.w    -10087,-10311,-10531,-10749,-10963,-11174,-11381,-11585
  458.     dc.w    -11786,-11982,-12176,-12365,-12551,-12733,-12911,-13085
  459.     dc.w    -13255,-13421,-13583,-13741,-13894,-14044,-14189,-14330
  460.     dc.w    -14466,-14598,-14726,-14849,-14967,-15082,-15191,-15296
  461.     dc.w    -15396,-15491,-15582,-15668,-15749,-15826,-15897,-15964
  462.     dc.w    -16026,-16083,-16135,-16182,-16225,-16262,-16294,-16322
  463.     dc.w    -16344,-16362,-16374,-16382,-16384,-16382,-16374,-16362
  464.     dc.w    -16344,-16322,-16294,-16262,-16225,-16182,-16135,-16083
  465.     dc.w    -16026,-15964,-15897,-15826,-15749,-15668,-15582,-15491
  466.     dc.w    -15396,-15296,-15191,-15082,-14968,-14849,-14726,-14598
  467.     dc.w    -14466,-14330,-14189,-14044,-13894,-13741,-13583,-13421
  468.     dc.w    -13255,-13085,-12911,-12733,-12551,-12365,-12176,-11982
  469.     dc.w    -11786,-11585,-11381,-11174,-10963,-10749,-10531,-10311
  470.     dc.w    -10087,-9860,-9630,-9397,-9162,-8923,-8682,-8438
  471.     dc.w    -8192,-7943,-7692,-7438,-7182,-6924,-6664,-6402
  472.     dc.w    -6137,-5871,-5604,-5334,-5063,-4790,-4516,-4240
  473.     dc.w    -3963,-3685,-3406,-3126,-2845,-2563,-2280,-1996
  474.     dc.w    -1712,-1428,-1143,-857,-572,-286,0,285
  475.     dc.w    571,857,1142,1427,1712,1996,2280,2562
  476.     dc.w    2844,3126,3406,3685,3963,4240,4515,4790
  477.     dc.w    5062,5334,5603,5871,6137,6401,6663,6924
  478.     dc.w    7182,7438,7691,7943,8192,8438,8682,8923
  479.     dc.w    9161,9397,9630,9860,10087,10310,10531,10748
  480.     dc.w    10963,11173,11381,11585,11785,11982,12175,12365
  481.     dc.w    12551,12732,12910,13085,13255,13421,13583,13740
  482.     dc.w    13894,14044,14189,14330,14466,14598,14726,14849
  483.     dc.w    14967,15081,15191,15296,15396,15491,15582,15668
  484.     dc.w    15749,15826,15897,15964,16026,16083,16135,16182
  485.     dc.w    16224,16262,16294,16322,16344,16361,16374,16382
  486.  
  487.     dc.w    16384,16382,16374,16362,16344,16322,16294,16262
  488.     dc.w    16225,16182,16135,16083,16026,15964,15897,15826
  489.     dc.w    15749,15668,15582,15491,15396,15296,15191,15082
  490.     dc.w    14967,14849,14726,14598,14466,14330,14189,14044
  491.     dc.w    13894,13741,13583,13421,13255,13085,12911,12733
  492.     dc.w    12551,12365,12176,11982,11786,11585,11381,11174
  493.     dc.w    10963,10749,10531,10311,10087,9860,9630,9397
  494.     dc.w    9162,8923,8682,8438,8192,7943,7692,7438
  495.     dc.w    7182,6924,6664,6401,6137,5871,5603,5334
  496.     dc.w    5063,4790,4516,4240,3963,3685,3406,3126
  497.     dc.w    2845,2563,2280,1996,1712,1427,1142,857
  498.     dc.w    571,285,0,-285,-571,-857,-1142,-1428
  499.     dc.w    -1712,-1996,-2280,-2563,-2845,-3126,-3406,-3685
  500.     dc.w    -3963,-4240,-4516,-4790,-5063,-5334,-5603,-5871
  501.     dc.w    -6137,-6401,-6664,-6924,-7182,-7438,-7692,-7943
  502.     dc.w    -8192,-8438,-8682,-8923,-9162,-9397,-9630,-9860
  503.     dc.w    -10087,-10311,-10531,-10749,-10963,-11174,-11381,-11585
  504.     dc.w    -11786,-11982,-12176,-12365,-12551,-12733,-12911,-13085
  505.     dc.w    -13255,-13421,-13583,-13741,-13894,-14044,-14189,-14330
  506.     dc.w    -14466,-14598,-14726,-14849,-14967,-15082,-15191,-15296
  507.     dc.w    -15396,-15491,-15582,-15668,-15749,-15826,-15897,-15964
  508.     dc.w    -16026,-16083,-16135,-16182,-16225,-16262,-16294,-16322
  509.     dc.w    -16344,-16362,-16374,-16382,-16384,-16382,-16374,-16362
  510.     dc.w    -16344,-16322,-16294,-16262,-16225,-16182,-16135,-16083
  511.     dc.w    -16026,-15964,-15897,-15826,-15749,-15668,-15582,-15491
  512.     dc.w    -15396,-15296,-15191,-15082,-14968,-14849,-14726,-14598
  513.     dc.w    -14466,-14330,-14189,-14044,-13894,-13741,-13583,-13421
  514.     dc.w    -13255,-13085,-12911,-12733,-12551,-12365,-12176,-11982
  515.     dc.w    -11786,-11585,-11381,-11174,-10963,-10749,-10531,-10311
  516.     dc.w    -10087,-9860,-9630,-9397,-9162,-8923,-8682,-8438
  517.     dc.w    -8192,-7943,-7692,-7438,-7182,-6924,-6664,-6402
  518.     dc.w    -6137,-5871,-5604,-5334,-5063,-4790,-4516,-4240
  519.     dc.w    -3963,-3685,-3406,-3126,-2845,-2563,-2280,-1996
  520.     dc.w    -1712,-1428,-1143,-857,-572,-286,0,285
  521.     dc.w    571,857,1142,1427,1712,1996,2280,2562
  522.     dc.w    2844,3126,3406,3685,3963,4240,4515,4790
  523.     dc.w    5062,5334,5603,5871,6137,6401,6663,6924
  524.     dc.w    7182,7438,7691,7943,8192,8438,8682,8923
  525.     dc.w    9161,9397,9630,9860,10087,10310,10531,10748
  526.     dc.w    10963,11173,11381,11585,11785,11982,12175,12365
  527.     dc.w    12551,12732,12910,13085,13255,13421,13583,13740
  528.     dc.w    13894,14044,14189,14330,14466,14598,14726,14849
  529.     dc.w    14967,15081,15191,15296,15396,15491,15582,15668
  530.     dc.w    15749,15826,15897,15964,16026,16083,16135,16182
  531.     dc.w    16224,16262,16294,16322,16344,16361,16374,16382
  532.  
  533.  
  534.  
  535.