[comp.os.msdos.programmer] Serial line TSR - help needed please?

alen@crash.cts.com (Alen Shapiro) (12/25/90)

A friend of mine is having REAL trouble writing a TSR that reads a serial
port (at interrupt time) and stores chars in memory until a NL is read,
when it dumps the line to a file. The data rate is 300 baud max and
max 80 char lines are received no more than once every 3 mins.

He is desperate but I know nothing about serious DOS programming!!
The application he is writing is non-commercial, he will make no
money from it (nor will anyone else).

Has anyone out there got a snippet of program that he can "borrow".

(he wants to run this TSR so as not to affect "normal" DOS functions
like word processing etc).

TIA (much)
--alen the Lisa Slayer (trying to turn a SPARC into a flame)
  alen%shappy.uucp@crash.cts.com (a mac+ uucp host - what a concept!!)
  alen@crash.cts.com

frank@cavebbs.gen.nz (Frank van der Hulst) (12/25/90)

In article <6517@crash.cts.com> alen@crash.cts.com (Alen Shapiro) writes:
>A friend of mine is having REAL trouble writing a TSR that reads a serial
>port (at interrupt time) and stores chars in memory until a NL is read,
>when it dumps the line to a file. The data rate is 300 baud max and
>max 80 char lines are received no more than once every 3 mins.

His major problem is how to write stuff to the disk -- DOS is *NOT* reentrant
so he shouldn't write to the disk if some other application is currently
calling DOS. There are several ways round this: catch all calls to DOS, setting
a flag on entry and exit, or else latch onto the DOS idle interrupt (INT 28h,
I think) which is called by DOS when its OK to call DOS.




>

>


>

gwaigh@micor.OCUnix.On.Ca (Geoffrey Waigh) (12/30/90)

This may not apply to you, but if you try writing to disk with a DOS call
(which is the easy way to access the file system) in the background, it will
not behave.  DOS is extremely non-rentrant (sp?) and does not like people 
trying to do two things at once.  You will have to do something to be sure
that DOS is not doing it's thing when you want to flush your buffer.  I would
guess that grabbing INT 21 (ugh :-() may help but some Guru here may know a
better kludge.

gwaigh@micor.ocunix.on.ca | People wanting disclaimers here don't deserve
                          | to see that which is obvious.

sonny@charybdis.harris-atd.com (Bob Davis) (01/01/91)

In article <1990Dec30.041551.4685@micor.OCUnix.On.Ca> gwaigh@micor.OCUnix.On.Ca (Geoffrey Waigh) writes:
>This may not apply to you, but if you try writing to disk with a DOS call
>(which is the easy way to access the file system) in the background, it will
>not behave.  DOS is extremely non-rentrant (sp?) and does not like people 
>trying to do two things at once.  You will have to do something to be sure
>that DOS is not doing it's thing when you want to flush your buffer.  I would
>guess that grabbing INT 21 (ugh :-() may help but some Guru here may know a
>better kludge.
>
	No guru here, but I would suggest reading the sections on the InDOS
flag and the Critical Error flag, as well as on the "DOS Idle" interrupt,
Int28h, in a good DOS programmer's reference. I like:

	DOS Programmer's Reference, 2nd Edition
	by Terry Dettmann (w/ 2nd Ed. revisions by Jim Kyle)
	Published by QUE (C) 1989
	ISBN:0-88022-458-4

The recommended topics will help you stay out of DOS's way as far as
re-entrancy is concerned (no mean feat!).

_____________________________________________________________________________
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.  |_________|