delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/03/05/23:15:15

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: zandro_arceo AT support DOT trendmicro DOT com (IeperNaum)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Try this...
Date: 5 Mar 2002 20:13:47 -0800
Organization: http://groups.google.com/
Lines: 95
Message-ID: <d26d20a2.0203052013.1a2401ab@posting.google.com>
References: <d26d20a2 DOT 0203050120 DOT 5157c02c AT posting DOT google DOT com> <65f8aa920cde3ff34e24773b5831c770 DOT 62691 AT mygate DOT mailgate DOT org>
NNTP-Posting-Host: 202.138.160.6
X-Trace: posting.google.com 1015388027 3346 127.0.0.1 (6 Mar 2002 04:13:47 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 6 Mar 2002 04:13:47 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Joel Saunders" <jbs30000 AT aol DOT com> wrote in message news:<65f8aa920cde3ff34e24773b5831c770 DOT 62691 AT mygate DOT mailgate DOT org>...
> #include <sys/farptr.h>
> #include <stdio.h>
> #include <crt0.h>
> #include <dpmi.h>
> #include <go32.h>
> unsigned char SChar;
> int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY;
> static __dpmi_regs callback_regs;
> static _go32_dpmi_seginfo info;
> void Int_2F_Handler(_go32_dpmi_registers *r);
> main()
> {
>         unsigned short Offset, Segment;
>         Offset = _farpeekw(_dos_ds, 0xBC);
>         Segment = _farpeekw(_dos_ds, 0xBD);
>         printf("\nOld 0DH Segment%X\nOld 0DH Offset%X\n", Segment,
> Offset);
>         __dpmi_regs r;
>         info.pm_offset = (long)Int_2F_Handler;
>         _go32_dpmi_allocate_real_mode_callback_iret(&info,
> &callback_regs);
>         _go32_dpmi_set_real_mode_interrupt_vector(0x2F, &info);
>         r.x.ax = 0x252F;
>         r.x.ds = info.rm_segment;
>         r.x.dx = info.rm_offset;
>         __dpmi_int(0x21, &r);
>         Offset = _farpeekw(_dos_ds, 0xBC);
>         Segment = _farpeekw(_dos_ds, 0xBD);
>         printf("\nNew 0DH Segment%X\nNew 0DH Offset%X\n", Segment,
> Offset);
> 
>         /*   __djgpp_exception_toggle(); */     /* Only needed if
> exceptions linked */
>         r.x.ax = 0x3100;
>         r.x.dx = 16;
>         __dpmi_int(0x21, &r);
> }
> void Int_2F_Handler(_go32_dpmi_registers *r)
> {
> /* Your code here */
> }

this is a followup to the email i sent prior to this one.

this is my code.

void int2f(_go32_dpmi_registers* r)
{
  printf("INT 2F Invoked r->h.ah = %X\r\n", r->h.ah);

  if (r->h.ah != 0x11)
  {
    printf("Do Control\r\n", r->h.ah);
    //other processing here
    return;
  }

}

 int main(int argc, char* argv[])
 {
   _go32_dpmi_seginfo info;
   _go32_dpmi_seginfo old_vector;

   _go32_dpmi_get_real_mode_interrupt_vector(0x2f, &old_vector);
   info.pm_offset = (unsigned long)int2f;
   _go32_dpmi_allocate_real_mode_callback_iret(&info, &g_r);
   _go32_dpmi_set_real_mode_interrupt_vector(0x2f, &info);

   _write(2,"Installing TSR\r\n",16);
   //__djgpp_exception_toggle(); 	// Only needed if exceptions linked

   __dpmi_regs r;
   r.x.ax = 0x3100;
   r.x.dx = 256 / 16;		// paragraphs
   __dpmi_int(0x21, &r);

   printf("Hey\n");

   _go32_dpmi_set_real_mode_interrupt_vector(0x2f, &old_vector);
   _go32_dpmi_free_real_mode_callback(&info);

 }

if i replace int 2f with int 21, it works. 'g_r' is global. 

another question:

even if i use int 21, if i remove the last two lines so that my
program would stay resident, the program just hangs. it does not even
print 'Hey'. what could be wrong?


thansk...

- Raw text -


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