cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/11/04:11:57

From: Simon <simon AT magicsoftware DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Mouse Drawing Problem in SVGA Banked Mode 0x101
Date: Mon, 11 Jan 1999 09:04:33 +0000
Organization: Customer of Planet Online
Lines: 101
Message-ID: <3699BEA0.7E4@magicsoftware.freeserve.co.uk>
NNTP-Posting-Host: modem-87.vaqta.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news8.svr.pol.co.uk 916045589 31633 62.136.91.215 (11 Jan 1999 09:06:29 GMT)
NNTP-Posting-Date: 11 Jan 1999 09:06:29 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 3.04Gold (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello, I am having a problem concerning drawing of the mouse pointer(in
an interrupt)
and drawing of normal graphics (not in an interrupt) in banked SVGA mode
0x101 (640*480*256) . What happens is that the mouse pointer sometimes
is drawn
to the wrong area of the screen but only when the pointer is on a bank
boundry.
This also only occurs when other graphics are being drawn in non
interupt code,
everything works fine in linear mode though. Any way here are a few
pieces of code which
may help diagnose my annoying problem.

Thanks for any help given
Simon

The following are from a set of libraries I am writing so some
variables and declarations may be external.

///////////////////////////////////////////////////////////////////////////
void SetBank(int bank){
    __dpmi_regs regs;
    static int first_set=TRUE;

    // makesure bank is set correctly on first set of bank 0

    if(first_set)
        first_set=FALSE;
    else{
        if (bank == System.Video.CurrentBank){
            return;
        }
   }
    bank <<= GlobaVESAInfo.WinGranularity;
    regs.x.ax = 0x4F05;
    regs.x.bx = 0;
    regs.x.dx = bank;
    //set access window
    __dpmi_int(0x10, &regs);
    regs.x.ax = 0x4F05;
    regs.x.bx = 1;
    regs.x.dx = bank;
    //get access window
    __dpmi_int(0x10, &regs);
      System.Video.CurrentBank = bank;

   return;
}
///////////////////////////////////////////////////////////////////////////
//cut down version of setpixel but this is the relavant bit
void SetPixel(int x, int y, int color){
    int addr,count;
   
    addr=y*GlobaVESAInfo.BytesPerScanLine+x;
    SetBank((addr >> 16));
    _farpokeb(_dos_ds,VGA_FRAME_BUFFER_ADDRESS + (addr & 0xFFFF),
color);
}
/////////////////////////////////////////////////////////////////////////////
static void MouseInteruptHandler(_go32_dpmi_registers *reg){
    __dpmi_regs registers;

    //get button stuff
    registers.x.ax=MOUSE_INFO_FUNCTION;
    __dpmi_int(MOUSE_DRIVER, &registers);

    //store
    System.Mouse.MouseButtonsStates=registers.x.bx;

    //get x-y movement since last interrupt
    registers.x.ax=MOUSE_MOVEMENT_RELATIVE_FUNCTION;
    __dpmi_int(MOUSE_DRIVER, &registers);

    disable();

    System.Mouse.MouseXPos += registers.x.cx;
    System.Mouse.MouseYPos += registers.x.dx;
    System.Mouse.MouseXRelativePos = registers.x.cx;
    System.Mouse.MouseYRelativePos = registers.x.dx;

    //adjust to keep in limits
    if (System.Mouse.MouseXPos >= System.Mouse.MXMaxLimit)
                System.Mouse.MouseXPos=System.Mouse.MXMaxLimit;
    if (System.Mouse.MouseXPos <= System.Mouse.MXMinLimit)
                System.Mouse.MouseXPos=System.Mouse.MYMinLimit;
    if (System.Mouse.MouseYPos >= System.Mouse.MYMaxLimit)
                System.Mouse.MouseYPos=System.Mouse.MYMaxLimit;
    if (System.Mouse.MouseYPos <= System.Mouse.MYMinLimit)
                System.Mouse.MouseYPos=System.Mouse.MYMinLimit;

    if (System.Mouse.MousePointerVisible==MOUSE_ON)
        DrawMousePointer(); //uses setpixel and to draw a pointer

    enable();
    System.Mouse.MouseXOldPos=System.Mouse.MouseXPos;
    System.Mouse.MouseYOldPos=System.Mouse.MouseYPos;

    //used to run any extra code when the mouse ints
    //not used when error occurs
    RunInterruptCallbacks(&mouse_interrupt_call_list);
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019