home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / Asm / Screens / WideScroll.s < prev   
Encoding:
Text File  |  1997-01-10  |  3.2 KB  |  144 lines

  1. ;-------T-------T------------------------T-----------------------------------;
  2. ;Wide Scroll
  3. ;-----------
  4. ;This opens an extra wide picture of 640x256 pixels and scrolls it left
  5. ;and right.  Extremely large pictures are *totally* inadequate for games
  6. ;such as platformers and shoot'em-ups, because the picture size takes
  7. ;up  huge  amounts  of  memory.   However  for games like Skidmarks,
  8. ;Lemmings, Monkey Island, etc, such large screens can be a necessity.
  9.  
  10.     INCDIR    "INCLUDES:"
  11.     INCLUDE    "exec/exec_lib.i"
  12.     INCLUDE    "games/games_lib.i"
  13.     INCLUDE    "games/games.i"
  14.  
  15. CALL    MACRO
  16.     jsr    _LVO\1(a6)
  17.     ENDM
  18.  
  19.     SECTION    "WideScroll",CODE
  20.  
  21. ;===========================================================================;
  22. ;                             INITIALISE DEMO
  23. ;===========================================================================;
  24.  
  25. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  26.     move.l    ($4).w,a6
  27.     lea    GMS_Name(pc),a1
  28.     moveq    #$00,d0
  29.     CALL    OpenLibrary
  30.     move.l    d0,GMS_Base
  31.     beq.s    .Error_GMS
  32.  
  33.     move.l    GMS_Base(pc),a6
  34.     sub.l    a0,a0
  35.     CALL    SetUserPrefs
  36.  
  37.     lea    Screen(pc),a0
  38.     CALL    AddScreen
  39.     tst.l    d0
  40.     bne.s    .Error_Screen
  41.  
  42.     lea    Picture(pc),a1
  43.     move.l    GS_MemPtr1(a0),PIC_Data(a1)
  44.     CALL    LoadPic
  45.     tst.w    d0
  46.     bne.s    .Error_Picture
  47.  
  48.     move.l    PIC_Palette(a1),GS_Palette(a0)
  49.     move.l    PIC_AmtColours(a1),GS_AmtColours(a0)
  50.     CALL    UpdatePalette
  51.  
  52.     CALL    ShowScreen
  53.  
  54.     bsr.s    Main
  55.  
  56. .ReturnToDOS
  57.     move.l    GMS_Base(pc),a6
  58.     lea    Picture(pc),a1
  59.     CALL    FreePic
  60. .Error_Picture
  61.     move.l    GMS_Base(pc),a6
  62.     lea    Screen(pc),a0
  63.     CALL    DeleteScreen
  64. .Error_Screen
  65.     move.l    GMS_Base(pc),a1
  66.     move.l    ($4).w,a6
  67.     CALL    CloseLibrary
  68. .Error_GMS
  69.     MOVEM.L    (SP)+,A0-A6/D1-D7
  70.     moveq    #$00,d0
  71.     rts
  72.  
  73. ;===========================================================================;
  74. ;                                MAIN LOOP
  75. ;===========================================================================;
  76.  
  77. Main:    moveq    #0,d2
  78. .loop    CALL    WaitSVBL
  79.     tst.w    d2
  80.     bgt.s    .Right
  81.  
  82. .Left    tst.w    GS_PicXOffset(a0)
  83.     ble.s    .Right
  84.     moveq    #-2,d2
  85.     bra.s    .scroll
  86.  
  87. .Right    cmp.w    #320,GS_PicXOffset(a0)
  88.     bge.s    .Left
  89.     moveq    #2,d2
  90.  
  91. .scroll    add.w    d2,GS_PicXOffset(a0)
  92.     CALL    MovePicture
  93.  
  94. .done    moveq    #JPORT1,d0    ;Port 1 (Mouse)
  95.     moveq    #JT_ZBXY,d1
  96.     CALL    ReadJoyPort
  97.     btst    #MB_LMB,d0
  98.     beq.s    .loop
  99.     rts
  100.  
  101. ;===========================================================================;
  102. ;                                  DATA
  103. ;===========================================================================;
  104.  
  105. Direction:
  106.     dc.w    0
  107.  
  108. GMS_Name:
  109.     dc.b    "games.library",0
  110.     even
  111. GMS_Base:
  112.     dc.l    0
  113.  
  114. AMT_PLANES =    4
  115.  
  116. Screen:    dc.l    GSV1,0
  117.     dc.l    0,0,0    ;Screen_Mem1/2/3
  118.     dc.l    0    ;Screen link.
  119.     dc.l    0    ;Address of palette
  120.     dc.l    0    ;Address of rasterlist.
  121.     dc.l    0    ;Amt of colours in palette.
  122.     dc.w    320,256    ;Screen Width and Height.
  123.     dc.w    640,640/8,256    ;Picture Width, ByteWidth, Height.
  124.     dc.w    AMT_PLANES    ;Amt_Planes
  125.     dc.w    0,0    ;Top Of Screen, X/Y
  126.     dc.w    0,0    ;X/Y offsets.
  127.     dc.l    HSCROLL    ;Special attributes.
  128.     dc.w    LORES|COL12BIT    ;Screen mode.
  129.     dc.w    ILBM    ;Screen type
  130.     even
  131.  
  132. Picture    dc.l    PCV1,0    ;Version header.
  133.     dc.l    0    ;Source data.
  134.     dc.w    640,640/8,256    ;Width, Height.
  135.     dc.w    AMT_PLANES    ;Amount of Planes.
  136.     dc.l    0    ;Amount of colours.
  137.     dc.l    0    ;Source palette (remap).
  138.     dc.w    LORES|COL12BIT    ;Screen mode.
  139.     dc.w    ILBM    ;Destination
  140.     dc.l    GETPALETTE    ;Parameters.
  141.     dc.l    .File
  142. .File    dc.b    "GAMESLIB:data/IFF.Pic640x256",0
  143.     even
  144.