A89: Difficulty inserting assembly into C code


[Prev][Next][Index][Thread]

A89: Difficulty inserting assembly into C code




TurboSoft@aol.com writes:
 > 
 > l'm having trouble getting the assembly code in this program to work.  As a 
 > test, l copied the idle_loop() source code, and am trying to have it 
 > assembled with my program.  When l compile the C program, l get about 3 
 > errors per line from the Assembler.  l know it has something to do with the 
 > stuff in the asm("   ") braces, or all of it.
 > [ snip ]

Do you use gcc ?
If yes, read on. If not, delete this mail.
  
Could you tell what gcc configuation do you use ?

Chances are, that:

- ; is not a comment spearator, use | instead
- register names must be prepended by a %

If you use gcc, then you'll need quite some typing after the closing
", you *must* read the relevant info (or docs) in regards to gcc's 
inline assembly rules.

In addition, #define-s are *not* substituted in the assembly for
the whole assembly stuff is (from the preprocessor's point of view) is 
a big string, in which no macro expansion occurs. On the other hand,
the \ sequences might get extended, which you don't want.

By the way, if you use gcc, you don't have to save d0/d1/a0/a1 over
function calls.

In addition, I might be mistaken, but I doubt that gas understands the 
library::function construct.

In addition, gas uses the C notation for hex numbers and will not
recognise $ as a hexadecimal prefix.

Regards,

Zoltan


References: