pa*********@yahoo.com (par_c) wrote in message news:<ef*************************@posting.google.c om>...
Hi all,
I have a source code in c that uses some assembly for the motorola
m68360 chip.
Here is the part I dont understand:
#define OR_REG32(reg,val) __asm__("or.l %0,%1" : : "n" (val), "o"
(reg))
1) I dont understand the semicolon with a space between them syntax,
it look likes scope resolution but it isn't (I think). I also dont
understand the %0 and %1 syntax, haven't seen them before.
2) Anyone know how to implement this in the code without using the
#define? Does anyone have experience with this type (using asm mixed
with c code) of programming that could guide me?
Thanx in advance.
Hi!
Its impossible to say anything definite without refering
to the manual for the compiler that this code was first
written for. So my first advice is to find out what compiler
the code was intended for and then ask your question in a
more appropriate group. If that is not possible try looking
at how the macro is being used. That can tell you a lot.
My guess is that the purpose of the code is to bitwise OR a
specific register with a value (perhaps a special purpose
hardware register). This is not possible to do in C.
You should always try to avoid any inline assembly bacause it
confuses the optimizer.
//Erik