Assembler syntax question

Discussion to talk about software related topics only.
Post Reply
fd9750
Posts: 40
Joined: Fri Mar 29, 2013 8:08 am
Location: Belgium

Assembler syntax question

Post by fd9750 »

Hi,

I am looking into writing a pure assembly interrupt service routine.
To do that I have been looking at the "Coldfire Family Programmer's reference Manual, Rev.3" and the Netburner document "Coldfire_assembly_language.pdf".

There is one snag there: the assembler syntax mentioned in it does not match the assembler syntax used in the NBEclipse environment.

Example: to store register a0 on the stack would, according to the reference manual, be:

Code: Select all

move.l	a0,(a7)+


in NBEclipse the syntax is:

Code: Select all

move.l	%A0,%a7@+
Is there a list somewhere which shows how one type of syntax translates to the other ?

In particular I now that to push A0 on the stack it takes:

Code: Select all

move.l	a0,(a7)-
(move from a0 to location a7 and post-decrement a7)
Pulling it from the stack takes:

Code: Select all

move.l	+(a7), a0

(pre-increment a7 and move from location a7 to a0).

i can't find an example or description of the correct syntax to do the latter one in NBeclipse.
I have tried the line below and a lot of other variants but they don't compile.

Code: Select all

move.l	%a7+@


Surely there must be something somewhere ?
fd9750
Posts: 40
Joined: Fri Mar 29, 2013 8:08 am
Location: Belgium

Re: Assembler syntax question

Post by fd9750 »

Never Mind, I have been looking for it for hours and did not find anything but just after posting this I did find it.

http://sourceware.org/binutils/docs/as/ ... 002dSyntax

It is a link to the GNU manual that lists the specifics for 68000 processors so it also works well for ColdFire processors.

Just wish I'd have found it sooner but maybe this way somebody else will have a use for the info. :)
User avatar
pbreed
Posts: 1091
Joined: Thu Apr 24, 2008 3:58 pm

Re: Assembler syntax question

Post by pbreed »

I've been known to write the code in C, disassemble it and look at the assembly syntax in the disassembled code...


m68k-elf-objdump - S -D yourproject.elf > yourpoject.lst



for the real hard core cases...


asm('.int 0x4e714e71");
asm(" .int 0x4eb94000");
asm(" .word 0x0654 ");
asm(" .word 0x4e71");


Where the number is the hex for an assembly instruction I can't figure out the syntax for...
Then disassemble the result and see how the compiler wants to see the instruction....
Some of the odd emac instructions are not well documented....

Paul
ecasey
Posts: 164
Joined: Sat Mar 26, 2011 9:34 pm

Re: Assembler syntax question

Post by ecasey »

You can also look at it in the Eclipse Debug disassembly window. I've never tried it, but a copy and paste from there, followed by some manupulation to optimize, should work.
Post Reply