From: michael DOT mauch AT gmx DOT de (Michael Mauch) Newsgroups: comp.os.msdos.djgpp Subject: Re: Turbo Assembler & DJGPP Date: Fri, 12 Jun 1998 13:07:39 +0200 Organization: Gerhard-Mercator-Universitaet -GH- Duisburg Lines: 50 Message-ID: <6lr25e$5ou$1@news-hrz.uni-duisburg.de> References: <199806111933510940 DOT 00184D6B AT pogwizd DOT tcs DOT uni DOT wroc DOT pl> NNTP-Posting-Host: ppp158.uni-duisburg.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Thu, 11 Jun 1998 19:33:51 +0200, "Pawel Kowalski" wrote: > What do I have to do to run an assembler procedure from C? > I compile assembler code to borland .obj file, then convert > it into .o, link it with main program's .o file and it works, > but _sometimes_ there are some bugs. For example a black > horizontal line appeares on the screen (in a triangle draw > procedure), but _only_ sometimes (ie I run the program - the > bug is visible, I run the program for the second time - there's > no bug) Is it possible that this horizontal line is an error message printed out with fprintf(stderr,...)? If you are in a graphics mode with no text mode support by your VGA BIOS, you could get such a "line" - it's not a true line, but only an intermittent line. > Maybe I forget to allocate some memory for stack or something... Yes, that's another possibility, but we can't judge this by what you said. Maybe you can post a code snippet, if it is not too long? Do you perhaps use some uninitialized variables? Try to initialize all variables and see if the error happens all the time or never then. Or do you garble some of the registers in your assembler code? In an old article, Bill Currie said: | %ebx, %esi, %edi, %ebp, %es, %ds and %ss (%cs is pretty obvious:) %eax, | %edx and %ecx are all free for your use (however, %eax is used for | return values (so is %edx, but only for 8 byte values)). %fs and %gs are | also free, however, libc uses %gs internally and never touches %fs. Eli Zaretskii said: | Several functions in DJGPP's library use GS. FS is not used by the | library, but if you call the so-called farptr functions, they use the | FS register. Maybe you can check and see if you touch some of these registers sometimes. > PS. Sorry for my english. There's no problem with your english, it's clearly understandable - and we aren't poets here, are we? Regards... Michael