---
title: "Short note: one pass and two pass assembler"
subject: "Microprocessor"
chapter: 3
key: "semester_4/microprocessor:one-pass-two-pass-assembler"
source: https://www.bctengineer.com/q/semester_4/microprocessor/one-pass-two-pass-assembler
site: BCT Engineering
---

# Short note: one pass and two pass assembler

Microprocessor · Chapter 3: Programming with 8086 Microprocessor

- Asked in: 2075 Baisakh, 4 marks; 2072 Magh, 4 marks (asked 2 times)
- Video: [Single Pass and Two Pass Assemblers](https://www.youtube.com/watch?v=Hd7hPhdruxA) — WIT Solapur - Professional Learning Community
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/microprocessor/one-pass-two-pass-assembler
- Whole chapter: https://www.bctengineer.com/md/semester_4/microprocessor/chapter-3

## Question

Write a short note on one pass and two pass assembler.

## Short answer

A two-pass assembler scans the source twice: first builds a symbol table, second generates machine code, easily resolving forward references. A one-pass assembler scans only once, leaving blanks for forward references to be back-patched later; it is faster and uses less memory but more complex, suited for simple assemblers.

## Answer

An **assembler** translates assembly source into machine code. The translation is done in one or two scans of the source.

#### Two-pass assembler
- **Pass 1:** reads the source, maintains a location counter, builds the **symbol table** (labels and their addresses) and processes directives. No code is generated.
- **Pass 2:** reads the source again, uses the symbol table to replace labels by addresses, generates the machine code, and produces the object file and listing.
- Handles **forward references** (a label used before it is defined) easily, because all labels are known after pass 1.

#### One-pass assembler
- Scans the source only once, generating code as it reads.
- A forward reference cannot be resolved immediately; the assembler leaves the address blank, records it in a table, and **back-patches** it when the label is defined (or the loader fixes it later).
- Faster, needs less memory, and is suitable for small, simple assemblers.

| Point | One-pass | Two-pass |
|---|---|---|
| Source scans | 1 | 2 |
| Forward references | Needs back-patching | Resolved by symbol table |
| Speed | Faster | Slower |
| Complexity | More complex handling of references | Simpler and more reliable |
| Use | Small/simple assemblers, load-and-go | MASM, TASM, most assemblers |

MASM is a (multi-)pass assembler; two-pass is the most common textbook design.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does pass 1 of a two-pass assembler do?
   A. Generates machine code
   B. Builds the symbol table with labels and addresses; no code generated
   C. Links object files
   D. Runs the program
   Answer: B. Pass 1 tracks the location counter and builds the symbol table. (Key point: Pass 1)

2. How does a one-pass assembler handle a forward reference?
   A. Leaves it blank and back-patches when the label is defined
   B. Fails always
   C. Looks it up in the symbol table
   D. Scans the source again
   Answer: A. It records the unresolved reference and fills it in later. (Key point: Forward reference)

3. Why is two-pass design simpler and more reliable?
   A. Faster
   B. All labels are known after pass 1, so forward references resolve easily
   C. Uses less memory
   D. Needs no symbol table
   Answer: B. After pass 1 the symbol table has every label. (Key point: Two-pass advantage)

## Related in Microprocessor

- [Interface 4 KB EPROM and two 2 KB RAM](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Ainterface-4kb-eprom-two-2kb-ram) — Microprocessor, chapter 4

## Related in other subjects

- [Cryptarithmetic ONE+ONE+TWO=FOUR](https://www.bctengineer.com/question.md?key=semester_6%2Fartificial_intelligence%3Acryptarithmetic-one-one-two-four) — Artificial Intelligence, chapter 2, asked 2×
- [Two copper, one steel rod: 3000 kg](https://www.bctengineer.com/question.md?key=semester_3%2Fstrength_of_materials%3Atwo-copper-one-steel-rods-3000kg) — Strength of Materials, chapter 3, asked 2×
- [Two copper, one steel rod: 5000 kg](https://www.bctengineer.com/question.md?key=semester_3%2Fstrength_of_materials%3Atwo-copper-one-steel-rods-5000kg) — Strength of Materials, chapter 3, asked 2×
- [Converting two-way slope to one-way slope](https://www.bctengineer.com/question.md?key=semester_6%2Ftransportation_engineering_i%3Asuper-attainment-drainage) — Transportation Engineering I, chapter 3, asked 2×
