www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/07/11:22:48

From: kalum AT myflat DOT com
Message-Id: <199910072342.RAA11101@lakdiva.slt.lk>
To: djgpp AT delorie DOT com
Date: Thu, 7 Oct 1999 17:42:10 +0600
MIME-Version: 1.0
Subject: RE: deriving the interrupt vector
In-reply-to: <000601bf1025$c65ed000$ae3d7a86@phoenix.com>
References: <19991006123316 DOT 20502 DOT rocketmail AT web1402 DOT mail DOT yahoo DOT com>
X-mailer: Pegasus Mail for Win32 (v3.12)
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 6 Oct 99, at 11:08, Johnny Chan <jchan AT paclink DOT net> wrote:

> Do you know how to raise a software interrupt in DJGPP?
> I had setted the interrupt vector, now I want to try
> to test it within my program, Does DJGPP has any
> function to raise a 32bit interrupt?
> --jC
> 
> >>-----Original Message-----
> >>From: Prashant TR [mailto:prashant_news AT yahoo DOT com]
> >>Sent: Wednesday, October 06, 1999 5:33 AM
> >>To: djgpp AT delorie DOT com
> >>Cc: Martin_Czamai AT peak-service DOT com
> >>Subject: Re: deriving the interrupt vector
> >>
> >>
> >>
> >>
> >>--- Martin Czamai <Martin_Czamai AT peak-service DOT com>
> >>wrote:
> >>> Hi all again,
> >>> 
> >>> who can tell me how to derive the interrupt vector,
> >>> when I've got the
> >>> interrupt request line (interrupt level) of a
> >>> interrupt controller?
> >>> 
> >>
> >>Hi Martin,
> >>
> >>I didn't quite get what you mean. Anyway, I assume
> >>you're asking me how to catch IRQs 0-15.
> >>
> >>The __dpmi_version_ret function gives you the PIC
> >>mater amd slave base interrupts.
> >>
> >>This means that if you want to hook IRQ0-7, you'll
> >>need to hook up interrupt vector=pic_master_base+IRQ
> >>no. This applies for IRQs 0-7.
> >>
> >>For IRQs 8-15, you'll need to hook up
> >>interrupt=pic_slave_base+IRQ no.
> >>
> >>Normally, IRQ0-7=interrupt 8h-0fh
> >>          IRQ8-15=interrupt 70h-78h
> >>
> >>Use _go32_dpmi_set_protected_mode_interrupt_vector.
> >>
> >>Is this more or less what you're looking for ?
> >>
> >>----
> >>Prashant TR
> >>http://www.members.tripod.com/prashant_tr/

Dear Johnny,
The int86 and int86x functions can be used to simulate a software interrupt.
You can find these in the libc reference with examples and details.
Here's the syntax-
#include <dos.h>
int int86(int ivec, union REGS *in, union REGS *out);

And here's a example. 

  union REGS r;
  r.x.ax = 0x0100;
  r.h.dl = 'c';
  int86(0x21, &r, &r);

In int86x you can also pass the segment registers(ES,DS ...etc) 
through and additional SREGS structure.
The above are the easiest but you might also want to check out the 
_go32_dpmi_simulate_int  function.
Hope this helps!
Bye.
Kalum S <kalum AT myflat DOT com>

- Raw text -


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