Hi All,
I have an interesting query on the MSP430 constant generators. So the registers R2 and R3 can be used as constant generators if used in a particular addressing mode and the assembler/compiler automatically replaces the source operand with the constant generator register. Lets say I'm writing an assembly code and I encounter this:
MOV #0x25,R3 ;Move the immediate value 0x25 to register R3 MOV 0(R3),0(R5) ;Move the contents pointed by (0+R3) to address (0+R5). Basically moves 0x25 to R5.
So I'm pushing 0x25 to R3 and then using R3 in indexed mode to transfer this value to R5. So the question is, will R3 be used as a constant generator and will generate the constant 01h(01h if R3 used in indexed mode) which will mess up the operation(move contents pointed by 0+1h to R5)! Or is the assembler/compiler clever enough and will not use R3 as a constant generator.
I know this is not a recommended coding but just curious to know what happens if a programmer encounters this situation. While writing assembly code, we use the CPU registers extensively and what happens if I use R2 and R3 in an addressing mode which would result a constant generator.
Regards,
Sud
