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

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;AGA White Fade
  3. ;--------------
  4. ;Fades the screen to white, then down to a palette, and exits with a fade
  5. ;to black.
  6. ;
  7. ;This demo can load and fade any picture that you specify at the end of
  8. ;this file.
  9. ;
  10. ;Press left mouse button to exit.
  11.  
  12.     INCDIR    "INCLUDES:"
  13.     INCLUDE    "exec/exec_lib.i"
  14.     INCLUDE    "games/games_lib.i"
  15.     INCLUDE    "games/games.i"
  16.  
  17. CALL    MACRO
  18.     jsr    _LVO\1(a6)
  19.     ENDM
  20.  
  21.     SECTION    "AGAWhiteFade",CODE
  22.  
  23. ;===========================================================================;
  24. ;                             INITIALISE DEMO
  25. ;===========================================================================;
  26.  
  27. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  28.     move.l    ($4).w,a6
  29.     lea    GMS_Name(pc),a1
  30.     moveq    #$00,d0
  31.     CALL    OpenLibrary
  32.     move.l    d0,GMS_Base
  33.     beq.s    .Error_GMS
  34.  
  35.     move.l    GMS_Base(pc),a6
  36.     sub.l    a0,a0
  37.     CALL    SetUserPrefs
  38.  
  39.     lea    Screen(pc),a0
  40.     lea    Picture(pc),a1
  41.     CALL    LoadPic
  42.     tst.w    d0
  43.     bne.s    .Error_Picture
  44.  
  45.     move.l    PIC_Palette(a1),GS_Palette(a0)
  46.     move.l    PIC_AmtColours(a1),GS_AmtColours(a0)
  47.     move.w    PIC_Planes(a1),GS_Planes(a0)
  48.     move.w    PIC_ScrType(a1),GS_ScrType(a0)
  49.     move.l    PIC_Data(a1),GS_MemPtr1(a0)
  50.     CALL    AddScreen
  51.     tst.l    d0
  52.     bne.s    .Error_Screen
  53.  
  54.     CALL    ShowScreen
  55.  
  56.     bsr.s    Main
  57.  
  58. .ReturnToDOS
  59.     move.l    GMS_Base(pc),a6
  60.     lea    Picture(pc),a1
  61.     CALL    FreePic
  62. .Error_Picture
  63.     lea    Screen(pc),a0
  64.     CALL    DeleteScreen
  65. .Error_Screen
  66.     move.l    ($4).w,a6
  67.     move.l    GMS_Base(pc),a1
  68.     CALL    CloseLibrary
  69. .Error_GMS
  70.     MOVEM.L    (SP)+,A0-A6/D1-D7
  71.     moveq    #$00,d0
  72.     rts
  73.  
  74. ;===========================================================================;
  75. ;                                MAIN CODE
  76. ;===========================================================================;
  77.  
  78. Main:    lea    Screen(pc),a0
  79.     moveq    #$00,d0    ;d0 = FadeState (reset).
  80.     moveq    #5,d1    ;d1 = Speed of fade.
  81.     moveq    #$000000,d2    ;d2 = Source colour
  82.     move.l    #$ffffff,d5    ;d5 = Destination colour.
  83.     moveq    #00,d3    ;d3 = Start colour
  84.     move.l    GS_AmtColours(a0),d4    ;d4 = Amount of colours.
  85. .f_in    CALL    WaitSVBL
  86.     CALL    ColourMorph    ;Do the fade routine.
  87.     tst.w    d0    ;Has the fade finished yet?
  88.     bne.s    .f_in    ;If not, keep doing it.
  89.  
  90.     moveq    #2,d1    ;d1 = Speed of fade.
  91.     move.l    GS_Palette(a0),a1    ;a1 = Palette to fade to.
  92.     move.l    #$ffffff,d2    ;d2 = Colour we are fading from.
  93. .f_mid    CALL    WaitSVBL
  94.     CALL    ColourToPalette    ;Do the fade routine.
  95.     tst.w    d0    ;Has the fade finished yet?
  96.     bne.s    .f_mid    ;If not, keep doing it.
  97.  
  98.     moveq    #2,d1    ;d0 = Speed of fade.
  99.     move.l    GS_Palette(a0),a1    ;a1 = Source palette.
  100.     moveq    #$000000,d2    ;d2 = Destination colour.
  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    #20,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. Screen:    dc.l    GSV1,0    ;Version header.
  121.     dc.l    0,0,0    ;Screen memory pointers 1/2/3
  122.     dc.l    0    ;Screen link.
  123.     dc.l    0    ;Address of palette.
  124.     dc.l    0    ;Address of rasterlist.
  125.     dc.l    0    ;Amt of colours in palette.
  126.     dc.w    320,256    ;Screen Width and Height.
  127.     dc.w    0,0,0    ;Picture Width, ByteWidth, Height.
  128.     dc.w    0    ;Amt of planes.
  129.     dc.w    0,0    ;X/Y screen offsets
  130.     dc.w    0,0    ;X/Y picture offsets.
  131.     dc.l    0    ;Special attributes.
  132.     dc.w    LORES|COL24BIT    ;Screen mode.
  133.     dc.w    0    ;Screen type
  134.  
  135. Picture    dc.l    PCV1,0    ;Version header.
  136.     dc.l    0    ;Source data.
  137.     dc.w    320,320/8,256    ;Width in bytes, Height.
  138.     dc.w    0    ;Amount of Planes.
  139.     dc.l    0    ;Amount of colours.
  140.     dc.l    0    ;Source palette (remap).
  141.     dc.w    LORES|COL24BIT    ;Screen mode.
  142.     dc.w    0    ;Destination
  143.     dc.l    GETPALETTE|VIDEOMEM    ;Options.
  144.     dc.l    .File
  145. .File    dc.b    "GAMESLIB:data/IFF.Loading",0
  146.     even
  147.