🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1177

Re: file positioning with buffered/unbuffered I/O

#1177
From: a.lawrence
Date: Tue, 01 Sep 1992 08:41
48 lines
2984 bytes
In <1992Aug31.150850.2188@brandonu.ca> dueck@brandonu.ca writes:

>In article <1992Aug25.153322.13793@jhunix.hcf.jhu.edu>, gregg_c@jhunix.hcf.jhu.edu (Christopher H Gregg) writes:
>> Hi, I am writing an assembly language program and I am having some
>> problems with it.  The program is memory resident and it traps int 1Ch.
>> After it traps the interrupt, it checks if a certain amount of time
>> has passed and then it deletes a certain file on a directory.  The
>> problem is that when I try to use either DOS function 13h (delete file)
>> or DOS function 41h (which I would prefer), the program crashes.
>> 
>You have become stuck on one of the worst problems in DOS: its not
>re-entrant. However, you can tell when its safe to call DOS by checking
>the DOS-safe flag. This is a one-byte value located one byte past the 
>address returned in DS:SI by interrupt 21 function 5D06 and it is zero
>when it is safe to call DOS. Unfortunately the flag lies: It is safe to call
>DOS if DOS is busy with a call <= 0x0C, mostly standard input and output
>calls. However, when DOS is in a keyboard-polling loop, it invokes
>interrupt 28, the DOS-idle interrupt.

>Your program should acquire its data via int 1C and write it out from a
>routine called via int 28.

>This solution will break if you have hot-keyed back into a TSR, thereby
>activating via int 28. The TSR can't use int 21 subfunction <= 0C, and
>int 28 can't be re-entered. Does anyone know the solution to this problem?

Yes.  But its very long to publish here.  It would recommend the following
readings:

     Strategies and Techniques for Writing State-of-the-Art TSR's, 
     Douglas Boling, Microsoft Systems Journal, Vol 7 No 1, Jan-Feb 92.

     The MS-DOS Encyclopedia, Ray Ducan etal., Microsoft Press, 1988.

     The Waite Group's MS-DOS Developer's Guide, 2nd Ed., Howard W.
     Sams & Co., 1989

TSR programming is no longer the dark secret is once was, but there 
are a lot of considerations.  Basic TSR's need to trap at least 3 or
4 different interrupts, and further complications are created for
a TSR running in a Windows environment.


-- 
On a clear disk you can seek forever.
-------------------------------------------------------------------------
Andrew Lawrence, Informaticien Conseil           |  alawrenc@sobeco.com
3605 St-Urbain, #1605                            |  uunet!sobeco!alawrenc
Technical Details
Message-ID: <1992Sep1.084113.18678@sobeco.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!sobeco!alawrenc
References: <1992Aug8.111834.19417@klaava.Helsinki.FI> <1992Aug10.205740.4357@irscscm.UUCP> <1992Aug25.153322.13793@jhunix.hcf.jhu.edu> <1992Aug31.150850.2188@brandonu.ca>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!sobeco!alawrenc
From: alawrenc@sobeco.com (a.lawrence)
Subject: Re: file positioning with buffered/unbuffered I/O
Reply-To: alawrenc@sobeco.com
Organization: Lawrence & Assc.
Date: Tue, 1 Sep 92 08:41:13 GMT
Message-ID: <1992Sep1.084113.18678@sobeco.com>
References: <1992Aug8.111834.19417@klaava.Helsinki.FI> <1992Aug10.205740.4357@irscscm.UUCP> <1992Aug25.153322.13793@jhunix.hcf.jhu.edu> <1992Aug31.150850.2188@brandonu.ca>
Lines: 48