[comp.sys.ibm.pc] Undocumented 34h Call

markd@wolf.UUCP (Mark Divecchio) (11/15/87)

The latest chapter in the saga of how to write TSR programs was played
out on page 77 of the September 1987 Microsoft Systems Journal.

In the Ask Dr. Bob column, he gives us some hints on how to use the
critical section flag returned by int 21h function 34h. He says
the what you do with it depends on the version of DOS which you are
running. Specifically : "Depending on the DOS version, you should
check the byte after (DOS 2.1), before (DOS 3.0 and 3.1, if not
Compaq-DOS), or 01AAH bytes before (Compaq-DOS 3.0). You should
check to make sure that you're not in the middle of a BIOS interrupt
13h (Disk I/O) or 16h (Keyboard Service Request)."

My first problem is the first sentence of the quote. It is so poorly
phrased that I can't figure it out. The second problem is how one
tells if we in the middle of a 13h or 16h interrupt.

I have a program called LPTx which tries to redirect the output
destined for the printer to a disk file. I use the 34h flag but I
always checked the byte which the flag pointed to, not one before or
after.

Has anyone figured this one out?

-- 
---------------------------------
Mark C. DiVecchio 10435 Mountain Glen Terrace, San Diego, CA 92131
K3FWT			Home of PC-VT and LPTx		619-549-4056
sdcsvax!man!wolf!markd                   Bulletin Board 619-549-3927

simrin@mis.ucsf.edu (Steve Simrin) (11/16/87)

The address returned by function 34h is the indos flag address. this flag
is clear when DOS is waiting for keyboard input, for example when the DOS
prompt is displayed.

The flag referred to in your posting is the critical error flag. This
flag is set when a critical error (hardware error) occurs.

The simplest way to make sure the disk and keyboard are not busy is to
trap interrupts 16h and 13h with a handler which sets a flag, calls the
old handler, and clears the flag on return. The new handler simply
"irets" if the flag has previously been set.

There are example TSRs in PC magazine which demonstate these and other
techniques used in writing well behaved programs.

ralf@B.GP.CS.CMU.EDU (Ralf Brown) (11/18/87)

In article <558@wolf.UUCP> markd@wolf.UUCP (Mark Divecchio) writes:
}[...] "Depending on the DOS version, you should
}check the byte after (DOS 2.1), before (DOS 3.0 and 3.1, if not
}Compaq-DOS), or 01AAH bytes before (Compaq-DOS 3.0). You should
}check to make sure that you're not in the middle of a BIOS interrupt
}13h (Disk I/O) or 16h (Keyboard Service Request)."
}---------------------------------
}Mark C. DiVecchio 10435 Mountain Glen Terrace, San Diego, CA 92131
}sdcsvax!man!wolf!markd                   Bulletin Board 619-549-3927

The first sentence quoted above refers to a second byte that you should
check *in addition* to the byte pointed to by the address returned by the
INT 21/AH=34h function call.

The only way to check whether you're in the middle of an INT 13h or INT 16h is
to hook yourself into these interrupts.  Your routine needs to set a flag, 
call the original interrupt handler, reset the flag, and return.



-- 
{harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school) 
ARPA: RALF@B.GP.CS.CMU.EDU |"Tolerance means excusing the mistakes others make.
FIDO: Ralf Brown at 129/31 | Tact means not noticing them." --Arthur Schnitzler
BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA -=-=- DISCLAIMER? I claimed something?