KEMBAR78
Assembly Language Basics | PDF | Assembly Language | Computer Program
0% found this document useful (0 votes)
56 views13 pages

Assembly Language Basics

An assembler converts assembly language code into machine language code by performing two passes. In the first pass, it scans the program and builds a symbol table containing labels and their addresses. In the second pass, it uses the symbol table to evaluate fields and generate the executable machine code, converting mnemonics to machine operations and symbolic operands to addresses. Assemblers make programming at the machine level easier by using symbolic notation rather than binary, but working in assembly requires more time and effort than higher-level languages.

Uploaded by

Abhishek Ranjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views13 pages

Assembly Language Basics

An assembler converts assembly language code into machine language code by performing two passes. In the first pass, it scans the program and builds a symbol table containing labels and their addresses. In the second pass, it uses the symbol table to evaluate fields and generate the executable machine code, converting mnemonics to machine operations and symbolic operands to addresses. Assemblers make programming at the machine level easier by using symbolic notation rather than binary, but working in assembly requires more time and effort than higher-level languages.

Uploaded by

Abhishek Ranjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ASSEMBLER

WHAT IS ASSEMBLER?
An assembler is a program that converts
an assembly level language code (also
called as mnemonic code) into machine
language code and provides necessary
information for the loader to load the
programme.
Assembler languages-structure
<Label> <Mnemomic> <Operand> Comments
• Label
– symbolic labeling of an assembler address (command address at
Machine level)
• Mnemomic
– Symbolic description of an operation
• Operands
– Contains of variables or addresse if necessary
• Comments
– ignored by assembler
– used by humans to document/understand programs
– tips for useful comments:
• avoid restating the obvious, as “decrement R1”
• provide additional insight, as in “accumulate product in R6”
TYPES OF STATEMENT OF
ASSEMBLER

STATEMENTS

ASSEMBLER
IMPERATIVE DECLARATIVE
DIRECTIVE
STATEMENTS STATEMENT
STATEMENTS
ASSEMBLER PROCESS
ASSEMBLY
LANGUAGE PASS1 PASS2 EXECUTABLE
PROGRAM IMAGE

SYMBOL
TABLE

First Pass:
scan program file
find all labels and calculate the corresponding addresses;
this is called the symbol table
Second Pass:
convert instructions to machine language,
using information from symbol table
OVERVIEW PASS1
PASS 2 Overview: Evaluate Fields
and Generate Code.
Assembler’s functions
• Convert mnemonic operation codes to their
machine language equivalents
• Convert symbolic operands to their equivalent
machine addresses .
• Build the machine instructions in the proper
format
• Convert the data constants to internal machine
representations
• Write the object program and the assembly
listing
Linking and Loading
• Loading is the process of copying an executable image
into memory.
– more sophisticated loaders are able to relocate images
to fit into available memory
– must readjust branch targets, load/store addresses

• Linking is the process of resolving symbols between


independent object files.
– suppose we define a symbol in one module,
and want to use it in another
– some notation, such as .EXTERNAL, is used to tell assembler
that a symbol is defined in another module
– linker will search symbol tables of other modules to resolve
symbols and complete code generation before loading
DATABASES USED BY PASS1
AND PASS2
ADVANTAGES
• It used mnemonics instead used bits.
• Address are symbolic not absolute.
• Reading / understand program easily.
• Introduction to data is easier.
DISADVANTAGES
• Working with assembler takes a little more time,
through not as much as people are wont to think.
• Assembler offers more facilities for structuring,
even though lacking craftsmanship will bring on
maintenance problems more easily.
• In assembler one has more possibilities for
solving or preventing performance problems.
• It takes some extra effort to find or train
professionals.

You might also like