www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/24/19:10:28

Date: Thu, 24 Nov 1994 15:27:54 -0700 (PDT)
From: Travis Kuhn <trav AT clark DOT edu>
Subject: Interrupts
To: djgpp AT sun DOT soe DOT clarkson DOT edu

Ok, I was able to use the transfer buffer to pass data to and from
interrupt functions with dosmemget and dosmemput (thanks for the help...)
But I can't seem to get an interrupt to call a function though.  Here's an
example of what I'm trying to do.  Everything sets up fine, but when I
press the right mouse button, I get a segmentation fault.  I'm not sure if
I'm using set_real_mode_vector correctly or not... I tried to follow the
example for _go32_dpmi_allocate_real_mode_callback_iret(). 



handler(){
  printf("foo");
}

setup(){
  _go32_dpmi_seginfo info;
  unsigned long func_addr=handler;
  
  info.pm_offset=func_addr;
  
  _go32_dpmi_allocate_real_mode_callback_iret(&info, &reg);


/* This sets up the mouse driver to call the function at es:dx when the
   right mouse button is pressed.
*/
  reg.x.ax=12;
  reg.x.cx=8;
  reg.x.es=info.rm_segment;
  reg.x.dx=info.rm_offset;
  
  _go32_dpmi_simulate_int(0x33, &reg);

/**/
  
  _go32_dpmi_set_real_mode_interrupt_vector(0x33, &info);  
}


main(){
  reset_mouse();
	
  setup();
  getc(stdin);
}
	
------------------------------------------------------------------------------
Travis Kuhn        Clark College, Vancouver, Washington   |     PGP key
trav AT clark DOT edu     TIP#316  Play paintball!  Fence!       |    available
         "But now I refuse to obey." -- Emacs             |   upon request.
       

- Raw text -


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