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

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Alteration of screen dimensions
  3. ;-------------------------------
  4. ;Test routine for height and width alteration.  Move the mouse to alter the
  5. ;position of the screen's right hand corner.
  6. ;
  7. ;Hold the LMB and move the mouse around to move the entire screen around
  8. ;your monitor.
  9. ;
  10. ;Press RMB to exit.
  11.  
  12.     INCDIR    "INCLUDES:"
  13.     INCLUDE    "exec/exec_lib.i"
  14.     INCLUDE    "games/games_lib.i"
  15.     INCLUDE    "games/games.i"
  16.  
  17. CALL    MACRO
  18.     jsr    _LVO\1(a6)
  19.     ENDM
  20.  
  21.     SECTION    "Redimension",CODE
  22.  
  23. ;===========================================================================;
  24. ;                             INITIALISE DEMO
  25. ;===========================================================================;
  26.  
  27. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  28.     move.l    ($4).w,a6
  29.     lea    GMS_Name(pc),a1
  30.     moveq    #$00,d0
  31.     CALL    OpenLibrary
  32.     move.l    d0,GMS_Base
  33.     beq.s    .Error_GMS
  34.  
  35.     move.l    GMS_Base(pc),a6
  36.     sub.l    a0,a0
  37.     CALL    SetUserPrefs
  38.  
  39.     lea    Screen(pc),a0
  40.     CALL    AddScreen
  41.     tst.l    d0
  42.     bne.s    .Error_Screen
  43.  
  44.     lea    Picture(pc),a1
  45.     move.l    GS_MemPtr1(a0),PIC_Data(a1)
  46.     CALL    LoadPic
  47.     tst.w    d0
  48.     bne.s    .Error_Picture
  49.  
  50.     move.l    PIC_Palette(a1),GS_Palette(a0)
  51.     CALL    UpdatePalette
  52.  
  53.     CALL    ShowScreen
  54.     CALL    InitJoyPorts
  55.     bsr.s    Main
  56.  
  57. .ReturnToDOS
  58.     move.l    GMS_Base(pc),a6
  59.     lea    Picture(pc),a1
  60.     CALL    FreePic
  61. .Error_Picture
  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    #JPORT1,d0    ;Read from port 1
  78.     moveq    #JT_ZBXY,d1
  79.     CALL    ReadJoyPort    ;Go get port status.
  80.     btst    #MB_RMB,d0
  81.     bne.s    Fade_Here
  82.     move.w    d0,d1
  83.     ext.w    d0
  84.     asr.w    #8,d1
  85.  
  86.     btst    #MB_LMB,d0
  87.     bne.s    .RMB
  88.  
  89.     add.w    d1,GS_ScrWidth(a0)
  90.     add.w    d0,GS_ScrHeight(a0)
  91.     bra.s    .chkty
  92.  
  93. .RMB    add.w    d1,GS_ScrXOffset(a0)
  94.     add.w    d0,GS_ScrYOffset(a0)
  95.  
  96. .chkty    tst.w    GS_ScrHeight(a0)
  97.     bge.s    .chkby
  98.     clr.w    GS_ScrHeight(a0)
  99. .chkby    cmp.w    #256,GS_ScrHeight(a0)
  100.     ble.s    .chklx
  101.     move.w    #256,GS_ScrHeight(a0)
  102. .chklx    tst.w    GS_ScrWidth(a0)
  103.     bge.s    .chkrx
  104.     clr.w    GS_ScrWidth(a0)
  105. .chkrx    cmp.w    #320,GS_ScrWidth(a0)
  106.     ble.s    .done
  107.     move.w    #320,GS_ScrWidth(a0)
  108.  
  109. .done    CALL    WaitSVBL    ;Always wait for a VBL first.
  110.     CALL    RemakeScreen    ;Reposition the screen now.
  111.     bra.s    Main
  112.  
  113. Fade_Here:
  114.     moveq    #00,d0
  115.     moveq    #1,d1    ;d1 = Speed
  116.     moveq    #$000,d2
  117.     moveq    #00,d3    ;d1 = Start at colour zero.
  118.     moveq    #32,d4    ;d2 = Amount of colours (32)
  119.     move.l    GS_Palette(a0),a1    ;a1 = Palette to fade to.
  120. .Fade    CALL    WaitSVBL
  121.     CALL    PaletteToColour
  122.     tst.w    d0
  123.     bne.s    .Fade
  124.     rts
  125.  
  126. ;===========================================================================;
  127. ;                           CODE-RELATIVE DATA
  128. ;===========================================================================;
  129.  
  130. GMS_Name:
  131.     dc.b    "games.library",0
  132.     even
  133. GMS_Base:
  134.     dc.l    0
  135.  
  136. AMT_PLANES =    5
  137.  
  138. Screen:    dc.l    GSV1,0    ;Version header.
  139.     dc.l    0,0,0    ;Screen_Mem1/2/3
  140.     dc.l    0    ;Screen link.
  141.     dc.l    0    ;Address of screen palette
  142.     dc.l    0    ;Address of rasterlist.
  143.     dc.l    0    ;Amt of colours in palette.
  144.     dc.w    320,256    ;Screen Width, Height.
  145.     dc.w    0,0,0    ;Picture Widths, Height.
  146.     dc.w    AMT_PLANES    ;Amt_Planes
  147.     dc.w    0,0    ;X/Y screen offset
  148.     dc.w    0,0    ;X/Y picture offset
  149.     dc.l    CENTRE    ;Special attributes
  150.     dc.w    COL12BIT|LACED|HIRES    ;Screen mode
  151.     dc.w    ILBM    ;Screen type
  152.     even
  153.  
  154. Picture    dc.l    PCV1,0    ;Version header.
  155.     dc.l    0    ;Source data.
  156.     dc.w    320,320/8,256    ;Width, Height.
  157.     dc.w    AMT_PLANES    ;Amount of Planes.
  158.     dc.l    32    ;Amount of colours.
  159.     dc.l    0    ;Source palette.
  160.     dc.w    COL12BIT|HIRES|LACED    ;Screen mode.
  161.     dc.w    ILBM    ;Destination
  162.     dc.l    GETPALETTE    ;Parameters.
  163.     dc.l    .File
  164. .File    dc.b    "GAMESLIB:data/IFF.Pic320",0
  165.     even
  166.  
  167.