0% found this document useful (0 votes)
4K views9 pages

Assembler - Design - Options

Uploaded by

xavierites69
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)
4K views9 pages

Assembler - Design - Options

Uploaded by

xavierites69
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/ 9

Assembler Design Options

Faculty: SREEDIVYA I
Subject: System Programming
One pass assembler
• Only one pass
• It involves forward references.
• One method to reduce forward reference problem is to define the
symbol in the program before reference.
• It is a difficult task and practically not easy.
• Two main types of one pass assembler are:
1. One type produces object code directly in memory for
immediate execution (load and go assembler)
2. Other type produces the usual kind of object program for later
execution.
Type 1: Load and Go Assembler

• The object code will be written directly to the memory


• So no need to use loaders
• Useful in systems involving program development and testing
(e.g. A university computing system for student use)
• This assembler avoids the overhead of an additional pass over the
source program.
• Thus handling of forward reference becomes less difficult.
• Assembler simply generate the object code as it scans the program
• If an instruction operand is a symbol that is not defined, then address
is omitted when instruction is assembled.(represented as -------)
• The symbol is entered into SYMTAB and is flagged to indicate that it
is undefined.
• The address of this undefined symbol is added to list of forward
references associated with the SYMTAB entry.
• When the definition for a symbol is encountered, the forward
reference list for that symbol is scanned and proper address is inserted
into any instructions previously generated.
• When the end of the program is encountered, the assembly is
complete.
• If there is no error in the program, assembler searches SYMTAB for
the value of symbol named in the END statement and execution starts
at that location.
• For load and go assemblers, the actual address must be known at
assembly time( actually it is assigned by the system itself)
Type 2
• One pass assemblers that produce object programs as output are often used on
systems where external working-storage devices are not available.
• They are also useful when the external storage is slow or inconvenient to use
• Here also forward references are entered into lists
• When the definition of a symbol is encountered, instructions that made forward
references to that symbol may no longer be available in memory for modification.
• This is because they are already written as part of a text record in object program.
• In this case, the assembler must generate another text record with the correct
operand address.
• When the program is loaded this address will be inserted into the instruction by
the action of the loader.
Multi-Pass Assemblers
• If we use a two-pass assembler, the following symbol definition cannot be allowed.
ALPHA EQU BETA
BETA EQU DELTA
DELTA RESW 1
• This is because ALPHA and BETA cannot be defined in pass1.
• If we allow multi-pass processing, DELTA is defined in pass1, BETA is defined in pass2,
and ALPHA is defined in pass3 and the above definitions can be allowed.
• This is the motivation for using a multi-pass assembler.
• It is unnecessary for a multi-pass assembler to make more than two passes over the entire
program
• Instead, only parts of the program involving forward references need to be processed in
multiple passes.
Implementation of a multi-pass assembler

• Use a symbol table to store symbols that are not totally defined yet.
• For an undefined symbol in its entry,
• Store the names and number of undefined symbols which contribute to the
calculation of its value
• Also keep a list of symbols whose values depend on the defined value of this
symbol
• When a symbol becomes defined, we use its value to reevaluate the values of all
of the symbols that are kept in this list.
• The above step is performed recursively.

You might also like