Review: memory addresses are binary numbers !
The ARM processor
has a
32 bits
address bus:
Therefore: a
memory address in an
ARM assembler program
requires
32 bits to
represent !!!
Accessing
variables stored in
memory
-
Memory variables
are
accessed through their
memory location (= address)
-
Recall:
-
Labels are used to
mark
important
memory addresses in
an assembler program
(e.g.: a
variable)
- A
label is
a
symbolic constant
for some memory address !!
|
- Example:
a: .byte 15 // a = a symbolic constant for this memory address
|
|
Moving
memory addresses
(or variables) into
a register in ARM
-
Memory variables
are
accessed through their
memory location (= address)
-
Recall:
-
Labels are used to
mark
important
memory addresses in
an assembler program
(e.g.: a
variable)
- A
label is
a
symbolic constant
for some memory address !!
|
- How to
obtain the
address of
a memory variable:
movw rN, #:lower16:memoryAddressOfVar // The address
movt rN, #:upper16:memoryAddressOfVar // is a number
|
- We can use
the
label
(= symbolic constant for the
address) instead:
movw rN, #:lower16:labelForVariable // We would rather use
movt rN, #:upper16:labelForVariable // its symbolic name !
|
|
Example: moving
memory addresses
(or variables) into
a register in ARM
- Example of
variable:
- Instructions to
move (= put)
the address
of variable
a
(a
binary number !)
into the register
r0:
.text
movw r0, #:lower16:a
movt r0, #:upper16:a
|
|
DEMO:
/home/cs255001/demo/asm/2-mov/mov-address.s
❮
❯