kaufman@Shasta.ARPA (Marc Kaufman) (04/18/86)
(This was intended for mod.computers.68k, but I cant find the name of the moderator, and my system wont let me post to mod. groups directly) >(someone at University of Louisville writes..) > >Looking around the c068.68k program (step two in the compilation process), >I discovered reference to the asm keyword. I wonder if anyone has discovered >whether there is a correct syntax for an assembly statement using this keyword. >Or have I misunderstood entirely? If anyone has come across this asm keyword >and knows how to use it, please let me know. 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). Marc Kaufman (kaufman@SU-Shasta) .. another blow for machine independent code!
ed@mtxinu.UUCP (Ed Gould) (04/20/86)
>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."