home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / Asm / Fading / AGAMorph.s < prev    next >
Encoding:
Text File  |  1997-02-16  |  3.7 KB  |  159 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;AGA Palette Morph
  3. ;-----------------
  4. ;Fades in a 32 colour AGA picture (24 bit colour).  Then fades it into
  5. ;a second purple palette, and then out to black.
  6. ;
  7. ;Press left mouse button to exit.
  8.  
  9.     INCDIR    "INCLUDES:"
  10.     INCLUDE    "exec/exec_lib.i"
  11.     INCLUDE    "games/games_lib.i"
  12.     INCLUDE    "games/games.i"
  13.  
  14. CALL    MACRO
  15.     jsr    _LVO\1(a6)
  16.     ENDM
  17.  
  18.     SECTION    "AGAFade",CODE
  19.  
  20. ;===========================================================================;
  21. ;                             INITIALISE DEMO
  22. ;===========================================================================;
  23.  
  24. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  25.     move.l    ($4).w,a6
  26.     lea    GMS_Name(pc),a1
  27.     moveq    #$00,d0
  28.     CALL    OpenLibrary
  29.     move.l    d0,GMS_Base
  30.     beq.s    .Error_GMS
  31.  
  32.     move.l    GMS_Base(pc),a6
  33.     sub.l    a0,a0
  34.     CALL    SetUserPrefs
  35.  
  36.     lea    Screen(pc),a0
  37.     CALL    AddScreen
  38.     tst.l    d0
  39.     bne.s    .Error_Screen
  40.  
  41.     lea    Picture(pc),a1
  42.     move.l    GS_MemPtr1(a0),PIC_Data(a1)
  43.     CALL    LoadPic
  44.     tst.w    d0
  45.     bne.s    .Error_Picture
  46.  
  47.     CALL    ShowScreen
  48.  
  49.     bsr.s    Main
  50.  
  51. .ReturnToDOS
  52.     move.l    GMS_Base(pc),a6
  53.     lea    Picture(pc),a1
  54.     CALL    FreePic
  55. .Error_Picture
  56.     lea    Screen(pc),a0
  57.     CALL    DeleteScreen
  58. .Error_Screen
  59.     move.l    ($4).w,a6
  60.     move.l    GMS_Base(pc),a1
  61.     CALL    CloseLibrary
  62. .Error_GMS
  63.     MOVEM.L    (SP)+,A0-A6/D1-D7
  64.     moveq    #$00,d0
  65.     rts
  66.  
  67. ;===========================================================================;
  68. ;                                MAIN CODE
  69. ;===========================================================================;
  70.  
  71. Main:    lea    Picture(pc),a1
  72.     move.l    PIC_Palette(a1),a1    ;a1 = Palette to fade to.
  73.     moveq    #$00,d0    ;d0 = FadeState
  74.     moveq    #5,d1    ;d1 = Speed of fade.
  75.     moveq    #$000000,d2
  76.     moveq    #00,d3
  77.     moveq    #32,d4
  78. .f_in    CALL    WaitSVBL
  79.     CALL    ColourToPalette    ;Do the fade routine.
  80.     tst.w    d0    ;Has the fade finished yet?
  81.     bne.s    .f_in    ;If not, keep doing it.
  82.  
  83.     moveq    #50,d0
  84.     CALL    WaitTime
  85.  
  86.     moveq    #$00,d0    ;d0 = FadeState
  87.     moveq    #2,d1    ;d1 = Speed of fade.
  88.     lea    MorphPalette(pc),a2    ;a2 = Destination Palette.
  89. .f_mid    CALL    WaitSVBL
  90.     CALL    PaletteMorph    ;Do the fade routine.
  91.     tst.w    d0    ;Has the fade finished yet?
  92.     bne.s    .f_mid    ;If not, keep doing it.
  93.  
  94.     moveq    #50,d0
  95.     CALL    WaitTime
  96.  
  97.     moveq    #$00,d0    ;d0 = FadeState
  98.     moveq    #2,d1    ;d1 = Speed of fade.
  99.     lea    MorphPalette(pc),a1
  100.     moveq    #$000000,d2
  101. .f_out    CALL    WaitSVBL
  102.     CALL    PaletteToColour    ;Do the fade routine.
  103.     tst.w    d0    ;Has the fade finished yet?
  104.     bne.s    .f_out    ;If not, keep doing it.
  105.  
  106.     moveq    #50,d0
  107.     CALL    WaitTime
  108.     rts
  109.  
  110. ;===========================================================================;
  111. ;                                  DATA
  112. ;===========================================================================;
  113.  
  114. GMS_Name:
  115.     dc.b    "games.library",0
  116.     even
  117. GMS_Base:
  118.     dc.l    0
  119.  
  120. AMT_PLANES =    5
  121.  
  122. Screen:    dc.l    GSV1,0    ;Version header.
  123.     dc.l    0,0,0    ;Screen memory 1/2/3.
  124.     dc.l    0    ;Screen link.
  125.     dc.l    0    ;Address of palette.
  126.     dc.l    0    ;Address of rasterlist.
  127.     dc.l    32    ;Amount of colours in palette.
  128.     dc.w    320,256    ;Screen Width and Height.
  129.     dc.w    0,0,0    ;Picture Width, ByteWidth, Height.
  130.     dc.w    AMT_PLANES    ;Amount of planes.
  131.     dc.w    0,0    ;X/Y screen offsets.
  132.     dc.w    0,0    ;X/Y picture offsets.
  133.     dc.l    0    ;Special attributes.
  134.     dc.w    LORES|COL24BIT    ;Screen mode.
  135.     dc.w    ILBM    ;Screen type
  136.  
  137. MorphPalette:
  138.     dc.l    $000000,$0A0107,$14020E,$1D0314
  139.     dc.l    $27041B,$310522,$3B0629,$45082F
  140.     dc.l    $4E0936,$580A3D,$620B44,$6C0C4A
  141.     dc.l    $760D51,$800E58,$890F5F,$931066
  142.     dc.l    $9D116C,$A71273,$B1137A,$BA1481
  143.     dc.l    $C41687,$CE178E,$D81895,$E2199C
  144.     dc.l    $EB1AA2,$F51BA9,$FF1CB0,$D71C9F
  145.     dc.l    $557D55,$707082,$443300,$1E1E1E
  146.  
  147. Picture    dc.l    PCV1,0    ;Version header.
  148.     dc.l    0    ;Source data.
  149.     dc.w    320,320/8,256    ;Width, Height.
  150.     dc.w    AMT_PLANES    ;Amount of Planes.
  151.     dc.l    32    ;Amount of colours.
  152.     dc.l    0    ;Source palette.
  153.     dc.w    LORES|COL24BIT    ;Screen mode.
  154.     dc.w    ILBM    ;Destination
  155.     dc.l    GETPALETTE    ;Parameters.
  156.     dc.l    .File
  157. .File    dc.b    "GAMESLIB:data/IFF.Loading",0
  158.     even
  159.