home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / Asm / Screens / ClipPicture.s next >
Encoding:
Text File  |  1997-02-11  |  2.4 KB  |  109 lines

  1. ;Clip Picture
  2. ;------------
  3. ;This demo demonstrates the clipping of LoadPic().  You can load in any
  4. ;IFF picture and it will be clipped to fit the specified screen size
  5. ;(in this case, 320x256).
  6.  
  7.     INCDIR    "INCLUDES:"
  8.     INCLUDE    "exec/exec_lib.i"
  9.     INCLUDE    "games/games_lib.i"
  10.     INCLUDE    "games/games.i"
  11.  
  12. CALL    MACRO
  13.     jsr    _LVO\1(a6)
  14.     ENDM
  15.  
  16.     SECTION    "ClipPicture",CODE
  17.  
  18. ;===========================================================================;
  19. ;                             INITIALISE DEMO
  20. ;===========================================================================;
  21.  
  22. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  23.     move.l    ($4).w,a6
  24.     lea    GMS_Name(pc),a1
  25.     moveq    #$00,d0
  26.     CALL    OpenLibrary
  27.     move.l    d0,GMS_Base
  28.     beq.s    .Error_GMS
  29.  
  30.     move.l    GMS_Base(pc),a6
  31.     sub.l    a0,a0
  32.     CALL    SetUserPrefs
  33.  
  34.     lea    Picture(pc),a1           ;Load background picture.
  35.     CALL    LoadPic
  36.     tst.w    d0
  37.     bne.s    .Error_Picture
  38.  
  39.     lea    Screen(pc),a0
  40.     move.l    PIC_Data(a1),GS_MemPtr1(a0)
  41.     move.l    PIC_Palette(a1),GS_Palette(a0)
  42.     move.w    PIC_Planes(a1),GS_Planes(a0)
  43.     move.l    PIC_AmtColours(a1),GS_AmtColours(a0)
  44.     move.w    PIC_ScrType(a1),GS_ScrType(a0)
  45.     move.w    PIC_ScrMode(a1),GS_ScrMode(a0)
  46.  
  47.     CALL    AddScreen
  48.     tst.l    d0
  49.     bne.s    .Error_Screen
  50.  
  51.     CALL    ShowScreen
  52.  
  53.     CALL    WaitLMB
  54.  
  55. .ReturnToDOS
  56.     move.l    GMS_Base(pc),a6
  57.     lea    Screen(pc),a0
  58.     CALL    DeleteScreen
  59. .Error_Screen
  60.     move.l    GMS_Base(pc),a6
  61.     lea    Picture(pc),a1
  62.     CALL    FreePic
  63. .Error_Picture
  64.     move.l    ($4).w,a6
  65.     move.l    GMS_Base(pc),a1
  66.     CALL    CloseLibrary
  67. .Error_GMS
  68.     MOVEM.L    (SP)+,A0-A6/D1-D7
  69.     moveq    #$00,d0
  70.     rts
  71.  
  72. ;===========================================================================;
  73. ;                                  DATA
  74. ;===========================================================================;
  75.  
  76. GMS_Name:
  77.     dc.b    "games.library",0
  78.     even
  79. GMS_Base:
  80.     dc.l    0
  81.  
  82. Screen:    dc.l    GSV1,0    ;Version header.
  83.     dc.l    0,0,0    ;Screen memory 1/2/3.
  84.     dc.l    0    ;Screen link.
  85.     dc.l    0    ;Address of palette
  86.     dc.l    0    ;Address of rasterlist.
  87.     dc.l    0    ;Amount of colours in palette.
  88.     dc.w    320,256    ;Screen Width and Height.
  89.     dc.w    0,0,0    ;Picture Width and Height. 
  90.     dc.w    0    ;Amount of planes
  91.     dc.w    0,0    ;X/Y screen offsets.
  92.     dc.w    0,0    ;X/Y picture offsets.
  93.     dc.l    0    ;Special attributes.
  94.     dc.w    0    ;Screen mode.
  95.     dc.w    0    ;Screen type
  96.  
  97. Picture    dc.l    PCV1,0    ;Version header.
  98.     dc.l    0    ;Source data.
  99.     dc.w    320,320/8,256    ;Width/8, Height.
  100.     dc.w    0    ;Amount of Planes.
  101.     dc.l    0    ;Amount of colours.
  102.     dc.l    0    ;Palette.
  103.     dc.w    LORES|COL12BIT    ;Screen mode.
  104.     dc.w    0    ;Screen type.
  105.     dc.l    VIDEOMEM|GETPALETTE
  106.     dc.l    .File
  107. .File    dc.b    "GAMESLIB:data/IFF.Pic640x256",0
  108.     even
  109.