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

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;AGA FloodFill Demo
  3. ;------------------
  4. ;A demo of how you should use the FLOOD raster command.
  5. ;
  6. ;To exit the demo, press the left mouse button.
  7.  
  8.     INCDIR    "INCLUDES:"
  9.     INCLUDE    "exec/exec_lib.i"
  10.     INCLUDE    "games/games_lib.i"
  11.     INCLUDE    "games/games.i"
  12.  
  13. CALL    MACRO
  14.     jsr    _LVO\1(a6)
  15.     ENDM
  16.  
  17.     SECTION    "FloodFill",CODE
  18.  
  19. ;===========================================================================;
  20. ;                             INITIALISE DEMO
  21. ;===========================================================================;
  22.  
  23. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  24.     move.l    ($4).w,a6
  25.     lea    GMS_Name(pc),a1
  26.     moveq    #$00,d0
  27.     CALL    OpenLibrary
  28.     move.l    d0,GMS_Base
  29.     beq.s    .Error_GMS
  30.  
  31.     move.l    GMS_Base(pc),a6
  32.     sub.l    a0,a0
  33.     CALL    SetUserPrefs
  34.  
  35.     lea    Screen(pc),a0
  36.     CALL    AddScreen
  37.     tst.l    d0
  38.     bne.s    .Error_Screen
  39.  
  40.     move.l    GS_MemPtr1(a0),a1
  41.     lea    PicFile(pc),a0
  42.     moveq    #$00,d0
  43.     CALL    SmartLoad
  44.     tst.w    d0
  45.     beq.s    .ReturnToDOS
  46.  
  47.     lea    Screen(pc),a0
  48.     CALL    ShowScreen
  49.  
  50.     bsr.s    Main
  51.  
  52. .ReturnToDOS
  53.     move.l    GMS_Base(pc),a6
  54.     lea    Screen(pc),a0
  55.     CALL    DeleteScreen
  56. .Error_Screen
  57.     move.l    GMS_Base(pc),a1
  58.     move.l    ($4).w,a6
  59.     CALL    CloseLibrary
  60. .Error_GMS
  61.     MOVEM.L    (SP)+,A0-A6/D1-D7
  62.     moveq    #$00,d0
  63.     rts
  64.  
  65. ;===========================================================================;
  66. ;                                MAIN CODE
  67. ;===========================================================================;
  68.  
  69. Main:
  70. .Flood    CALL    WaitSVBL
  71.     bsr.s    FloodFill
  72.     tst.w    d0
  73.     beq.s    .Flood
  74.  
  75.     CALL    WaitLMB
  76.  
  77.     moveq    #0,d0
  78.     moveq    #2,d1
  79.     lea    Palette(pc),a1
  80.     moveq    #$000000,d2
  81.     moveq    #00,d3
  82.     move.l    #128,d4
  83. .Fade    move.l    d0,-(sp)    ;Run our own VBL wait code here
  84.     moveq    #$00,d0    ;for better fading.
  85.     CALL    WaitRastLine
  86.     CALL    AutoSwitch
  87.     move.l    (sp)+,d0
  88.     CALL    PaletteToColour
  89.     tst.w    d0
  90.     bne.s    .Fade
  91.     rts
  92.  
  93. ;===========================================================================;
  94. ;                               FLOOD FILL
  95. ;===========================================================================;
  96.  
  97. FloodFill:
  98.     lea    Screen(pc),a0
  99.     lea    RasterList(pc),a2
  100.     cmp.w    #256,2(a2)
  101.     bge.s    .done
  102.     addq.w    #1,2(a2)
  103.     CALL    UpdateRasterLines
  104.     moveq    #$00,d0
  105.     rts
  106.  
  107. .done    moveq    #-1,d0
  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 =    7
  121.  
  122. Screen:    dc.l    GSV1,0
  123.     dc.l    0,0,0    ;Screen memory 1/2/3.
  124.     dc.l    0    ;Screen link.
  125.     dc.l    Palette    ;Address of screen palette.
  126.     dc.l    RasterList    ;Address of rasterlist.
  127.     dc.l    0    ;Amount of colours in palette.
  128.     dc.w    320,256    ;Screen Width and Height.
  129.     dc.w    0,0,0    ;Picture Width/8 and Height.
  130.     dc.w    AMT_PLANES    ;Amount of planes.
  131.     dc.w    160,128    ;X/Y screen offset.
  132.     dc.w    0,0    ;X/Y picture offset.
  133.     dc.l    BLKBDR    ;Special attributes.
  134.     dc.w    COL24BIT|HIRES|LACED    ;Screen mode.
  135.     dc.w    ILBM    ;Screen type
  136.  
  137. Palette    dc.l    $000000,$FFFFFF,$FAF5F2,$FAE8E7
  138.     dc.l    $EEDED5,$E8D4C8,$DDC0AF,$D7B5A2
  139.     dc.l    $D1AC96,$DCA491,$CBA38B,$C5997E
  140.     dc.l    $BD8E74,$B5846A,$AD7A5F,$A57056
  141.     dc.l    $9D674D,$955D44,$8C533B,$844B34
  142.     dc.l    $7C432D,$743B26,$6C3320,$642D1B
  143.     dc.l    $5C2616,$532010,$4A1D0C,$411A09
  144.     dc.l    $381606,$2F1204,$260F02,$1D0C00
  145.     dc.l    $AC783A,$A67139,$A06C39,$986638
  146.     dc.l    $995F36,$906037,$8C5C36,$945733
  147.     dc.l    $865735,$905030,$7E5133,$8D4B2E
  148.     dc.l    $764B31,$6E4630,$8A462D,$64412B
  149.     dc.l    $5D3D27,$593A24,$543822,$50351F
  150.     dc.l    $4B341D,$47301A,$592218,$402D17
  151.     dc.l    $382813,$3B2007,$302310,$2B200D
  152.     dc.l    $331100,$430907,$3C0504,$2E0202
  153.     dc.l    $B48038,$B7743D,$AE6350,$A85D4A
  154.     dc.l    $A35644,$9E503E,$994A39,$944534
  155.     dc.l    $9F4336,$8E3F30,$87412B,$87382A
  156.     dc.l    $823628,$803226,$792C21,$72251C
  157.     dc.l    $E1AB98,$DBA28C,$D79C89,$D29582
  158.     dc.l    $CD8D7A,$C88672,$C27E6B,$BD7764
  159.     dc.l    $B8705D,$B36A57,$BB5244,$AD4A3D
  160.     dc.l    $C8594A,$7F7444,$847D49,$67271E
  161.     dc.l    $6C2219,$651D15,$5E1711,$57130E
  162.     dc.l    $500F0B,$4A0C09,$350303,$270000
  163.     dc.l    $89874E,$8C8E53,$8C9358,$8E9D62
  164.     dc.l    $C6904A,$9AA467,$CD9E51,$AFAE6F
  165.     dc.l    $E3D765,$D5AE58,$BCAD78,$C1AC7C
  166.     dc.l    $CBAA82,$D5A588,$EAA09B,$ECA7A2
  167.     dc.l    $EDADA9,$EFB5B1,$F0BBB8,$F2C2BF
  168.     dc.l    $F4CBC8,$F5D1CF,$F7D9D7,$FDF7F7
  169.  
  170. RasterList:
  171.     WAITLINE 000
  172.     FLOOD
  173.     RASTEND
  174.  
  175. PicFile    dc.b    "GAMESLIB:data/Yattering128.pak",0
  176.     even
  177.  
  178.