Mail Archives: djgpp/1999/09/30/21:26:22
Well, basically, I've got this bit of code written in assembly that I
want to use as an interrupt. I've only been working with DJGPP for about
a week so far, and I don't fully understand all this protected mode
stuff. When I wrote an interrupt in real mode I loaded it into memory
and then redirected the interrupt to that place in the memory. But I
guess its different for this.
Just say I have the following:
void interrupt()
{
asm("
blabla
");
}
and I want an interrupt to point to it. So I have to:
1. Save the __dpmi_get_protected_mode_interrupt_vector of the interrupt
I'm changing.
2. Now I don't understand this bit. It says call
__dpmi_lock_linear_region a series of times. But how do I know what
region I have to lock?
3. Then call __dpmi_set_protected_mode_interrupt_vector with _my_cs()
and my function offset. How do I get my function offset?
According to the FAQ that is all I have to do (apart from fix up the
interrupt at the end). So can anyone help me with the bits I don't get?
Thanks,
Alex
Eli Zaretskii wrote:
>
> On Thu, 30 Sep 1999, Alex Mendes da Costa wrote:
>
> > Sorry I keep asking questions!! I was wondering how its possible to load
> > a bit of assembly code that has been written in the inline assembler
> > into a place in memory, for use in an interrupt.
>
> Not at run time. You need to assemble the code separately, and put into
> your program an array of bytes that are the opcodes of the handler. Then
> use memcpy or whatever to copy them.
>
> But I really don't understand why do you need to go to such lengths?
> Can't you simply install your function, however it is written, as an
> interrupt handler? (Section 18.9 of the DJGPP FAQ tells you how.) Why
> do you need to copy it somewhere?
- Raw text -