Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between .equ and .word in ARM Assembly?

I am curious - What is the difference between .equ and .word directives in ARM assembly, when defining constants?

like image 736
jhtong Avatar asked Feb 07 '14 09:02

jhtong


People also ask

What does .EQU mean in assembly?

* EQU - The equate directive is used to substitute values for symbols or labels. The format is 'label: EQU value', so whenever the assembler encounters 'label', it replaces this with 'value'.

What does EQU mean in ARM?

The EQU directive gives a symbolic name to a numeric constant, a register-relative value or a PC-relative value.

What does DB mean in NASM?

db: compile time. the value stored in db is stored in the binary output by the assembler at a specific offset. equ allows you define constants that normally would need to be either hardcoded, or require a mov operation to get. db allows you to have data available in memory before the program even starts.

What are assembler directives in ARM?

Assembler directives supply data to the program and control the assembly process. Assembler directives enable you to do the following: Assemble code and data into specified sections. Reserve space in memory for uninitialized variables. Control the appearance of listings.


1 Answers

.equ is like #define in C:

#define bob 10
.equ bob, 10

.word is like unsigned int in C:

unsigned int ted;
ted: 
.word 0

Or initialized with a value:

unsigned int alice = 42;
alice:
.word 42
like image 87
old_timer Avatar answered Oct 13 '22 00:10

old_timer