This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
With the code
mov #1234h, &0x2000 mov #5678h, &0x2002 addx.a #11111h, &0x2000
0x11111 will be added to the lower 20 bits and the upper 12 bits of the 32 bit value at 0x2000 will be cleared.
Is this documented somewhere and can I rely on the fact that the upper 12 bits will always be
cleared when working on a .a destination in memory? With other words, if I want to clear 4
bytes in memory (on an even address, of course) can I assume that
clrx.a &dest
will work reliably?
zrno soli said:Higher unused bits in memory will be always cleared to zero.
OK, very good, thanks! Is this documented somewhere or just an observation?
BTW, clrx.a &dest is emulated by movx.a #0, &dest, but there are also 20-bit so called address instructions that can be executed in less cycles and take less memory. adda R4, R5 and suba R4, R5 will take one word in memory and will be executed in one cycle (same as with 16-bit instructions), addx.a and subx.a not.
Right, and I have already verified that
mova R3, &dest
really clears all 32 bits starting at &dest, but I am unsure if I can rely on that since the constant
generation function is based on the As part of the instruction which doesn't exist in the op-code of
mova at all. So it is possible that it just works by coincidence since As must be 00 for generating
constant zero and since there is no As at all, it is assumed to be 00...
It is possible that is documented somewhere, but I didn't found it.
For clearing variables, double word, group of words or bytes I am using...
mov.w #0, R15
mova R15, &dest1
mova R15, &dest2
...
zrno soli said:It is possible that is documented somewhere, but I didn't found it.
I think I have:
Now the last thing that puzzles me is if "mova R3 &dest" is safe to use for clearing word-aligned 32 Bit of memory.
But probably only s.o. from TI who knows how constant generation by R3 in absense of As works can answer this...
**Attention** This is a public forum