Newsgroups: comp.os.msdos.djgpp From: "Dennis Moran" Subject: Re: DJGPP and ASM Message-ID: <01bc314e$f71fd580$5c0520ce@technodrome> Date: Sat, 15 Mar 1997 14:50:17 GMT References: <5f9kld$i1d AT boursy DOT news DOT erols DOT com> <331a4b7c DOT 883291 AT news DOT erols DOT com> Lines: 49 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp enigma wrote in article <331a4b7c DOT 883291 AT news DOT erols DOT com>... > On Sat, 01 Mar 1997 19:11:45 GMT, donjr AT erols DOT com (No One Important) > wrote: > > >Is it possible to use in-line assembly language with DJGPP v. 2.0? > >If it is, can somebody show me the proper method for it? > >I seem to be screwing it up a lot. > > > >David Loose > >donjr AT erols DOT com > > > > i'm not going to explain it to you here.. (mostly because i'm no > expert) but yes, inline assembly is in djgpp (very easily for that > matter). you use a function called asm(). djgpp shoves any assembly > (at&t asm sytax) direct to gas (gnu assembler). > > a quick example is: > > asm ( "movl %eax, %ecx\n" > "movw %ax, %bx"); > > what this does is move a 32-bit integer from eax to ecx and then a > 16-bit integer from ax to bx. if you understand at&t syntax, that > should be obvious. the only thing that should be new is the '\n' > you must provide a linefeed at the end of an inline asm statement, so > the asm compiler gets it properly formated. a little anoying, but its > not that bad. there are many faqs on at&t sytanx and and djgpp inline > assembly that can help you with more complex stuff like input and > output fields and more importantly "memory clean up." REMEMBER, the > assembler assumes nothing. if you took my example and you didn't > intend to modify those registers globally, then you should have put > them on the stack and pop'd them when you were done. > > i hope other peeps will reply, cause i'm kinda dumb =) > > mint > enigma AT erols DOT com > > > Will it compile .asm files too? -- Dennis Moran (aka Coolio) coolio AT coolio9 DOT com http://coolio9.com/