0% found this document useful (0 votes)
140 views

SPCC Practical 1

An assembler is a program that converts assembly code into machine code. It performs this task over two passes. In the first pass, it defines symbols and tracks the location counter while processing pseudo-operations. In the second pass, it generates object code by converting symbolic op-codes into numeric op-codes and generating data for literals by looking up symbol values defined in the first pass. The assembler uses various data structures like symbol tables, location counters, and machine operation tables to perform its work across the two passes.

Uploaded by

116Tanzeel
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)
140 views

SPCC Practical 1

An assembler is a program that converts assembly code into machine code. It performs this task over two passes. In the first pass, it defines symbols and tracks the location counter while processing pseudo-operations. In the second pass, it generates object code by converting symbolic op-codes into numeric op-codes and generating data for literals by looking up symbol values defined in the first pass. The assembler uses various data structures like symbol tables, location counters, and machine operation tables to perform its work across the two passes.

Uploaded by

116Tanzeel
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/ 4

WHAT IS ASSEMBLER?

Assembler is a program for converting instructions written in low-level assembly code into
relocatable machine code and generating along information for the loader.

It generates instructions by evaluating the mnemonics (symbols) in operation field and find the
value of symbol and literals to produce machine code. Now, if assembler do all this work in one
scan then it is called single pass assembler, otherwise if it does in multiple scans then called
multiple pass assembler.

EXPLAIN PASSES STRUCTURE IN ASSEMBLER

 Pass-1:
1. Define symbols and literals and remember them in symbol table and literal table
respectively.
2. Keep track of location counter
3. Process pseudo-operations
 Pass-2:
1. Generate object code by converting symbolic op-code into respective numeric op-
code
2. Generate data for literals and look for values of symbols

DATABASE USED IN PASS 1 AND PASS2 ASSEMBLER

Pass 1 Data Structures\

1. Input source program


2. A Location Counter (LC), used to keep track of each instruction’s location.
3. A table, the Machine-operation Table (MOT), that indicates the symbolic
mnemonic, for each instruction and its length (two, four, or six bytes)
4. A table, the Pseudo-Operation Table (POT) that indicates the symbolic
mnemonic and action to be taken for each pseudo-op in pass 1.
5. A table, the Symbol Table (ST) that is used to store each label and its
corresponding value.
6. A table, the literal table (LT) that is used to store each literal encountered and
its corresponding assignment location.
7. A copy of the input to be used by pass 2.
Pass 2 Data Structures
1. Copy of source program input to pass1.
2. Location Counter (LC)
3. A table, the Machine-operation Table (MOT), that indicates for each instruction,
symbolic mnemonic, length (two, four, or six bytes), binary machine opcode and
format of instruction.
4. A table, the Pseudo-Operation Table (POT), that indicates the symbolic mnemonic and
action to be taken for each pseudo-op in pass 2.
5. A table, the Symbol Table (ST), prepared by pass1, containing each label and
corresponding value.
6. A Table, the base table (BT), that indicates which registers are currently specified as
base registers by USING pseudo-ops and what the specified contents of these registers
are.
7. A work space INST that is used to hold each instruction as its various parts are being
assembled together.
8. A work space, PRINT LINE, used to produce a printed listing.
9. A work space, PUNCH CARD, used prior to actual outputting for converting the
assembled instructions into the format needed by the loader.
10. An output deck of assembled instructions in the format needed by the loader.
FLOWCHART FOR PASS1 AND PASS2 ASSEMBLER.

FLOW CHART FOR PASS 1


FLOW CHART FOR PASS 2

………………………………………………****** END ******………………………………………………

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy