home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Source / pheno.lha / pha / CYCLEPIC3.ASM < prev    next >
Encoding:
Assembly Source File  |  1980-06-18  |  12.3 KB  |  500 lines

  1.  
  2.         ************************************
  3.         *    THIS SOURCE CODE HAS BEEN     *
  4.         *  CONVERTED FROM SEKA TO DEVPAC   *
  5.         *   WITH SEKPAC CONVERTER V 1.0    *
  6.         *        DARKNESS 1990           *
  7.         *                   *
  8.         *  For any question,bug,idea,etc.. *
  9.         *           write to :           *
  10.         *                   *
  11.         *      AMIGA VICE of DARKNESS       *
  12.         *      APARTADO 54265       *
  13.         *       28080 MADRID           *
  14.         *          SPAIN           *
  15.         ************************************
  16.  
  17.             opt c-
  18.  
  19.     ;----------------------------------------------------------------------------
  20.     ;-                Cycle-Pictures                    -
  21.     ;----------------------------------------------------------------------------
  22.     
  23.         org    $20000
  24.     
  25. S:        movem.l    d0-d7/a0-a6,-(sp)
  26.         bsr    SaveAll
  27.         bsr    InitSpr
  28.         bsr    InitScreen
  29.         bsr    StartCopper
  30.         bsr    Calculate
  31.         bsr    MainLoop
  32.         bsr    RestoreAll
  33.         movem.l    (sp)+,d0-d7/a0-a6
  34.         rts
  35.     
  36. SaveAll:    lea    OldCop(pc),a2
  37.         move.l    $4,a6
  38.         lea    Lib(pc),a1
  39.         moveq    #0,d0
  40.         jsr    -408(a6)
  41.         move.l    d0,a0
  42.         move.l    $26(a0),(a2)+
  43.         lea    $dff000,a6
  44.         move.w    $1c(a6),d0
  45.         bset    #15,d0
  46.         move.w    d0,(a2)+
  47.         move.w    2(a6),d0
  48.         bset    #15,d0
  49.         move.w    d0,(a2)+
  50.         move.l    $6c.W,Oldien
  51.         rts
  52.     
  53. Oldien:        dc.l    0
  54.     
  55. RestoreAll:    lea    OldCop(pc),a0
  56.         move.l    Oldien(pc),$6c.W
  57.         move.l    (a0)+,$80(a6)
  58.         move.w    (a0)+,$9a(a6)
  59.         move.w    (a0)+,$96(a6)
  60.         rts
  61.     
  62. StartCopper:    bsr    BlitWait
  63.         lea    CopperList(pc),a0
  64.         move.l    a0,$80(a6)
  65.         tst.w    $88(a6)
  66.         move.w    #$7fff,$96(a6)
  67.         move.w    #$87e0,$96(a6)
  68.         move.w    #$7fff,$9a(a6)
  69.         move.w    #$c010,$9a(a6)
  70.         move.l    #Int,$6c.W
  71.         rts
  72.     
  73. InitSpr:    lea    CopperList(pc),a0
  74.         move.l    #Spr,d0
  75.         moveq    #7,d7
  76. SprLoop:    swap    d0
  77.         move.w    d0,2(a0)
  78.         swap    d0
  79.         move.w    d0,6(a0)
  80.         addq.l    #8,a0
  81.         dbra    d7,SprLoop
  82.         rts
  83.     
  84. OldCop:        dc.l    0
  85. OldIrq:        dc.w    0
  86. OldDma:        dc.w    0
  87. Spr:        dc.l    0
  88. Lib:        dc.b    'graphics.library',0
  89.         even
  90.     
  91. BlitWait:    btst    #14,$2(a6)
  92.         bne.S    BlitWait
  93.         rts
  94.     
  95. ClearScreen:    bsr.S    BlitWait
  96.         move.l    #-1,$44(a6)
  97.         move.l    #$01000000,$40(a6)
  98.         move.w    d2,$66(a6)
  99.         move.l    d0,$54(a6)
  100.         move.w    d1,$58(a6)
  101.         rts
  102.     
  103.     ;-------------------------------------------------------------------------------------
  104.     
  105. InitScreen:    move.l    Screen(pc),d0
  106.         moveq    #0,d2
  107.         move.w    #140*5*64+44,d1
  108.         bsr    ClearScreen
  109.     
  110.         lea    BMap(pc),a0
  111.         moveq    #4,d7
  112. BMapLoop:    swap    d0
  113.         move.w    d0,2(a0)
  114.         swap    d0
  115.         move.w    d0,6(a0)
  116.         addq.l    #8,a0
  117.         add.l    #280*44,d0
  118.         dbra    d7,BMapLoop
  119.     
  120.         lea    Sinus(pc),a0
  121.         lea    SinAdr,a1
  122.         move.w    #200-1,d7
  123. FSLoop1:    move.w    (a0)+,d0
  124.         add.w    d0,d0
  125.         move.w    d0,(a1)+
  126.         dbra    d7,FSLoop1
  127.         lea    SinAdr,a0
  128.         move.w    #20*200-1,d7
  129. FSLoop2:    move.w    (a0)+,(a1)+
  130.         dbra    d7,FSLoop2
  131.         lea    Add(pc),a0
  132.         lea    AddAdr,a1
  133.         move.w    #1000-1,d7
  134. FSLoop3:    move.w    (a0)+,(a1)+
  135.         dbra    d7,FSLoop3
  136.         lea    AddAdr,a0
  137.         move.w    #10*1000-1,d7
  138. FSLoop4:    move.w    (a0)+,(a1)+
  139.         dbra    d7,FSLoop4
  140.         rts
  141.     
  142. Screen:        dc.l    $60000
  143. SinAdr:        =    $70000
  144. AddAdr:        =    $75000
  145.     
  146.     ;-------------------------------------------------------------------------------------
  147.     
  148. Calculate:    lea    AddAdr,a0
  149.         move.l    a0,a1
  150.         add.l    #1000,a1
  151.         moveq    #0,d4
  152.         move.l    Screen(pc),a4
  153.         move.w    #280*44,a5
  154.         lea    SinAdr,a6
  155.         move.l    a7,SPSave
  156.         move.l    a6,a7
  157.         move.w    #280-1,d7
  158. CalcLoop1:    move.w    #352-1,d6
  159.     ;        add.w    (a7),a0
  160.     ;        add.w    (a6),a1
  161.         move.l    a0,a2
  162.         move.l    a1,a3
  163.         add.w    #8,a0
  164.         add.w    #2,a1
  165.         add.w    #2,a7
  166.         add.w    #4,a6
  167.         moveq    #0,d1
  168. CalcLoop2:    move.w    (a2),d0
  169.         add.w    (a3),d0
  170.     ;        add.w    (a6),a3
  171.         add.w    (a7),a2
  172.     ;        add.w    #12,a2
  173.         add.w    #4,a3
  174.         add.w    #2,a6
  175.         add.w    #2,a7
  176.         move.w    d1,d2
  177.         move.w    d2,d3
  178.         lsr.w    #3,d2
  179.         eor.w    #7,d3
  180.         add.w    d4,d2
  181.     
  182.         btst    #0,d0
  183.         beq.S    NoPlot1
  184.         bset    d3,(a4,d2)
  185. NoPlot1:    lsr.w    #1,d0
  186.         add.w    a5,d2
  187.         btst    #0,d0
  188.         beq.S    NoPlot2
  189.         bset    d3,(a4,d2)
  190. NoPlot2:    lsr.w    #1,d0
  191.         add.w    a5,d2
  192.         btst    #0,d0
  193.         beq.S    NoPlot3
  194.         bset    d3,(a4,d2)
  195. NoPlot3:    lsr.w    #1,d0
  196.         add.w    a5,d2
  197.         btst    #0,d0
  198.         beq.S    NoPlot4
  199.         bset    d3,(a4,d2)
  200. NoPlot4:    lsr.w    #1,d0
  201.         add.w    a5,d2
  202.         btst    #0,d0
  203.         beq.S    NoPlot5
  204.         bset    d3,(a4,d2)
  205. NoPlot5:    lsr.w    #1,d0
  206.         add.w    a5,d2
  207.     
  208.         addq.w    #1,d1
  209.         dbra    d6,CalcLoop2
  210.         add.w    #44,d4
  211.         sub.l    #352*2,a6
  212.         sub.l    #352*2,a7
  213.         dbra    d7,CalcLoop1
  214.         lea    $dff000,a6
  215.         move.l    SPSave(pc),a7
  216.         rts
  217.     
  218. SPSave:        dc.l    0
  219.     
  220.     ;-------------------------------------------------------------------------------------
  221.     
  222. MainLoop:    cmp.b    #-1,$6(a6)
  223.         bne.S    MainLoop
  224. QQQ:        cmp.b    #$38,$6(a6)
  225.         bne.S    QQQ
  226.     ;        bsr    Cycle
  227.         btst    #6,$bfe001
  228.         bne.S    MainLoop
  229.         rts
  230.     
  231. Int:        move.l    a7,SPSave2
  232.         lea    $50000,a7
  233.         movem.l    d0-d7/a0-a6,-(sp)
  234.         bsr    Cycle
  235.         movem.l    (sp)+,d0-d7/a0-a6
  236.         move.l    SPSave2(pc),a7
  237.         move.w    #$0010,$dff09c
  238.         rte
  239.     
  240. SPSave2:    dc.l    0
  241.     
  242.     ;-------------------------------------------------------------------------------------
  243.     
  244. Cycle:        lea    ColCount(pc),a0
  245.         moveq    #0,d0
  246.         move.w    (a0),d0
  247.         addq.w    #1,d0
  248.         cmp.w    #30,d0
  249.         bls.S    NoD
  250.         moveq    #0,d0
  251. NoD:        move.w    d0,(a0)
  252.         add.w    d0,d0
  253.         lea    Cols+2(pc),a1
  254.         lea    Cols2(pc),a2
  255.         add.l    d0,a2
  256.         moveq    #32-1,d7
  257. CL:        move.w    (a2)+,(a1)
  258.         addq.l    #4,a1
  259.         dbra    d7,CL
  260.         rts
  261.     
  262. ColCount:    dc.w    0
  263. Cols2:
  264.     dc.w    0,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00
  265.     dc.w    $d00,$e00,$f00
  266.     dc.w    $e00,$d00,$c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300
  267.     dc.w    $200,$100,0
  268.     dc.w    0,$100,$200,$300,$400,$500,$600,$700,$800,$900,$a00,$b00,$c00
  269.     dc.w    $d00,$e00,$f00
  270.     dc.w    $e00,$d00,$c00,$b00,$a00,$900,$800,$700,$600,$500,$400,$300
  271.     dc.w    $200,$100,0
  272.     
  273.     dc.w    $f00,$f10,$f20,$f30,$f40,$f50,$f60,$f70,$f80,$f90,$fa0,$fb0
  274.     dc.w    $fc0,$fd0,$fe0,$ff0,$ff1,$ff2,$ff3,$ff4,$ff5,$ff6,$ff7,$ff8
  275.     dc.w    $ff9,$ffa,$ffb,$ffc,$ffd,$ffe,$fff,$fff
  276.     dc.w    $f00,$f10,$f20,$f30,$f40,$f50,$f60,$f70,$f80,$f90,$fa0,$fb0
  277.     dc.w    $fc0,$fd0,$fe0,$ff0,$ff1,$ff2,$ff3,$ff4,$ff5,$ff6,$ff7,$ff8
  278.     dc.w    $ff9,$ffa,$ffb,$ffc,$ffd,$ffe,$fff,$fff
  279.     
  280.     ;-------------------------------------------------------------------------------------
  281.     
  282. CopperList:    dc.l    $01200000,$01220000,$01240000,$01260000
  283.         dc.l    $01280000,$012a0000,$012c0000,$012e0000
  284.         dc.l    $01300000,$01320000,$01340000,$01360000
  285.         dc.l    $01380000,$013a0000,$013c0000,$013e0000
  286.     
  287.         dc.l    $008e2066,$009038dd,$00920030,$009400d8
  288.         dc.l    $01020000,$01040000,$01080000,$010a0000
  289.     
  290. Cols:        dc.l    $01800000,$01820010,$01840020,$01860030
  291.         dc.l    $01880040,$018a0050,$018c0060,$018e0070
  292.         dc.l    $01900080,$01920090,$019400a0,$019600b0
  293.         dc.l    $019800c0,$019a00d0,$019c00e0,$019e00f0
  294.         dc.l    $01a000f0,$01a200e0,$01a400d0,$01a600c0
  295.         dc.l    $01a800b0,$01aa00a0,$01ac0090,$01ae0080
  296.         dc.l    $01b00070,$01b20060,$01b40050,$01b60040
  297.         dc.l    $01b80030,$01ba0020,$01bc0010,$01be0000
  298.     
  299. BMap:        dc.l    $00e00000,$00e20000,$00e40000,$00e60000
  300.         dc.l    $00e80000,$00ea0000,$00ec0000,$00ee0000
  301.         dc.l    $00f00000,$00f20000
  302.     
  303.         dc.l    $01005200
  304.     
  305.         dc.l    $ffddfffe,$3807fffe,$009c8010
  306.     
  307.         dc.l    -2
  308.     
  309.     ;--------------------------------------------------------------------------------------
  310.     
  311. Sinus:
  312.     ;dc.w    0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
  313.     ;dc.w    16,17,18,19,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
  314.     ;dc.w    0,1,2,2,3,3,3,4,4,4,5,5,5,5,6,6,6,6,7,7,7,8,8,8,9,9,10,10,11
  315.     ;dc.w    12,13,14,15,16,15,14,13,12,11,10,9,8,7,6,5,4,3,3,2,2,1,1,0,0
  316.     ;dc.w    0,1,1,0,0
  317.     ;ss:
  318.     
  319.     dc.w    15,15,15,15,15,15,15,15
  320.     dc.w    15,15,15,15,14,14,14,14
  321.     dc.w    14,14,14,14,14,13,13,13
  322.     dc.w    13,13,13,12,12,12,12,12
  323.     dc.w    12,11,11,11,11,10,10,10
  324.     dc.w    10,10,9,9,9,9,8,8
  325.     dc.w    8,8,7,7,7,7,7,6
  326.     dc.w    6,6,6,5,5,5,5,5
  327.     dc.w    4,4,4,4,3,3,3,3
  328.     dc.w    3,3,2,2,2,2,2,2
  329.     dc.w    1,1,1,1,1,1,1,1
  330.     dc.w    1,0,0,0,0,0,0,0
  331.     dc.w    0,0,0,0,0,0,0,0
  332.     dc.w    0,0,0,0,0,0,0,0
  333.     dc.w    1,1,1,1,1,1,1,1
  334.     dc.w    1,2,2,2,2,2,2,3
  335.     dc.w    3,3,3,3,3,4,4,4
  336.     dc.w    4,5,5,5,5,5,6,6
  337.     dc.w    6,6,7,7,7,7,8,8
  338.     dc.w    8,8,8,9,9,9,9,10
  339.     dc.w    10,10,10,10,11,11,11,11
  340.     dc.w    12,12,12,12,12,12,13,13
  341.     dc.w    13,13,13,13,14,14,14,14
  342.     dc.w    14,14,14,14,14,15,15,15
  343.     dc.w    15,15,15,15,15,15,15,15
  344.     
  345.     
  346. Add2:    dc.w    200,200,200,200,199,199,198,198
  347.     dc.w    197,196,195,194,193,192,190,189
  348.     dc.w    188,186,184,183,181,179,177,175
  349.     dc.w    173,171,168,166,164,161,159,156
  350.     dc.w    154,151,148,145,143,140,137,134
  351.     dc.w    131,128,125,122,119,116,113,109
  352.     dc.w    106,103,100,97,94,91,87,84
  353.     dc.w    81,78,75,72,69,66,63,60
  354.     dc.w    57,55,52,49,46,44,41,39
  355.     dc.w    36,34,32,29,27,25,23,21
  356.     dc.w    19,17,16,14,12,11,10,8
  357.     dc.w    7,6,5,4,3,2,2,1
  358.     dc.w    1,0,0,0,0,0,0,0
  359.     dc.w    1,1,2,2,3,4,5,6
  360.     dc.w    7,8,10,11,12,14,16,17
  361.     dc.w    19,21,23,25,27,29,32,34
  362.     dc.w    36,39,41,44,46,49,52,55
  363.     dc.w    57,60,63,66,69,72,75,78
  364.     dc.w    81,84,87,91,94,97,100,103
  365.     dc.w    106,109,113,116,119,122,125,128
  366.     dc.w    131,134,137,140,143,145,148,151
  367.     dc.w    154,156,159,161,164,166,168,171
  368.     dc.w    173,175,177,179,181,183,184,186
  369.     dc.w    188,189,190,192,193,194,195,196
  370.     dc.w    197,198,198,199,199,200,200,200
  371.     
  372.     
  373.     
  374. Add:    dc.w    400,400,400,400,400,400,400,400
  375.     dc.w    400,400,400,400,399,399,399,399
  376.     dc.w    399,399,399,399,398,398,398,398
  377.     dc.w    398,398,397,397,397,397,396,396
  378.     dc.w    396,396,395,395,395,395,394,394
  379.     dc.w    394,393,393,393,392,392,392,391
  380.     dc.w    391,391,390,390,389,389,389,388
  381.     dc.w    388,387,387,386,386,385,385,385
  382.     dc.w    384,384,383,383,382,381,381,380
  383.     dc.w    380,379,379,378,378,377,376,376
  384.     dc.w    375,375,374,373,373,372,372,371
  385.     dc.w    370,370,369,368,368,367,366,365
  386.     dc.w    365,364,363,363,362,361,360,360
  387.     dc.w    359,358,357,356,356,355,354,353
  388.     dc.w    352,352,351,350,349,348,348,347
  389.     dc.w    346,345,344,343,342,341,341,340
  390.     dc.w    339,338,337,336,335,334,333,332
  391.     dc.w    331,330,329,328,327,327,326,325
  392.     dc.w    324,323,322,321,320,319,318,317
  393.     dc.w    316,314,313,312,311,310,309,308
  394.     dc.w    307,306,305,304,303,302,301,300
  395.     dc.w    299,297,296,295,294,293,292,291
  396.     dc.w    290,289,287,286,285,284,283,282
  397.     dc.w    281,279,278,277,276,275,274,272
  398.     dc.w    271,270,269,268,267,265,264,263
  399.     dc.w    262,261,259,258,257,256,255,253
  400.     dc.w    252,251,250,249,247,246,245,244
  401.     dc.w    242,241,240,239,237,236,235,234
  402.     dc.w    233,231,230,229,228,226,225,224
  403.     dc.w    223,221,220,219,218,216,215,214
  404.     dc.w    213,211,210,209,208,206,205,204
  405.     dc.w    203,201,200,199,197,196,195,194
  406.     dc.w    192,191,190,189,187,186,185,184
  407.     dc.w    182,181,180,179,177,176,175,174
  408.     dc.w    172,171,170,169,167,166,165,164
  409.     dc.w    163,161,160,159,158,156,155,154
  410.     dc.w    153,151,150,149,148,147,145,144
  411.     dc.w    143,142,141,139,138,137,136,135
  412.     dc.w    133,132,131,130,129,128,126,125
  413.     dc.w    124,123,122,121,119,118,117,116
  414.     dc.w    115,114,113,111,110,109,108,107
  415.     dc.w    106,105,104,103,101,100,99,98
  416.     dc.w    97,96,95,94,93,92,91,90
  417.     dc.w    89,88,87,86,84,83,82,81
  418.     dc.w    80,79,78,77,76,75,74,73
  419.     dc.w    73,72,71,70,69,68,67,66
  420.     dc.w    65,64,63,62,61,60,59,59
  421.     dc.w    58,57,56,55,54,53,52,52
  422.     dc.w    51,50,49,48,48,47,46,45
  423.     dc.w    44,44,43,42,41,40,40,39
  424.     dc.w    38,37,37,36,35,35,34,33
  425.     dc.w    32,32,31,30,30,29,28,28
  426.     dc.w    27,27,26,25,25,24,24,23
  427.     dc.w    22,22,21,21,20,20,19,19
  428.     dc.w    18,17,17,16,16,15,15,15
  429.     dc.w    14,14,13,13,12,12,11,11
  430.     dc.w    11,10,10,9,9,9,8,8
  431.     dc.w    8,7,7,7,6,6,6,5
  432.     dc.w    5,5,5,4,4,4,4,3
  433.     dc.w    3,3,3,2,2,2,2,2
  434.     dc.w    2,1,1,1,1,1,1,1
  435.     dc.w    1,0,0,0,0,0,0,0
  436.     dc.w    0,0,0,0,0,0,0,0
  437.     dc.w    0,0,0,0,0,0,0,0
  438.     dc.w    1,1,1,1,1,1,1,1
  439.     dc.w    2,2,2,2,2,2,3,3
  440.     dc.w    3,3,4,4,4,4,5,5
  441.     dc.w    5,5,6,6,6,7,7,7
  442.     dc.w    8,8,8,9,9,9,10,10
  443.     dc.w    11,11,11,12,12,13,13,14
  444.     dc.w    14,15,15,15,16,16,17,17
  445.     dc.w    18,19,19,20,20,21,21,22
  446.     dc.w    22,23,24,24,25,25,26,27
  447.     dc.w    27,28,28,29,30,30,31,32
  448.     dc.w    32,33,34,35,35,36,37,37
  449.     dc.w    38,39,40,40,41,42,43,44
  450.     dc.w    44,45,46,47,48,48,49,50
  451.     dc.w    51,52,53,53,54,55,56,57
  452.     dc.w    58,59,59,60,61,62,63,64
  453.     dc.w    65,66,67,68,69,70,71,72
  454.     dc.w    73,73,74,75,76,77,78,79
  455.     dc.w    80,81,82,83,84,86,87,88
  456.     dc.w    89,90,91,92,93,94,95,96
  457.     dc.w    97,98,99,100,101,103,104,105
  458.     dc.w    106,107,108,109,110,111,113,114
  459.     dc.w    115,116,117,118,119,121,122,123
  460.     dc.w    124,125,126,128,129,130,131,132
  461.     dc.w    133,135,136,137,138,139,141,142
  462.     dc.w    143,144,145,147,148,149,150,151
  463.     dc.w    153,154,155,156,158,159,160,161
  464.     dc.w    163,164,165,166,167,169,170,171
  465.     dc.w    172,174,175,176,177,179,180,181
  466.     dc.w    182,184,185,186,187,189,190,191
  467.     dc.w    192,194,195,196,197,199,200,201
  468.     dc.w    203,204,205,206,208,209,210,211
  469.     dc.w    213,214,215,216,218,219,220,221
  470.     dc.w    223,224,225,226,228,229,230,231
  471.     dc.w    233,234,235,236,237,239,240,241
  472.     dc.w    242,244,245,246,247,249,250,251
  473.     dc.w    252,253,255,256,257,258,259,261
  474.     dc.w    262,263,264,265,267,268,269,270
  475.     dc.w    271,272,274,275,276,277,278,279
  476.     dc.w    281,282,283,284,285,286,287,289
  477.     dc.w    290,291,292,293,294,295,296,297
  478.     dc.w    299,300,301,302,303,304,305,306
  479.     dc.w    307,308,309,310,311,312,313,314
  480.     dc.w    316,317,318,319,320,321,322,323
  481.     dc.w    324,325,326,327,327,328,329,330
  482.     dc.w    331,332,333,334,335,336,337,338
  483.     dc.w    339,340,341,341,342,343,344,345
  484.     dc.w    346,347,348,348,349,350,351,352
  485.     dc.w    352,353,354,355,356,356,357,358
  486.     dc.w    359,360,360,361,362,363,363,364
  487.     dc.w    365,365,366,367,368,368,369,370
  488.     dc.w    370,371,372,372,373,373,374,375
  489.     dc.w    375,376,376,377,378,378,379,379
  490.     dc.w    380,380,381,382,382,383,383,384
  491.     dc.w    384,385,385,385,386,386,387,387
  492.     dc.w    388,388,389,389,389,390,390,391
  493.     dc.w    391,391,392,392,392,393,393,393
  494.     dc.w    394,394,394,395,395,395,395,396
  495.     dc.w    396,396,396,397,397,397,397,398
  496.     dc.w    398,398,398,398,398,399,399,399
  497.     dc.w    399,399,399,399,399,400,400,400
  498.     dc.w    400,400,400,400,400,400,400,400
  499.     
  500.