X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Martin Str|mberg Subject: Re: Inline Assembly with DJGPP Newsgroups: comp.os.msdos.djgpp References: User-Agent: tin/1.4.4-20000803 ("Vet for the Insane") (UNIX) (NetBSD/1.5_BETA (alpha)) Message-ID: <1019950186.652734@queeg.ludd.luth.se> Cache-Post-Path: queeg.ludd.luth.se!unknown AT speedy DOT ludd DOT luth DOT se X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) Date: 27 Apr 2002 23:29:46 GMT Lines: 32 NNTP-Posting-Date: 27 Apr 2002 23:29:46 GMT NNTP-Posting-Host: queeg.ludd.luth.se X-Trace: 1019950186 news.luth.se 283 130.240.16.109 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Graham Warren wrote: : I have been attempting to use some inline assembly language in a plain C : program. The following code (taken straight from 'Brennan's Guide to Inline : Assembly'), will not compile as part of a program. : asm ("cld\n\t" : "rep\n\t" : "stosl" : : /* no output registers */ : : "c" (count), "a" (fill_value), "D" (dest) : : "%ecx", "%edi" ); : I get the following error messages: : "Error: Invalid asm statement" : "Error: fixed or forbidden register 2 (cx) was spilled for class CREG" : Can anyone explain what is wrong with my syntax or give me a hint to what : the problem is here? Try "... "rep\n\t" "stosl" : "c" (count), "D" (dest) : "0", "a" (fill_value), "1" : /* No clobbers. */ ); Very much untested! Right, MartinS