[comp.os.msdos.programmer] Word for Windows and DOS idle interrupt

oeschi@netmbx.UUCP (Johann Deutinger) (12/11/90)

I am developing a TSR using Tesseract (which seems to be a very useful product)
to do some background processing from time to time. It even works well together
with Windows 3.0 with one exception: when I use Word for Windows no DOS idle
interrupts (INT28) occur. Tesseract needs them to poll my TSR for background
processing. Other Windows applications (Write, Pagemaker, CorelDraw ...) don't
cause this problem. Any help for me?

Johann


-- 
oeschi@netmbx.UUCP     | Johann Deutinger
voice +49 30 396 50 21 | Ferrari electronic GmbH (.. no, we don't sell cars)
fax   +49 30 396 80 20 | Beusselstr. 27  -  1000 Berlin 21  -  FRG

hd7x@vax5.cit.cornell.edu (Sanjay Aiyagari) (12/14/90)

In article <1522@netmbx.UUCP>, oeschi@netmbx.UUCP (Johann Deutinger) writes:
> I am developing a TSR using Tesseract (which seems to be a very useful
> product) to do some background processing from time to time. It even works
> well together with Windows 3.0 with one exception: when I use Word for
> Windows no DOS idle interrupts (INT28) occur. Tesseract needs them to poll
> my TSR for background processing. Other Windows applications (Write,
> Pagemaker, CorelDraw ...) don't cause this problem. Any help for me?

Isn't it only necessary to check for INT 28's only if the DOS busy flag is set?

sonny@charybdis.harris-atd.com (Bob Davis) (12/16/90)

In article <1990Dec13.220804.1611@vax5.cit.cornell.edu> hd7x@vax5.cit.cornell.edu (Sanjay Aiyagari) writes:
>In article <1522@netmbx.UUCP>, oeschi@netmbx.UUCP (Johann Deutinger) writes:
>> I am developing a TSR using Tesseract (which seems to be a very useful
>> product) to do some background processing from time to time. It even works
>> well together with Windows 3.0 with one exception: when I use Word for
>> Windows no DOS idle interrupts (INT28) occur. Tesseract needs them to poll
>> my TSR for background processing. Other Windows applications (Write,
>> Pagemaker, CorelDraw ...) don't cause this problem. Any help for me?
>
>Isn't it only necessary to check for INT 28's only if the DOS busy flag is set?
--------------------------------------------

If the DOS busy flag (sometimes called the InDOS flag) is set, sometimes it
is only set because DOS awaits keyboard input (i.e., DOS is at command prompt).
Since this is a relatively benign condition as far as DOS reentrancy is
concerned, one can call DOS functions ABOVE 09h without reentering critical
DOS code IF ALL WE ARE DOING IS AWAITING KEYBOARD INPUT. My understanding
is that INT28 (DOS Idle Interrupt) occurs when the InDOS flag (DOS busy flag)
is set BUT the only reason DOS is "busy" is because I/O is awaited.  Some
software that never allows an ordinary DOS command level prompt may NEVER 
permit an INT28 to occur. (Maybe Word for Windows is one of these?)
	But, perhaps, with such software the InDOS busy flag will indicate
that DOS is NOT busy and therefore one need not even check for an interrupt
28h to know that DOS can safely be re-entered.
	From my reading on the subject, I have concluded that DOS can 
safely be re-entered with ANY Int21h DOS function if the InDOS flag indicates 
DOS not busy. If you know this not to be universally true, please tell me.
	Also, I have concluded that, even though InDOS flag might indicate
DOS busy, if Int28h (DOS idle interrupt) occurs, I can safely call Int21h
functions above 09h. If you know of exceptions to this, please tell me.
	My conclusions on these TSR matters are incorporated into my
evolving software, "T-BONES", a set of skeletal ASM programs into which
the TSR designer can drop code to be executed when the TSR trigger (HotKey
or Hooked Interrupt) occurs.

	I would be pleased to send you TBONES05.ZIP in uuencoded form
for your evaluation and comment by E-mail request.


_____________________________________________________________________________
Bob Davis, UofALA alum \\ INTERNET: sonny@trantor.harris-atd.com  |  _   _  |
Harris Corporation, ESS \\    UUCP: ...!uunet!x102a!trantor!sonny |_| |_| | |
Advanced Technology Dept.\\ AETHER: K4VNO          |==============|_/\/\/\|_|
PO Box 37, MS 3A/1912     \\ VOICE: (407) 727-5886 | I SPEAK ONLY | |_| |_| |
Melbourne, FL 32902        \\  FAX: (407) 729-2537 | FOR MYSELF.  |_________|

ralf@b.gp.cs.cmu.edu (Ralf Brown) (12/16/90)

In article <5094@trantor.harris-atd.com> sonny@trantor.harris-atd.com (Bob Davis) writes:
}	From my reading on the subject, I have concluded that DOS can 
}safely be re-entered with ANY Int21h DOS function if the InDOS flag indicates
}DOS not busy. If you know this not to be universally true, please tell me.
}	Also, I have concluded that, even though InDOS flag might indicate
}DOS busy, if Int28h (DOS idle interrupt) occurs, I can safely call Int21h
}functions above 09h. If you know of exceptions to this, please tell me.

First, it is functions above 0Ch that may safely be called during an INT 28.
Functions 01h to 0Ch use one stack, 00h and 0Dh up use a second stack, and
a third stack is used during a critical error (INT 24).  There is one 
additional case: functions 3Fh and 40h given a handle referring to CON must
be treated as though they were one of the functions from 01h to 0Ch.

It is not necessarily safe to reenter DOS when InDOS is zero, because InDOS
is set to zero during a critical error interrupt (at which time the critical
error flag is nonzero).  The DOS function dispatcher initially switches to
the stack used by during critical errors before determining which of the
other two stacks to use if the call was not from an INT 24 handler; thus,
you can't reenter DOS from other than the INT 24 handler while the critical
error flag is set.
-- 
{backbone}!cs.cmu.edu!ralf  ARPA: RALF@CS.CMU.EDU   FIDO: Ralf Brown 1:129/3.1
BITnet: RALF%CS.CMU.EDU@CMUCCVMA   AT&Tnet: (412)268-3053 (school)   FAX: ask
DISCLAIMER?  Did  | Everything is funny as long as it is happening to
I claim something?| someone else.  --Will Rogers

oeschi@netmbx.UUCP (Johann Deutinger) (12/16/90)

In article <5094@trantor.harris-atd.com>, sonny@charybdis.harris-atd.com (Bob Davis) writes:
> In article <1990Dec13.220804.1611@vax5.cit.cornell.edu> hd7x@vax5.cit.cornell.edu (Sanjay Aiyagari) writes:
> >In article <1522@netmbx.UUCP>, oeschi@netmbx.UUCP (Johann Deutinger) writes:
> >> I am developing a TSR using Tesseract (which seems to be a very useful
> >> product) to do some background processing from time to time. It even works
> >> well together with Windows 3.0 with one exception: when I use Word for
> >> Windows no DOS idle interrupts (INT28) occur. Tesseract needs them to poll
> >> my TSR for background processing. Other Windows applications (Write,
> >> Pagemaker, CorelDraw ...) don't cause this problem. Any help for me?
> >
> >Isn't it only necessary to check for INT 28's only if the DOS busy flag is set?
> --------------------------------------------
> 
> If the DOS busy flag (sometimes called the InDOS flag) is set, sometimes it
> is only set because DOS awaits keyboard input (i.e., DOS is at command prompt)
[lines deleted]
> 	But, perhaps, with such software the InDOS busy flag will indicate
> that DOS is NOT busy and therefore one need not even check for an interrupt
> 28h to know that DOS can safely be re-entered.
> 	From my reading on the subject, I have concluded that DOS can 
> safely be re-entered with ANY Int21h DOS function if the InDOS flag indicates 
> DOS not busy. If you know this not to be universally true, please tell me.

[lines deleted...]

There seems to be a minor misunderstanding: my background software (which
is actually used to talk to our intelligent fax card) relies on being
activated through the INT28 hook of TeSseRact, i.e. when DOS waits for
keyboard input or in other I/O busy situation, it does an INT28. This
in turn gives me the chance to do some background processing. If no INT28
occurs (as in Word for Windows) I don't become called from anywhere. All
other Windows application I have don't cause that. TeSseRact additionally
calls INT28 on BIOS keyboard wait, this does not help in Windows which
does not use the BIOS for keyboard I/O. In WfW, as soon as I pull down
one of the menus, INT28 calls do occur, they don't show up as long as I
am in the editing Window. A solution for that is very important to me
because otherwise I could not send or receive faxes during WfW editing.

Johann


-- 
oeschi@netmbx.UUCP     | Johann Deutinger
voice +49 30 396 50 21 | Ferrari electronic GmbH (.. no, we don't sell cars)
fax   +49 30 396 80 20 | Beusselstr. 27  -  1000 Berlin 21  -  FRG

sonny@charybdis.harris-atd.com (Bob Davis) (12/16/90)

In article <1537@netmbx.UUCP> oeschi@netmbx.UUCP (Johann Deutinger) writes:
	[DELETIONS]
>
>There seems to be a minor misunderstanding: my background software (which
>is actually used to talk to our intelligent fax card) relies on being
>activated through the INT28 hook of TeSseRact, i.e. when DOS waits for
>keyboard input or in other I/O busy situation, it does an INT28. This
>in turn gives me the chance to do some background processing. If no INT28
>occurs (as in Word for Windows) I don't become called from anywhere. All
>other Windows application I have don't cause that. TeSseRact additionally
>calls INT28 on BIOS keyboard wait, this does not help in Windows which
>does not use the BIOS for keyboard I/O. In WfW, as soon as I pull down
>one of the menus, INT28 calls do occur, they don't show up as long as I
>am in the editing Window. A solution for that is very important to me
>because otherwise I could not send or receive faxes during WfW editing.
>
>Johann
>
	But doesn't this say that hooking ONLY INT28 is inadequate for
proper functioning (with Word for Windows) of the TSR you are developing?
	Doesn't this say that you MUST hook some OTHER interrupt that DOES
occur when editing in Word for Windows? Perhaps you also need to hook the
Timer Tick Interrupt 08 (or, better, INT 1Ch). These interrupts occur
18.2 times per second and you might be able to substitute your own
handler for providing your "background" FAX task. Care must be employed
when hooking the timer interrupt to avoid interference with time-sensitive
tasks.
_____________________________________________________________________________
Bob Davis, UofALA alum \\ INTERNET: sonny@trantor.harris-atd.com  |  _   _  |
Harris Corporation, ESS \\    UUCP: ...!uunet!x102a!trantor!sonny |_| |_| | |
Advanced Technology Dept.\\ AETHER: K4VNO          |==============|_/\/\/\|_|
PO Box 37, MS 3A/1912     \\ VOICE: (407) 727-5886 | I SPEAK ONLY | |_| |_| |
Melbourne, FL 32902        \\  FAX: (407) 729-2537 | FOR MYSELF.  |_________|

zarnuk@caen.engin.umich.edu (Paul Steven Mccarthy) (12/19/90)

In article <1537@netmbx.UUCP> oeschi@netmbx.UUCP (Johann Deutinger) writes:

> ... If no INT28
>occurs (as in Word for Windows) I don't become called from anywhere. All
>other Windows application I have don't cause that. TeSseRact additionally
>calls INT28 on BIOS keyboard wait, this does not help in Windows which
>does not use the BIOS for keyboard I/O. In WfW, as soon as I pull down
>one of the menus, INT28 calls do occur, they don't show up as long as I
>am in the editing Window. A solution for that is very important to me
>because otherwise I could not send or receive faxes during WfW editing.

WfW must be checking for keyboard input someway (probably hooked directly
into the keyboard interrupt 09h).  You should hook into the timer interrupt,
08h.  You will have to be extra careful about DOS re-entrancy, though.  
You may want to hook into the DOS 21h interrupt just to keep track of
which DOS functions are currently active. 

(The _least_ "well-behaved" code is usually excreted by Micro$oft!)

--- Paul...