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

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