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

  1.         ;--------------------------------
  2.         ;-          Sinusscroll        -
  3.         ;--------------------------------
  4.  
  5. >EXTERN        '16Font',Font
  6.  
  7. org    $20000
  8. load    $20000
  9.  
  10. Sin:        MACRO
  11.         move.w    d0,d4
  12.         add.w    (a0)+,d4
  13.         move.w    (a7)+,(a1)
  14.         move.w    d4,(a2)
  15.         move.w    d1,(a3)
  16.         move.w    d4,(a4)
  17.         move.w    d2,(a5)
  18.         ENDM
  19.  
  20. ;------------------------------------------------------------------------
  21.  
  22. S:        movem.l    d0-d7/a0-a6,-(sp)
  23.         lea.l    $dff000,a6
  24.         bsr    Startup
  25.         bsr    InitRutin
  26.         bsr    StartCop
  27.         bsr    MainLoop
  28.         bsr    RestoreCop
  29.         movem.l    (sp)+,d0-d7/a0-a6
  30.         rts
  31.  
  32. Startup:    move.w    2(a6),d0
  33.         bset    #15,d0
  34.         move.w    d0,OldDma
  35.         move.w    $1c(a6),d0
  36.         bset    #15,d0
  37.         move.w    d0,OldIrq
  38.         move.l    $4,a6
  39.         lea.l    Lib(pc),a1
  40.         moveq    #0,d0
  41.         jsr    -408(a6)
  42.         move.l    d0,a0
  43.         move.l    $26(a0),OldCop
  44.         lea.l    $dff000,a6
  45.         rts
  46.  
  47. StartCop:    move.l    #CopperList,$80(a6)
  48.         tst.w    $88(a6)
  49.         move.w    #$7fff,$96(a6)
  50.         move.w    #$87c0,$96(a6)
  51.         move.w    #$7fff,$9a(a6)
  52.         move.w    #$c000,$9a(a6)
  53.         rts
  54.  
  55. RestoreCop:    move.l    OldCop(pc),$80(a6)
  56.         tst.w    $88(a6)
  57.         move.w    OldDma(pc),$96(a6)
  58.         move.w    OldIrq(pc),$9a(a6)
  59.         rts
  60.  
  61.     ;-----------------------------------------------------
  62.         OldCop:        dc.l    0
  63.         OldDma:        dc.w    0
  64.         OldIrq:        dc.w    0
  65.         Lib:        dc.b    'graphics.library',0
  66.                 even
  67.     ;-----------------------------------------------------
  68.  
  69. ;------------------------------------------------------------------------
  70.  
  71. BlitWait:    btst    #14,2(a6)
  72.         bne.S    BlitWait
  73.         rts
  74.  
  75. ClearScreen:    bsr.S    BlitWait
  76.         move.l    #-1,$44(a6)
  77.         move.l    #$01000000,$40(a6)
  78.         move.w    d2,$66(a6)
  79.         move.l    d0,$54(a6)
  80.         move.w    d1,$58(a6)
  81.         rts
  82.  
  83. ;------------------------------------------------------------------------
  84.  
  85. InitRutin:    move.l    Screen(pc),d0
  86.         move.w    #116*64+24,d1
  87.         moveq    #0,d2
  88.         bsr    ClearScreen
  89.         move.l    Screen+4(pc),d0
  90.         bsr    ClearScreen
  91.         move.l    #ScrollAdr,d0
  92.         move.w    #16*64+24,d1
  93.         bsr    ClearScreen
  94.  
  95.         move.l    #ScrollText,ScrollSave
  96.  
  97.         lea.l    SinAdr,a0
  98.         lea.l    Sinus(pc),a1
  99.         move.w    #300-1,d7
  100. Loop1:        move.w    (a1)+,d0
  101.         mulu    #48,d0
  102.         move.w    d0,(a0)+
  103.         dbra    d7,Loop1
  104.         lea.l    SinAdr,a1
  105.         move.w    #300*4,d7
  106. Loop2:        move.w    (a1)+,(a0)+
  107.         dbra    d7,Loop2
  108.         rts
  109.  
  110. ;------------------------------------------------------------------------
  111.  
  112. MainLoop:    cmp.b    #$80,$6(a6)
  113.         bne.S    MainLoop
  114.  
  115.         btst    #10,$16(a6)
  116.         beq.S    MainLoop
  117.  
  118.         move.w    $6(a6),Tid
  119.         ;move.w    #$7,$180(a6)
  120.         bsr    SinScroll
  121.         move.w    #0,$180(a6)
  122.         move.w    $6(a6),Tid+2
  123.  
  124.         btst    #6,$bfe001
  125.         bne.S    MainLoop
  126.         rts
  127.  
  128. Tid:        dc.l    0
  129.  
  130. ;------------------------------------------------------------------------
  131.  
  132.     Screen:        dc.l    $61000
  133.             dc.l    $71000
  134.     SinAdr:        =    $6a000
  135.     ScrollAdr:    =    $7a000
  136.  
  137.     ScrollSave:    dc.l    0
  138.     SinSave:    dc.l    0
  139.     Oldie:        dc.w    0
  140.     Reg:        dc.w    0
  141.  
  142.  
  143. SinScroll:    bsr    Scrollen
  144.         bsr    Buffra
  145.         bsr    NewSin
  146.         bsr    BlitSin
  147.         rts
  148.  
  149. Buffra:        move.l    Screen(pc),d0
  150.         move.l    Screen+4(pc),Screen
  151.         move.l    d0,Screen+4
  152.         addq.l    #2,d0
  153.         lea.l    BMap(pc),a0
  154.         sub.w    #48,d0
  155.         move.w    d0,6(a0)
  156.         swap    d0
  157.         move.w    d0,2(a0)
  158.         swap    d0
  159.         add.w    #48,d0
  160.         move.w    d0,14(a0)
  161.         swap    d0
  162.         move.w    d0,10(a0)
  163.         rts
  164.  
  165. NewSin:        moveq    #0,d0
  166.         move.w    Oldie(pc),d0
  167.         addq.w    #3,d0
  168.         cmp.w    #300,d0
  169.         bls.S    NoD
  170.         sub.w    #300,d0
  171. NoD:        move.w    d0,Oldie
  172.         add.w    d0,d0
  173.         add.l    #SinAdr,d0
  174.         move.l    d0,SinSave
  175.         rts
  176.  
  177. BlitSin:    move.l    Screen+4(pc),d0
  178.         move.l    SinSave(pc),a0
  179.         move.w    #16*64+1,d2
  180.         move.w    #34*64+1,d5
  181.         move.l    #ScrollAdr,d1
  182.         add.l    #44,d1
  183.         add.l    #42,d0
  184.         move.w    #9*48,d3
  185.         bsr    BlitWait
  186.         move.l    #-1,$44(a6)
  187.         move.l    #$09f00000,$40(a6)
  188.         move.l    d0,$4c(a6)
  189.         move.l    d0,$54(a6)
  190.         move.l    d1,$50(a6)
  191.         move.w    #48-2,$66(a6)
  192.         move.w    #48-2,$62(a6)
  193.         move.w    #48-2,$64(a6)
  194.  
  195.         lea.l    $44(a6),a1
  196.         lea.l    $4e(a6),a2
  197.         lea.l    $52(a6),a3
  198.         lea.l    $56(a6),a4
  199.         lea.l    $58(a6),a5
  200.         lea.l    $40(a6),a6
  201.  
  202.         move.l    a7,SPSave
  203.         lea.l    ST(pc),a7
  204.  
  205.         moveq    #21-1,d7
  206.  
  207. SLoop1:        moveq    #15-1,d6
  208.         move.w    #$9f0,(a6)
  209.         move.w    d0,d4
  210.         add.w    (a0)+,d4
  211.         sub.w    d3,d4
  212.         move.w    (a7)+,(a1)
  213.         move.w    d4,(a4)
  214.         move.w    d1,d4
  215.         sub.w    d3,d4
  216.         move.w    d4,(a3)
  217.         move.w    d5,(a5)
  218. q:        btst    #14,$dff002
  219.         bne.S    q
  220.         move.w    #$dfc,(a6)
  221.         Sin
  222.         Sin
  223.         Sin
  224.         Sin
  225.         Sin
  226.         Sin
  227.         Sin
  228.         Sin
  229.         Sin
  230.         Sin
  231.         Sin
  232.         Sin
  233.         Sin
  234.         Sin
  235.         Sin
  236.         subq.w    #2,d0
  237.         subq.w    #2,d1
  238.         dbra    d7,SLoop1
  239.  
  240.         lea.l    $dff000,a6
  241.         move.l    SPSave(pc),a7
  242.         rts
  243.  
  244. SPSave:        dc.l    0
  245.  
  246.     ;-------------------------------------------
  247.  
  248. Scrollen:    cmp.w    #0,Reg
  249.         bne.S    NoNew
  250.         bsr    GetNew
  251.         move.w    #16,Reg
  252. NoNew:        bsr    ScrollIt
  253.         subq.w    #2,Reg
  254.         rts
  255.  
  256. GetNew:        move.l    ScrollSave(pc),a0
  257.         moveq    #0,d0
  258.         move.b    (a0),d0
  259.         cmp.b    #-1,d0
  260.         bne.S    NoRe
  261.         move.l    #ScrollText,ScrollSave
  262.         bra.S    GetNew
  263. NoRe:        sub.b    #$20,d0
  264.         add.w    d0,d0
  265.         add.l    #Font,d0
  266.         bsr    BlitWait
  267.         move.l    #-1,$44(a6)
  268.         move.l    #$09f00000,$40(a6)
  269.         move.w    #118-2,$64(a6)
  270.         move.w    #48-2,$66(a6)
  271.         move.l    d0,$50(a6)
  272.         move.l    #ScrollAdr,d0
  273.         add.w    #46,d0
  274.         move.l    d0,$54(a6)
  275.         move.w    #16*64+1,$58(a6)
  276.         addq.l    #1,ScrollSave
  277.         rts
  278.  
  279. ScrollIt:    bsr    BlitWait
  280.         move.l    #-1,$44(a6)
  281.         move.l    #ScrollAdr,d0
  282.         add.w    #15*48+46,d0
  283.         move.l    #$29f00002,$40(a6)
  284.         clr.l    $64(a6)
  285.         move.l    d0,$50(a6)
  286.         move.l    d0,$54(a6)
  287.         move.w    #16*64+24,$58(a6)
  288.         rts
  289.  
  290. ScrollText:
  291. DC.B    'AND FENOMENA IS BACK WITH A LAME SINUSSCROLL IN 135 LINES...   '
  292. DC.B    'CODE BY MACE...   FONT BY COLOR...    SEE YA!          '
  293. DC.B    -1
  294. even
  295.  
  296. ;------------------------------------------------------------------------
  297.  
  298. CopperList:    dc.l    $008e7266,$0090e7d6,$00920030,$009400d8
  299.         dc.l    $01020089,$01040000,$01080004,$010a0004
  300.  
  301.         dc.l    $01800000,$01820666,$01840ccc,$01860999
  302. BMap:        dc.l    $00e00000,$00e20000,$00e40000,$00e60000
  303.         dc.l    $01002000
  304.  
  305.         dc.l    -2
  306.  
  307. ;------------------------------------------------------------------------
  308.  
  309. Font:        =    $30000
  310.  
  311. Sinus:    dc.w    100,100,100,100,100,100,100,99
  312.     dc.w    99,99,99,99,98,98,98,98
  313.     dc.w    97,97,96,96,96,95,95,94
  314.     dc.w    94,93,93,92,92,91,90,90
  315.     dc.w    89,89,88,87,86,86,85,84
  316.     dc.w    83,83,82,81,80,79,79,78
  317.     dc.w    77,76,75,74,73,72,71,70
  318.     dc.w    69,68,67,66,65,64,63,62
  319.     dc.w    61,60,59,58,57,56,55,54
  320.     dc.w    53,52,51,50,49,48,47,46
  321.     dc.w    45,44,43,42,41,40,39,38
  322.     dc.w    37,36,35,34,33,32,31,30
  323.     dc.w    29,28,27,26,25,24,23,22
  324.     dc.w    21,21,20,19,18,17,17,16
  325.     dc.w    15,14,14,13,12,11,11,10
  326.     dc.w    10,9,8,8,7,7,6,6
  327.     dc.w    5,5,4,4,4,3,3,2
  328.     dc.w    2,2,2,1,1,1,1,1
  329.     dc.w    0,0,0,0,0,0,0,0
  330.     dc.w    0,0,0,0,0,1,1,1
  331.     dc.w    1,1,2,2,2,2,3,3
  332.     dc.w    4,4,4,5,5,6,6,7
  333.     dc.w    7,8,8,9,10,10,11,11
  334.     dc.w    12,13,14,14,15,16,17,17
  335.     dc.w    18,19,20,21,21,22,23,24
  336.     dc.w    25,26,27,28,29,30,31,32
  337.     dc.w    33,34,35,36,37,38,39,40
  338.     dc.w    41,42,43,44,45,46,47,48
  339.     dc.w    49,50,51,52,53,54,55,56
  340.     dc.w    57,58,59,60,61,62,63,64
  341.     dc.w    65,66,67,68,69,70,71,72
  342.     dc.w    73,74,75,76,77,78,79,79
  343.     dc.w    80,81,82,83,83,84,85,86
  344.     dc.w    86,87,88,89,89,90,90,91
  345.     dc.w    92,92,93,93,94,94,95,95
  346.     dc.w    96,96,96,97,97,98,98,98
  347.     dc.w    98,99,99,99,99,99,100,100
  348.     dc.w    100,100,100,100
  349.  
  350. ST:
  351. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  352. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  353. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  354. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  355. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  356. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  357. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  358. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  359. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  360. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  361. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  362. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  363. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  364. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  365. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  366. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  367. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  368. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  369. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  370. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  371. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  372. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  373. dc.w 1,2,4,8,$10,$20,$40,$80,$100,$200,$400,$800,$1000,$2000,$4000,$8000
  374.  
  375.  
  376.