delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/22/00:47:06

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Joel Saunders" <jbs30000 AT aol DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: DJGPP TSR
Date: Tue, 22 Jan 2002 05:33:42 +0000 (UTC)
Organization: Mailgate.ORG Server - http://www.Mailgate.ORG
Lines: 58
Message-ID: <8f6731259c2274809aa909fd0438bd8e.62691@mygate.mailgate.org>
NNTP-Posting-Host: spider-mtc-tj051.proxy.aol.com
X-Trace: news.mailgate.org 1011671256 4086 64.12.106.41 (Tue Jan 22 06:33:42 2002)
X-Complaints-To: abuse AT mailgate DOT org
NNTP-Posting-Date: Tue, 22 Jan 2002 05:33:42 +0000 (UTC)
Injector-Info: news.mailgate.org; posting-host=spider-mtc-tj051.proxy.aol.com; posting-account=62691; posting-date=1011671256
User-Agent: Mailgate Web Server
X-URL: http://mygate.mailgate.org/mynews/comp/comp.os.msdos.djgpp/8f6731259c2274809aa909fd0438bd8e.62691%40mygate.mailgate.org
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi, my name is Joel, and I'm new here.
What I'd like to ask is, is it possible to DJGPP program that will stay
resident in protected mode after it ends and the computer goes back to
real mode?  For instance, I made a program that has the real mode mouse
interrupt 33h call a DGJPP routine when the right mouse button is
pushed, and that routine is supposed to make the computer beep.  But
when I run my program, nothing happens.
Here's my program, if anybody call tell me what I'm doing wrong, or, if
it's impossible to do what I want, I'd appreciate it.  Thanks.
#include <dpmi.h>
#include <go32.h>
static __dpmi_regs callback_regs;
static _go32_dpmi_seginfo callback_info;
void New_Mouse_Handler(void);
void User_Handler(__dpmi_regs *r);
unsigned char Character = 0;
char *Mouse_Pointer, *Mouse_Background;
int Install_Mouse_Handler(unsigned mask, void
(*User_Handler)(__dpmi_regs *));
void User_Handler(__dpmi_regs *r);
main(void)
{
        __dpmi_regs r;
        Install_Mouse_Handler(0x2, User_Handler);
        r.x.ax = 0x3100;
        r.x.dx = 4;
        __dpmi_int(0x21, &r);
        //__dpmi_terminate_and_stay_resident(0, 4);
}
int Install_Mouse_Handler(unsigned mask, void
(*User_Handler)(__dpmi_regs *))
{
        __dpmi_regs r;
        callback_info.pm_offset = (long)User_Handler;
        if(_go32_dpmi_allocate_real_mode_callback_retf(&callback_info,
&callback_regs))
                return -1; /* failure */
        r.x.ax = 0xc;
        r.x.cx = mask;
        r.x.es = callback_info.rm_segment;
        r.x.dx = callback_info.rm_offset;
        __dpmi_int(0x33, &r);
        return(r.x.flags & 1) ? -1 : 0;
}
void User_Handler(__dpmi_regs *r)
{
        __dpmi_regs R;
        if(r->x.cx == 2) {
                   R.x.ax = 0x0E07;
                   R.x.bx = 0;
                   __dpmi_int(0x10, &R);
        }
}



-- 
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

- Raw text -


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