Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!orsvax1!pyrnj!caip!lll-crg!lll-lcc!unisoft!mtxinu!ed From: ed@mtxinu.UUCP (Ed Gould) Newsgroups: net.micro.68k Subject: Re: asm construct in Alcyon-C and others Message-ID: <581@mtxinu.UUCP> Date: Sat, 19-Apr-86 17:11:00 EST Article-I.D.: mtxinu.581 Posted: Sat Apr 19 17:11:00 1986 Date-Received: Mon, 21-Apr-86 07:46:56 EST References: <293@Shasta.ARPA> Reply-To: ed@mtxinu.UUCP (Ed Gould) Organization: mt Xinu, Berkeley, CA Lines: 39 >Alcyon-C, and compilers derived from the 'Portable' C compiler (at least) >allow direct insertion of assembly statements into the compiled code. >the syntax is: > asm( " any string to put into .s file "); > >The double quotes are mandatory, and the entire statement must appear on >a single line. This is processed during pass 1 of the compiler. Any >linkages to variables, etc., must be in conformance with the code >generated by your compiler (look at a .s file for examples). All true. Note, however, that there is a bug in the 4.2BSD compiler, and possibly other PCC derivatives as well. I don't remember the nature of the bug in any detail, but the workaround is to place a null statement (extra semicolon) before the asm(): ;asm("whatever"); Of course, if this is to be included in an if (or other similar construct), braces *must* be used: if(condition) ;asm("xxx"); just won't do it! if(condition) { ;asm("xxx"); } is required. (It may be the case that the bug doesn't manifest itself after ifs. I just don't remember where it matters.) -- Ed Gould mt Xinu, 2910 Seventh St., Berkeley, CA 94710 USA {ucbvax,decvax}!mtxinu!ed +1 415 644 0146 "A man of quality is not threatened by a woman of equality."