Hi. I have the following line in my code
asm
{
...
move.l i(a0), value;
...
}
where "i" is defined as short. When making the project I get the following error:
Error: ',' expected
move.l i(a0), value; (the symbol "(" is underlined)...
Where is the problem?
Regards,
Marco.
That kind of addressing is not allowed in CW, note i should be inside a register, then cannot use indirect with displacement mode
Try to look for more info about "Address Register Indirect with Scaled Index and 8-Bit Displacement
Mode" as a workaround or use the move in a different way
If I understand correctly your intention, you want to load the constant to address
"content of register a0 plus content of index register i" .
Below are some clarifications to Paolo Renzo answer.
1. The source must be listed first. The destination must be listed second.
2. The document "ColdFire Family Programmer's Reference Manual" mentions for MOVE instruction, that, for the addressing mode of the source is the constant #xxx, destination mode of index (d8,Ax,Xi) is impossible.
3. You need to split the intended operation into two instructions, using one more register to store the related temporary value.
4. The following two workarounds are compiled with GNU compiler. The constant here is #800, and the index register is %a1.
The first workaround uses additional register %d0 to store temporarily the value of the source constant.
move.l #800, %d0
move.l %d0, (0,%a0,%a1.l*1)
The second workaround uses additional register %a2 to store temporarily the effective destination address after the indexing.
lea.l (0,%a0,%a1.l*1), %a2
move.l #800, (%a2)