Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mtune!mtgzz!rosen From: rosen@mtgzz.UUCP (t.rosenfeld) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: Re: Inline assembler in Microsoft C ???? Message-ID: <2800@mtgzz.UUCP> Date: Mon, 29-Jun-87 13:38:04 EDT Article-I.D.: mtgzz.2800 Posted: Mon Jun 29 13:38:04 1987 Date-Received: Tue, 30-Jun-87 07:03:03 EDT References: <608@zen.UUCP> <2299@hoptoad.uucp> <2093@emory.UUCP> Organization: AT&T, Middletown NJ Lines: 41 Keywords: Inline assembler code Xref: mnetor comp.sys.ibm.pc:5171 comp.lang.c:2706 [Sorry for the multiple posting screw up.] In article <2093@emory.UUCP>, platt@emory.UUCP writes: > In article <2299@hoptoad.uucp> pozar@hoptoad.UUCP (Tim Pozar) writes: > >In article <608@zen.UUCP> vic@zen.UUCP (Victor Gavin) writes: > >> > >>Can anyone tell me if there is an "inline" assembler capability for this > >>compiler. > Having done a fair amount of C/Assembler interfacing (using MS C 4.0) > I can say that it's not too much of a burden to write the code, and > link the .obj modules in at link time. It also gives you more control > over how and where your data is treated and stored. > > Dan As Dan writes MS tells you how to interface to assembly routines, but you probably would rather have inline code than be forced to do a CALL to an assembly routine. As far as I know there is no #asm directive in 4.0 but I think I heard there will be in 5.0. One way to get around this is to compile your C code and have the compiler generate the assembly module. (I think this is the -Fs option.) Then enter your inline assembly at the correct loaction, assemble and link. Of course if you ever want to edit the C source again you hac=ve to do it all over again. This trick is also usefull to generate the corect compiler directives to link an assembly function to the rest of your C program. That is write a null C funtion (e.g. ass_fun(){}) and then compile with -Fs and then insert your assembly into the .asm file. WARNING: When using the MS C 3.0 version in large model mode I ran into a bug were the .asm file prodused by the -Fs option was wrong. Sometimes it would not link, or worse yet it would link but the segment registers would be wrong. I think I found the file was OK except it loaded SS with _DATA instead of DGROUP. -- Tom Rosenfeld @ AT&T Information Systems Labs, Middletown, NJ (201) 957-5867 UUCP: {harpo,ihnp4,burl,akgua}!mtgzz!rosen Disclaimer: I don't claim anything.