Directives are instructions to the assembler, specifying an action to be
taken during the assembly process.
One important use of directives is declaring or reserving memory
variables.
In addition, directives are used to break up the program into sections.
The operation name of a MAL directive always begins with a period (".").

Usually, a .data section only contains data directives
and a .text section only contains machine instructions.
A MAL program can have multiple .data and
.text sections.
An assembler groups all of the .data sections together in
memory and groups all of the .text sections together in a
different place in memory.

Directive

Operand Syntax

Meaning

.globl

label { , label }*

Declare labels to be global

.data

none

Start a data declaration section

.text

none

Start an instruction section

.byte

character [ : non-negative integer ]

Declare a character or byte variable

.word

integer [ : non-negative integer ]

Declare a C int variable

.float

real number [ : non-negative integer ]

Declare a C float variable

.double

real number [ : non-negative integer ]

Declare a C double variable

.asciiz

string

Declare a string variable

.space

non-negative integer

Reserve memory space

Some simulators require that the main label be declared as
global in order for the program to start executing at the correct
address.
This is not needed if the main label is at the beginning of
the first text segment.

The first operand for .byte, .word, or
.float specifies the initial value for the variable.
The second operand specifies the number of repetitions.
The second operand is optional.
The operand for .space specifies the number of bytes
reserved.

Directives are instructions to the assembler, specifying an action to be
taken during the assembly process.
One important use of directives is declaring or reserving memory
variables.
In addition, directives are used to break up the program into sections.
The operation name of a MAL directive always begins with a period (".").

Usually, a .data section only contains data directives
and a .text section only contains machine instructions.
A MAL program can have multiple .data and
.text sections.
An assembler groups all of the .data sections together in
memory and groups all of the .text sections together in a
different place in memory.

Directive

Operand Syntax

Meaning

.globl

label { , label }*

Declare labels to be global

.data

none

Start a data declaration section

.text

none

Start an instruction section

.word

integer [ : non-negative integer ]

Declare a C int variable

.asciiz

string

Declare a string variable

Some simulators require that the main label be declared as
global in order for the program to start executing at the correct
address.
This is not needed if the main label is at the beginning of
the first text segment.
The braces and asterisk are not part of the assembly language code.
They are markup notation indicating that the contents inside the braces
can be repeated 0 or more times.
This means that the operands for the .globl directive can
be a list of labels separated by commas.

The first operand for .word specifies the initial value for
the variable.
The second operand specifies the number of repetitions.
The brackets are not part of the assembly language code.
They only indicate that the second operand is optional.