A
A
Andrey Andryushchenko2017-05-28 00:20:41
ARM
Andrey Andryushchenko, 2017-05-28 00:20:41

How to work with variables and constants in ARM assembler?

Let's say I declared a constant in the .data section:

vara:
.int 3

How can I work with its value? Can it be changed? How to use as an operand? And in general, how to work with variables and constants in ARM assembler?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Andryushchenko, 2017-05-28
@delphikettle

thinkingeek.com/2013/01/11/arm-assembler-raspberry...
here are the macros for loading the value of a variable into a register and unloading it into a variable:

.macro loadvar r var
    ldr \r, =\var
    ldr \r, [\r]
.endm

.macro storevar r var
    ldr r0, =\var
    str \r, [r0]
.endm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question