www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/13/19:00:31

From: "Michael Stewart" <mike AT reggin DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Mouse Drawing Problem in SVGA Banked Mode 0x101
Date: Wed, 13 Jan 1999 23:35:20 -0000
Organization: Customer of Planet Online
Lines: 87
Message-ID: <77jarv$vko$1@news5.svr.pol.co.uk>
References: <3699BEA0 DOT 7E4 AT magicsoftware DOT freeserve DOT co DOT uk>
NNTP-Posting-Host: modem-88.thalidomide.dialup.pol.co.uk
X-Trace: news5.svr.pol.co.uk 916270783 32408 62.136.88.216 (13 Jan 1999 23:39:43 GMT)
NNTP-Posting-Date: 13 Jan 1999 23:39:43 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Simon wrote in message <3699BEA0 DOT 7E4 AT magicsoftware DOT freeserve DOT co DOT uk>...
>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
>
><snip>

When you are redrawing your mouse pointer during the interrupt you say you
get
the error when you are drawing other graphics at the same time.
I think that is where the error is, as you are drawing your mouse some code
is
changing the bank before you place your pixel (can't guarentee that though
:-).

Try adding something like this to your code to see if it gets rid of your
problem.

// in your drawing code
while (draw_flag); // pause if something else is drawing
draw_flag = true; // prevent other things drawing
// draw your stuff
draw_flag = false; // allow other things to be drawn

// in your mouse code
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;
// You should be able to get rid of this code by using the mouse driver to
// limit the mouse movement.
    if (System.Mouse.MousePointerVisible==MOUSE_ON) {
        while (draw_flag);
        draw_flag = true;
        DrawMousePointer(); //uses setpixel and to draw a pointer
        draw_flag = false;
    }

    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