Search code examples
pointersassemblymsp430

Assigning a Label to a Fixed Memory Location in MSP430 Assembly


I have been trying but could not figure out how to assign a label to a fixed memory location in assembly programming of MSP430. I want to create two pointers (e.g., xPtr and yPtr) which point to fixed memory locations in MSP430 address space. Then using the absolute mode, I want to perform instructions (e.g., Mov.b &xPtr, &yPtr).


Solution

  • As shown in sections 4.8.4 and 5.10 of the MSP430 assembler manual (SLAU131), you can use the .set or .equ directives to assign a value to a symbol:

    xPtr    .set 1234h
    yPtr    .set 5678h
    
            MOV.B &xPtr, &yPtr