🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #6568

Mouse Bug?

#6568
From: Stephen Todd Leroux
Date: Sun, 20 Dec 1992 21:22
72 lines
2055 bytes
Hello computing world.

I'm writing a drawing program.  I wrote the following mouse library to work
in conjuction with an interface library I wrote to implement button pushes
and stuff like that.

Only problem is, sometimes the mouseDown() call doesn't work!  It usually
has problems after a call to lastLeftDown().  I have no
idea why.  Perhaps I'm missing an interrupt somewhere or something?  BTW
if you're really interested there are about a million other bugs I can lay
on you -- but we'll go one at a time for now.

o /                                    o /
 X ------------------------------------ X ---------------------------------
O \                                    O \

int mouseDown()
{
    struct REGPACK r;

    r.r_ax = 3;
    intr(0x33,&r);
    if (r.r_bx > 0)
        return 1;
    return 0;
}
point *lastLeftUp(int *num)
{
    struct REGPACK r;
    point *p;

    r.r_ax = 6;
    r.r_bx = 0;
    intr(0x33, &r);
    *num = r.r_bx;
    if (r.r_bx == 0) return NULL;
    p = (point *)(malloc(sizeof(point)));
    p->x = r.r_cx;
    p->y = r.r_dx;

    return p;
}

point *lastLeftDown(int *num)
{
    struct REGPACK r;
    point *p;

    r.r_ax = 5;
    r.r_bx = 0;
    intr(0x33, &r);
    *num = r.r_bx;
    if (r.r_bx == 0) return NULL;
    p = (point *)(mmalloc(sizeof(point)));
    p->x = r.r_cx;
    p->y = r.r_dx;

    return p;
}

void initMouse()
{
    struct REGPACK r;

    r.r_ax = 0;
    intr(0x33, &r);
    showMouse();

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==- 

Please e-mail your wisdoms to w5y092@rick.cs.ubc.ca
Thanks!
Technical Details
Message-ID: <1h2o6qINNau3@gambier.rick.cs.ubc.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!cs.ubc.ca!gambier.rick.cs.ubc.ca!not-for-mail

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!cs.ubc.ca!gambier.rick.cs.ubc.ca!not-for-mail
From: w5y092@rick.cs.ubc.ca (Stephen Todd Leroux)
Newsgroups: comp.os.msdos.programmer
Subject: Mouse Bug?
Date: 20 Dec 1992 13:22:34 -0800
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
Lines: 75
Message-ID: <1h2o6qINNau3@gambier.rick.cs.ubc.ca>
NNTP-Posting-Host: gambier.rick.cs.ubc.ca