Mail Archives: djgpp/1999/04/15/06:26:02
This is a multi-part message in MIME format.
--Boundary_(ID_jFBjfUtG3VL98j5dlmrZdw)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: quoted-printable
Hello!
I'm working on a program that needs to copy a large block of =
data (approximately 1MB) to a different memory location every time a =
specific time period has passed, and record the elapsed program time. To =
that effect, I have tried reprogramming the timer interrupt and doing =
the copy inside the interrupt handler, but I've had some problems =
because the copy takes too much time and so my handler misses the next =
event, screwing up my timekeeping and other parts of the program.
=20
After reading a bit, I found an interesting technique: you pop =
the contents of the stack until you reach the return address used by the =
iret instruction, and insert the return address of the copy function, =
then push back all the values you had just popped. This way, the iret =
would make the program jump back to the copy function, which would in =
turn ret back to the part of the program that was executing before the =
interrupt ocurred (provided you save and restore the appropiate =
registers).
Now, my question is: would it be possible to do something like =
that in djgpp? If it can be done, exactly how would that be?
Thanks.
Miguel Angel Ordorica V. sleeptk AT geocities DOT com , =
ordorica AT df1 DOT telmex DOT net DOT mx
--Boundary_(ID_jFBjfUtG3VL98j5dlmrZdw)
Content-type: text/html; charset=iso-8859-1
Content-transfer-encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2014.210" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV style=3D"FONT: 10pt arial"></DIV>
<DIV><FONT size=3D2> =
Hello!</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=3D2> I'm working on =
a program=20
that needs to copy a large block of data (approximately 1MB) to a=20
different memory location every time a specific time period has =
passed, and=20
record the elapsed program time. To that effect, I have tried =
reprogramming the=20
timer interrupt and doing the copy inside the interrupt =
handler, but=20
I've had some problems because the copy takes too much time and so my =
handler=20
misses the next event, screwing up my timekeeping and other parts of the =
program.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2> After =
reading a=20
bit, I found an interesting technique: you pop the contents of the stack =
until=20
you reach the return address used by the iret instruction, and insert =
the return=20
address of the copy function, then push back all the values you had just =
popped.=20
This way, the iret would make the program jump back to the copy =
function, which=20
would in turn ret back to the part of the program that was =
executing before=20
the interrupt ocurred (provided you save and restore the appropiate=20
registers).</FONT></DIV>
<DIV><FONT size=3D2> Now, my =
question is:=20
would it be possible to do something like that in djgpp? If it can be =
done,=20
exactly how would that be?</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT=20
size=3D2> &nbs=
p;  =
;=20
Thanks.</FONT></DIV>
<DIV><FONT=20
size=3D2> &nbs=
p;  =
;=20
Miguel Angel Ordorica V. <A=20
href=3D"mailto:sleeptk AT geocities DOT com">sleeptk AT geocities DOT com</A> , =
<A=20
href=3D"mailto:ordorica AT df1 DOT telmex DOT net DOT mx">ordorica AT df1 DOT telmex DOT net DOT mx</A>=
</FONT></DIV></BODY></HTML>
--Boundary_(ID_jFBjfUtG3VL98j5dlmrZdw)--
- Raw text -