Elements of Assembly Language Programming

StunningEpitaph avatar
StunningEpitaph
·
·
Download

Start Quiz

Study Flashcards

10 Questions

What is the primary purpose of a two-pass assembler?

To resolve forward references and create a symbol table

Which of the following is NOT one of the design criteria for an assembler?

Optimize the generated machine code for better performance

What is the purpose of the scanning or tokenizing step in the design of an assembler?

To identify and group the individual elements (tokens) of the assembly program

Which of the following is a characteristic of a single-pass assembler?

It generates object code directly in memory for immediate execution

What is the role of the parsing step in the design of an assembler?

To validate the instructions and ensure they conform to the assembly language syntax

Which step in the design of an assembler is responsible for converting data constants to their internal machine representations?

Converting into the machine language

What is the purpose of the symbol table in a two-pass assembler?

To keep track of forward references and their addresses

Which of the following is NOT a step in the design of an assembler?

Optimizing the generated machine code

What is the purpose of resolving forward references in a two-pass assembler?

To assign addresses to labels that are referenced before they are defined

Which of the following is responsible for writing the object program and the assembly listing in the design of an assembler?

Converting into the machine language

Study Notes

Records

  • Three types of records: Fixed Size Record, Variable Size Record, and Hybrid Record
  • Fixed Size Record: each entry has same type and size
  • Variable Size Record: type and size of each record could be different
  • Hybrid Record: entry has both fixed length part and variable length part

Elements of Assembly Language Programming

  • Assembly language has its words, rules, and syntax
  • Basic elements: Labels, Orders, Directives, and Comments
  • Design of the Assembler depends on the machine architecture
  • Assembler uses mnemonic language

Assembler

  • Assembler translates assembly language program to its equivalent object code
  • Input: source code written in assembly language
  • Output: object code or machine code
  • Assembler is the 1st interface between humans and machines
  • Assembler converts mnemonics into Binary code
  • Mnemonics depend on the machine architecture

Interpreter

  • Interpreter translates a single statement of the source program into machine code
  • Interpreter executes immediately before moving on to the next line

Assembler Design Criteria

  • Scanning (tokenizing)
  • Parsing (validating the instructions)
  • Creating the symbol table
  • Resolving the forward references
  • Converting into the machine language
  • Writing the object program and the assembly listing

Two Pass Assemblers

  • Assembler goes through the program one line at a time and generates machine code
  • Assembler processes to the next instruction to create the entire machine code program
  • Two-pass assembler: generates object code in two passes
  • Single-pass assembler: generates object code directly in memory for immediate execution

Single Pass Assembler

  • Parses through source code only once
  • Generates object code directly in memory for immediate execution

Why Two-Pass Assembler?

  • To handle undefined labels
  • Assembler puts undefined labels into a symbol table along with the address where the undefined symbol’s value has to be placed when the symbol is found in future

Learn about the basic components of assembly language programming such as labels, orders, directives, and comments. Understand the structure and syntax of assembly language used in computer programming.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser