[comp.sys.amiga.programmer] Overscan Programming

a976@mindlink.UUCP (Ron Tarrant) (01/25/91)

> T32QC@CUNYVM.BITNET writes:
> 
>       I need help programming in Overscan in 1.3. I was wondering if it was
> pos
> sible to change the system-configuration while the computer was booted
> already
> change the x,y offsets and then open a graphics screen. What methods are
> there
> any help would be greatly appreciated.
>                                               Thanks in advance,
>                                                     NEO
>                                               T32QC@CUNYVM



Here is a system I've put together using bits and pieces of other examples as
well as some ideas of my own. I've tested it under 1.3 and 2.0, neither of
which blew up under the test conditions.
        This code will give you an overscan display and will allow the
mousepointer access to the overscan area. Before you call SetOverScan(), you
will have to open Intuition, Graphics, and a screen.

--------------------- cut here -----------------------

#include <exec/types.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <graphics/gfxbase.h>
#include "syncProto.h"
#include "myContext.h"

/******************************************************************/
/* My routine to fiddle with IntuitionBase, making the mouse area */
/* the same size as the overscan screen displayed.                */
/******************************************************************/
void SetUpMouse(vp, screen, ibase)
 struct ViewPort *vp;
 struct Screen *screen;
 struct IntuitionBase *ibase;
{
        ULONG ilock;

        ilock = LockIBase(0L);
        ibase->MinXMouse = vp->DxOffset;
        if(screen->Width > 600)
        {
                ibase->MaxXMouse = screen->Width;
        }
        else
        {
                ibase->MaxXMouse = (screen->Width * 2);
        }               ibase->MinYMouse = vp->DyOffset;
        ibase->MaxYMouse = 480L;
        UnlockIBase(ilock);
   Forbid();
   if(ibase->ActiveWindow)
      ClearPointer(ibase->ActiveWindow);
   Permit();
}

/***************************************************************/
/* Here we modify the viewport so that it LOOKS like overscan. */
/***************************************************************/
void SetOverScan(screen, gfxbase, ibase)
 struct Screen *screen;
 struct GfxBase *gfxbase;
 struct IntuitionBase *ibase;
{
        register WORD rows, x = screen->Width, y = screen->Height;
        register struct ViewPort *vp = &(screen->ViewPort);

        rows = gfxbase->NormalDisplayRows;
        if(rows > 300)  { rows >>= 1; }
        x -= 320;
        if(vp->Modes & HIRES) { x -= 320; }
        y -= rows;
        if(vp->Modes & LACE)    { y -= rows; }
        x >>= 1;
        if(x < 0) { x = 0; }
        y >>= 1;
        if(y < 0) { y = 0; }
        if(y > 40) { y = 40;    }
        if(vp->Modes & HAM)     /* Correct overscan HAM color distortions */
        {
                if((gfxbase->ActiView->DxOffset - x) < 96)
                {
                        x = gfxbase->ActiView->DxOffset - 96;
                }
        }
        vp->DxOffset = -x;
        vp->DyOffset = -y;
        MakeScreen(screen);
        RethinkDisplay();
        SetUpMouse(vp, screen, ibase);
}

void OverScanOff(screen, gfxbase)
 struct Screen *screen;
 struct GfxBase *gfxbase;
{
        struct ViewPort *vp = &(screen->ViewPort);
        vp->DxOffset = 0;
        vp->DyOffset = 0;
        MakeScreen(screen);
        RethinkDisplay();
}

------------------- cut here ---------------------

So, all you really have to deal with here is: call SetOverScan() to turn it on
and call OverScanOff() to turn it off.
If you find any way of improving this code I'd appreciate hearing about it.
Although, I think it's pretty robust the way it is.
-Ron Tarrant
a976@Mindlink.UUCP

a499@mindlink.UUCP (Robert Salesas) (01/25/91)

The simplest method for 1.3 ONLY involves setting the right negative
values to the screen offset and the viewport offset of the screen you want to
open, once it is opened (forgive the long sentence).

Rob
PS:  Don't fiddle with the preferences

T32QC@CUNYVM.BITNET (NEO) (01/25/91)

      I need help programming in Overscan in 1.3. I was wondering if it was pos
sible to change the system-configuration while the computer was booted already
change the x,y offsets and then open a graphics screen. What methods are there
any help would be greatly appreciated.
                                              Thanks in advance,
                                                    NEO
                                              T32QC@CUNYVM