From: leathm AT solwarra DOT gbrmpa DOT gov DOT au (Leath Muller) Message-Id: <199703030535.PAA13380@solwarra.gbrmpa.gov.au> Subject: Re: DJGPP and ASM To: enigma AT erols DOT com (enigma) Date: Mon, 3 Mar 1997 15:35:08 +1000 (EST) Cc: djgpp AT delorie DOT com In-Reply-To: <331a4b7c.883291@news.erols.com> from "enigma" at Mar 3, 97 04:05:28 am Content-Type: text > 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. If you dont want to use the '\n', just use a ';'. Instead of: movl $10, %eax\n you could type asm volatile (" movl $10, %eax; movw %ax, %dx; etc etc etc... "); At least the semi-colon is more Cish in my opinion... :) Also, if you have a look at the DJGPP faq it will give you pointers to relevant pieces of information and articles to read, which show you varying methods of manipulating registers etc, and how to let gcc which registers to use. Personally, I push/pop and use lots of globals, but most people don't like my method... ;) Leathal.