TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: mark lewis
from: David Noon
date: 1996-12-15 19:03:00
subject: Magic code for DosSleep

On Friday, 96/12/13, mark lewis wrote to David Noon about "Magic code
for DosSleep" as follows:

ml> well, see... some systems seem to get better results with 
ml> int 28h, some with dossleep and others with int 2fh... in 
ml> this case, the above code is from one of my general use 
ml> libraries... it is used in all my programs...

Hi Mark,

I am suprised that INT 28H seems to work well. It is, I believe, the
one that OS/2 uses for idle detection and so must be called repeatedly
before any effect is seen. This would indicate to me that the INT 2FH
is broken on those systems.

The DosSleep() API in DOS mode should simply be the HLT instruction
that is used inside the ISR for INT 2FH.

Simply to yield the remainder of the current timeslice you should use
INT 2FH, function 1680H.

ml>  DN> By using the interrupt you save carrying versions of the code that
ml> 
ml> the which interrupt? int 28h or 2fh?? see the "problem" ??

INT 2FH.

If your current version is broken you can replace the ISR with one of
your own assemblage. Just fiddle with the AX register until it works.

There is at least one on Hobbes, called TAME.COM. It was written a few
years ago by Peter Fitzsimmons. It could provide you with a code
template if you want.

ml>  DN> are inapplicable to the user's system. It also saves you from
ml>  DN> having to alter your code every time IBM changes the internal
ml>  DN> details associated with the HLT setup. The only time you should
ml>  DN> need to be concerned is when the IBM code goes wrong, and then
ml> 
ml> that's what started all this... under warp4, int 2fh doesn't
ml> work... yet...  so i wanted to code "the best one" for the version
ml> in use  and later i'll add the ability for the enduser to force 
ml> which ever one he wants to use and let him suffer whatever 
ml> consequences may befall him -=%-)

But by putting them all in the one block of code your program carries
a great deal of redundant logic. If you have the AUTOEXEC.BAT add the
appropriate ISR (i.e. appropriate to the current system) then you need
only use the DPMI interrupt no matter what the environment. This
removes the selection logic and all the inapplicable code sections from
your program.

ml> nothing really fancy... are you saying that i should  write an ISR
ml> on "my own" int, code it to call the  appropraite int (kinda like
ml> the above) for giving up the  time slices and call "my own" all the
ml> time? hummm... i  think i'd still end up with some kind of "case
ml> statement"  like routine that calls whichever int is appropraite... 
ml> like the above 

I'm not suggesting you create your own INT function. Just override INT
2FH when it is broken, or use the one already in place when it works.

The selection should be made when the AUTOEXEC.BAT is prepared. The
line in AUTOEXEC.BAT to install the ISR should remain unchanged for the
life of the particular operating system. If the "native" version of the
DPMI interrupt works then this is trivial -- you don't bother
installing your own ISR.

There should be no 'case' logic required at run time.

Regards

Dave


 * KWQ/2 1.2i * My strength is as the strength of ten because my code is pure.

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1
@PATH: 440/4 141/209 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.