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

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Scroll Screen
  3. ;-------------
  4. ;This demo allows you to legally scroll 100 screens to the right by setting
  5. ;the SBUFFER flag.  What we are supposed to really do is blit blocks down
  6. ;the sides of the screen so that we have the illusion of a really large page
  7. ;size.  You can see this working in the MapEditor.s demo.
  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    "ScrollScreen",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.     move.l    PIC_Palette(a1),GS_Palette(a0)
  48.     CALL    UpdatePalette
  49.  
  50.     CALL    ShowScreen
  51.     CALL    InitJoyPorts
  52.  
  53.     bsr.s    Main
  54.  
  55. .ReturnToDOS
  56.     move.l    GMS_Base(pc),a6
  57.     lea    Picture(pc),a1
  58.     CALL    FreePic
  59. .Error_Picture
  60.     move.l    GMS_Base(pc),a6
  61.     lea    Screen(pc),a0
  62.     CALL    DeleteScreen
  63. .Error_Screen
  64.     move.l    GMS_Base(pc),a1
  65.     move.l    ($4).w,a6
  66.     CALL    CloseLibrary
  67. .Error_GMS
  68.     MOVEM.L    (SP)+,A0-A6/D1-D7
  69.     moveq    #$00,d0
  70.     rts
  71.  
  72. ;===========================================================================;
  73. ;                                MAIN LOOP
  74. ;===========================================================================;
  75.  
  76. Main:    moveq    #JPORT1,d0
  77.     CALL    ReadMouse
  78.     btst    #MB_LMB,d0
  79.     bne.s    .done
  80.     asr.w    #8,d0    ;d0 = X Change
  81.     add.w    d0,GS_PicXOffset(a0)
  82.     CALL    MovePicture
  83.     CALL    WaitSVBL
  84.     bra.s    Main
  85. .done    rts
  86.  
  87. ;===========================================================================;
  88. ;                                  DATA
  89. ;===========================================================================;
  90.  
  91. GMS_Name:
  92.     dc.b    "games.library",0
  93.     even
  94. GMS_Base:
  95.     dc.l    0
  96.  
  97. AMT_PLANES =    5
  98.  
  99. Screen:    dc.l    GSV1,0    ;Version header.
  100.     dc.l    0,0,0    ;Screen memory 1/2/3.
  101.     dc.l    0    ;Screen link.
  102.     dc.l    0    ;Address of palette.
  103.     dc.l    0    ;Address of rasterlist.
  104.     dc.l    0    ;Amount of colours in palette.
  105.     dc.w    320,256    ;Screen Width, Height.
  106.     dc.w    320,320/8,256    ;Picture Widths, Height.
  107.     dc.w    AMT_PLANES    ;Amount of planes
  108.     dc.w    0,0    ;X/Y Screen offset.
  109.     dc.w    0,0    ;X/Y Picture offset.
  110.     dc.l    HSCROLL|SBUFFER    ;Special attributes.
  111.     dc.w    LORES|COL12BIT    ;Screen mode.
  112.     dc.w    ILBM    ;Screen type
  113.  
  114. Picture    dc.l    PCV1,0    ;Version header.
  115.     dc.l    0    ;Source data.
  116.     dc.w    320,320/8,256    ;Width, Height.
  117.     dc.w    AMT_PLANES    ;Amount of Planes.
  118.     dc.l    32    ;Amount of colours.
  119.     dc.l    0    ;Source palette.
  120.     dc.w    LORES|COL12BIT    ;Screen mode.
  121.     dc.w    INTERLEAVED    ;Destination
  122.     dc.l    GETPALETTE    ;Parameters.
  123.     dc.l    .File
  124. .File    dc.b    "GAMESLIB:data/IFF.Pic320",0
  125.     even
  126.