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

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Scroll Memory
  3. ;-------------
  4. ;This demo shows you the power of the scrolling features by allowing you
  5. ;to scroll all over your chip ram :-).  Usually you would set limits to stop
  6. ;you from going over the boundaries, but that's up to you.
  7. ;
  8. ;Use mouse to move around, LMB exits.
  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    "ScrollMemory",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.     CALL    ShowScreen
  49.     CALL    InitJoyPorts
  50.     bsr.s    Main
  51.  
  52. .ReturnToDOS
  53.     move.l    GMS_Base(pc),a6
  54.     lea    Picture(pc),a1
  55.     CALL    FreePic
  56. .Error_Picture
  57.     move.l    GMS_Base(pc),a6
  58.     lea    Screen(pc),a0
  59.     CALL    DeleteScreen
  60. .Error_Screen
  61.     move.l    GMS_Base(pc),a1
  62.     move.l    ($4).w,a6
  63.     CALL    CloseLibrary
  64. .Error_GMS
  65.     MOVEM.L    (SP)+,A0-A6/D1-D7
  66.     moveq    #$00,d0
  67.     rts
  68.  
  69. ;===========================================================================;
  70. ;                                MAIN LOOP
  71. ;===========================================================================;
  72.  
  73. Main:
  74. .loop    moveq    #JPORT1,d0
  75.     moveq    #JT_ZBXY,d1
  76.     CALL    ReadJoyPort
  77.     btst    #MB_RMB,d0
  78.     bne.s    .done
  79.     move.w    d0,d1
  80.     asr.w    #8,d0    ;d0 = X Change
  81.     ext.w    d1
  82.  
  83.     ;btst    #MB_LMB,d0
  84.     ;bne.s    .MoveScreen
  85. .MovePicture
  86.     add.w    d0,GS_PicXOffset(a0)
  87.     add.w    d1,GS_PicYOffset(a0)
  88.     CALL    RemakeScreen
  89.     CALL    MovePicture
  90.     CALL    WaitSVBL
  91.     bra.s    .loop
  92.  
  93. .MoveScreen
  94.     add.w    d0,GS_ScrXOffset(a0)
  95.     add.w    d1,GS_ScrYOffset(a0)
  96.     CALL    RemakeScreen
  97.     CALL    MovePicture
  98.     CALL    WaitSVBL
  99.     bra.s    .loop
  100. .done    rts
  101.  
  102. ;===========================================================================;
  103. ;                                  DATA
  104. ;===========================================================================;
  105.  
  106. GMS_Name:
  107.     dc.b    "games.library",0
  108.     even
  109. GMS_Base:
  110.     dc.l    0
  111.  
  112. AMT_PLANES =    5
  113.  
  114. Screen:    dc.l    GSV1,0
  115.     dc.l    0,0,0    ;Screen memory 1/2/3.
  116.     dc.l    0    ;Screen link.
  117.     dc.l    Palette    ;Address of palette.
  118.     dc.l    0    ;Address of rasterlist.
  119.     dc.l    0    ;Amount of colours in palette.
  120.     dc.w    320,256    ;Screen Width, Height.
  121.     dc.w    0,0,0    ;Picture Width/8, Height.
  122.     dc.w    AMT_PLANES    ;Amount of planes
  123.     dc.w    0,0    ;X/Y screen offsets.
  124.     dc.w    0,0    ;X/Y picture offsets.
  125.     dc.l    HSCROLL|VSCROLL|SBUFFER ;|CENTRE    ;Special attributes.
  126.     dc.w    COL12BIT|LORES    ;Screen mode.
  127.     dc.w    ILBM    ;Screen type
  128.  
  129. Palette    dc.w    $000,$130,$FCB,$FA9,$D88,$965,$644,$211
  130.     dc.w    $400,$444,$FF0,$432,$CC0,$150,$501,$880
  131.     dc.w    $261,$271,$382,$492,$5A3,$5B4,$677,$6C4
  132.     dc.w    $788,$9AA,$BCC,$801,$901,$A02,$701,$601
  133.  
  134. Picture    dc.l    PCV1,0    ;Version header.
  135.     dc.l    0    ;Source data.
  136.     dc.w    320,320/8,256    ;Width, Height.
  137.     dc.w    AMT_PLANES    ;Amount of Planes.
  138.     dc.l    32    ;Amount of colours.
  139.     dc.l    Palette    ;Source palette (remap).
  140.     dc.w    LORES|LACED    ;Screen mode.
  141.     dc.w    ILBM    ;Destination
  142.     dc.l    0    ;Parameters.
  143.     dc.l    .File
  144. .File    dc.b    "GAMESLIB:data/IFF.Pic320",0
  145.     even
  146.  
  147.