Article View: comp.os.msdos.programmer
Article #7976Re: Need help in TSR (80x86 asm) calling C
From: Rainer Wenn
Date: Sun, 28 Apr 1996 00:00
Date: Sun, 28 Apr 1996 00:00
44 lines
2417 bytes
2417 bytes
myao@mailhost.ecn.uoknor.edu (Minghua Yao) writes: >I have a C module which uses "fopen()" to open a file. When called by a >C main(), the module works well and the file can be opened. >But if this module is called by a TSR code (which is loaded at an interrupt >not used by the DOS, and is executed by activating this interrupt), >the file which does exist cannot be opened often times. Sometimes >(seldom,though) the file can be opened. If so, the machine will die. >The behavior seems to be undefinte. >The working enviroment is DOS. I use 80x86 assembly for The TSR and >Borland C for the C module. The C module is resident part of the TSR. >Anybody's help will be greatly appreciated. High, there are possible two reasons. 1. InDOS-Flag Indeed it is important that there is no other action in DOS, because DOS is not reentrant. The way to check it out is already discribed. 2. The stack !! The C-module fopen() uses a very large buffer for reading the file. And this buffer will be allocated on the normal stack. If perhaps you have the DOS-stack activ, it will be the reason. If you use a stack that you have defined, perhaps it will be too small. I also used the fopen()-module and have had the same results you have now. The InDOS-flag did not help. I have changed all the fopen-calls to the low-level-routine open(). With the open()-module it runs fine and I did not need a too large stack for the buffer. Perhaps it helps Rainer -- ------------------------------------------------------------------------------ Rainer Wenn rainer@tpki.toppoint.de 24145 Kiel-Meimersdorf ------------------------------------------------------------------------------
Technical Details
Message-ID:
<4m0im1$t7l@picard.toppoint.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4ljfha$s8s@independence.ecn.uoknor.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10f6aa,c9a50b8babe96bc5 X-Google-Attributes: gid10f6aa,public X-Google-Thread: 10d683,c9a50b8babe96bc5 X-Google-Attributes: gid10d683,public X-Google-Thread: f7d8d,c9a50b8babe96bc5 X-Google-Attributes: gidf7d8d,public From: rainer@toppoint.de (Rainer Wenn) Subject: Re: Need help in TSR (80x86 asm) calling C Date: 1996/04/28 Message-ID: <4m0im1$t7l@picard.toppoint.de> X-Deja-AN: 151922502 distribution: inet references: <4ljfha$s8s@independence.ecn.uoknor.edu> organization: Toppoint Mailbox e.V. newsgroups: comp.os.msdos.programmer,alt.lang.asm,aus.computers.ibm-pc