www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/15/06:26:02

Date: Wed, 14 Apr 1999 21:35:59 -0500
From: "Miguel A. Ordorica V." <ordorica AT df1 DOT telmex DOT net DOT mx>
Subject: Is it possible...?
To: djgpp AT delorie DOT com
Message-id: <000b01be86e8$b48062c0$d193e994@df1.telmex.net.mx>
MIME-version: 1.0
X-Mailer: Microsoft Outlook Express 5.00.2014.211
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
X-Priority: 3
Reply-To: djgpp AT delorie DOT com

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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
Hello!</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; I'm working on =
a program=20
that needs to copy a large block of data (approximately 1MB) to a=20
different&nbsp;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&nbsp;and doing the copy inside the&nbsp;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>&nbsp;</DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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&nbsp;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>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 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>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
Thanks.</FONT></DIV>
<DIV><FONT=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
Miguel Angel Ordorica V. <A=20
href=3D"mailto:sleeptk AT geocities DOT com">sleeptk AT geocities DOT com</A>&nbsp;, =
<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 -


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