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