Skip to content
The Computer Science
TheCScience
  • Engineering Subjects
    • Human Values
    • Computer System Architecture
    • Digital Communication
    • Internet of Things
  • NCERT Solutions
    • Class 12
    • Class 11
  • HackerRank solutions
    • HackerRank Algorithms Problems Solutions
    • HackerRank C solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
The Computer Science
TheCScience

Assembly Language in Computer Architecture

YASH PAL, February 27, 2026February 28, 2026

Assembly Language in Computer Architecture – Assembly language is a low-level programming language, and a programming language is defined by a set of rules. The programs written in assembly language are compiled by an assembler. Every assembler has its own assembly language, which is designed for one specific computer architecture. The basic unit of an assembly language program is a line of code.

Assembly Language mainly consists of mnemonic processor instructions or data, and other statements or instructions. It is produced with the help of compiling the high-level language source code like C, C++. Assembly Language, which helps in fine-tuning the program.

An assembly program can be divided into three sections –

  • The data section
  • The bss section
  • The text section

The data Section: The data section is used for declaring initialized data or constants. This data does not change at runtime. You can declare various constant values, file names, or buffer sizes, etc., in this section. The syntax for declaring a data section is –

section.data

The bss Section: The bss section is used for declaring variables. The syntax for declaring bss section is –

section.bss

The text section: The text section is used for keeping the actual code. This section must begin with the declaration global_start, which tells the kernel where the program execution bagine The syntax for declaring a text section is –

section.text
   global_start
_start:

Comments

Assembly language comment begins with a semicolon (;). It may contain any printable character, including blank. It can appear on a line by itself, like –

This program displays a message on screen

or, on the same line along with an instruction, like –

add eax, ebx ; adds ebx to eax

Rules of the Assembly Language:

Each line of an assembly language program is arranged in three columns called fields. The fields specify the following information.

  1. The label field may be empty, or it may specify a symbolic address. A symbolic address consists of one, two, or three, but not more than three alphanumeric characters. The first character must be a letter, the next two may be letters or numerals. The symbol can be chosen arbitrarily by the programmer. A symbolic address in the label field is terminated by a comma so that it will be recognized as a label by the assembler.
  2. The instruction field specifies a machine instruction or a pseudo-instruction. The instruction field in an assembly language program may specify one of the following instructions:
    1. A memory-reference instruction (MRI)
    2. A register-reference or input-output instruction (non-MRI)
    3. A pseudo instruction with or without an operand
  3. The comment field may be empty, or it may include a comment. A line of code may or may not have a comment, but if it has, it must be preceded by a slash for the assembler to recognize the beginning of a comment field. Comments are useful for explaining the program and are helpful in understanding the step-by-step procedure taken by the program. Comments are inserted for explanatory purposes only and are neglected during the binary translation process.

Advantages of Assembly Language:

  • It allows complex jobs to run in a simpler way.
  • It is memory-efficient, as it requires less memory.
  • It is faster in speed, as its execution time is shorter.
  • It is mainly hardware-oriented.
  • It requires less instruction to get the result.
  • It is used for critical jobs.
  • It is not required to keep track of memory locations.
  • It is a low-level embedded system.
  • It is most suitable for writing interrupt service routines and other memory-resident programs.

Disadvantage of Assembly Language

  • It takes a lot of time and effort to write the code for the same.
  • It is very complex and difficult to understand.
  • The syntax is difficult to remember.
  • It has a lack of portability of the program between different computer architectures.
  • It needs more size or memory of the computer to run the long programs written in Assembly Language.

Let’s take an example to Write a assambly language program to subtract two numbers.

ORG 100/Origin of the program is location 100
LDA SUB/Load subtrahend to AC
CMA/Complement AC
INC/Increment AC
ADD MIN/Add minued to AC
STA DIF/Store difference
HLT/Halt computer
MIN,DEC 83/Minuend
SUB,DEC-23/Subtrahend
DIF,HEX0/Difference stored here
END/End of symbolic program
Assembly Language Program to Subtract Two Numbers

Let’s take another example to write the assembly programs to print “Hello world” in Windows.

  1. Open the notepad.
  2. Write below code
global _main
extern _printf
section .text
_main:
push message
call _printf
add esp, 4
ret
message:
db 'Hello, World!', 10, 0
  1. Save the file with any name, for example, XYZ.asm; the extension should be “.asm”.
  2. The above file needs to be compiled with the help of an assembler, which is NASM (Netwide Assembler).
  3. Run the command nasm -f win32 XYZ.asm
  4. After this, Nasm creates one object file that contains machine code, but not the executable code that is XYZ.obj
  5. To create the executable file for windows Minimal GNU is used, which provides the GCC compiler.
  6. Run the command gcc -o XYZ.exe XYZ.obj
  7. Execute the executable file now, “XYZ”
  8. It will show the output as “Hello, world”.

Assembler

An Assembler is used to translate the program written in Assembly Language into machine code. The source program is an input to an assembler that contains assembly language instructions or a symbolic language program. The output generated by the assembler is the object code or machine code understandable by the computer.

Assembler in computer architecture
Assembler

An assembler primarily serves as the bridge between symbolically coded instructions written in assembly language and the computer processor, memory, and other computational components. An assembler works by assembling and converting the source code of assembly language into object code or an object file that constitutes a stream of zeroes and ones of machine code, which are directly executable by the processor.

Assemblers are classified based on the number of times it takes them to read the source code before translating it; there are both single-pass and multi-pass assemblers. Moreover, some high-end assemblers provide enhanced functionality by enabling the use of control statements, data abstraction services and providing support for object-oriented programming structures. There are two types of assembler are:

  1. Single-pass assembler
  2. Second pass assembler

Single Pass Assembler

A single assembler pass is referred to as the complete scan of the source program input to the assembler or equivalent representation and translation by the statement, on the basis of the statement, called a single pass assembler or one pass translation.

Flowchart for first pass of assembler
Flowchart For First Pass of Assembler

It isolates the label, mnemonics, and operand field of the system. It validates the code instructions by looking them up in the mnemonic code table. It enters the symbol found in the label field and the address of the text available machine word into the symbol table. This pass is fast and effective, and no need to construct the intermediate code.

Second Pass Assembler

A table-lookup procedure is a search of table entries to determine whether a specific item matches one of the items stored in the table. The assembler uses four tables. We assign the following names to the four tables:

  1. Pseudo instruction table: Four symbols (END, OGR, DEC, & HEX)
  2. MRI table: Seven symbols of memory reference instructions
  3. Non-MRI table: 18 registers reference and I/O instruction
  4. Address symbol table: Generate during the single pass

Any symbol that is encountered in the program must be available as an entry in one of these tables; the symbol cannot be interpreted.

Computer System Architecture engineering subjects Computer System Architecture

Post navigation

Previous post
Next post

Basic structure of a computer
Functional Units of a Computer
Development of Computers
Von Neumann and Harvard Machine Architecture
Flynn Classification
Computer Structure Architecture
Basic Computer Data Types
Arithmetic Complement
Real Numbers Representation
Interfacing Logic Devices
Levels of Design Abstraction
Performance Metrics

Register Transfer Language
Memory Transfer
Arithmetic Micro-operations
Arithmetic Complements
Logic Micro-operations
Shift Micro-operations
Bus Architecture
Data Transfer
Bus and Memory Transfer
Central Processing Unit
CPU Bus Architecture

Difference between Computer Architecture and Organization
Computer Register and Types
Common Bus System
Instruction Format
Instruction Types
Instruction Cycle
Fetch Decode Execute Instruction Cycle
Timing and Control of Instruction Cycle
Input-Output and Interrupt
Memory Reference Instructions
Addressing Modes
Design of a basic computer
Design of Accumulator Unit
Design of Control Unit
Difference between Hardwired Control and Microprogrammed Control

Basic Function of a Computer
Register organization
General Register Organization
Stack organization
Infix to Reverse Polish Notation Conversion
Instruction Types and their classifications
Data transfer and manipulation
Program control
RISC and CISC
Difference between RISC and CISC

Parallel Processing
Pipeline
Types of Pipeline
Arithmetic Pipeline
Instruction Pipeline
Hazards
RISC Pipeline
Vector Processing
Array Processors

Machine Language
Assembly Language
Arithmetic and Logical Operations
Subroutine
Data Representation
Addition and Subtraction
Adder Circuits
Shift and Add Multiplication Method
Booth's Algorithm
Restoring Division Algorithm
Non-Restoring Division Algorithm
Array Multiplier
Hardwired control and Microprogrammed control Difference

Memory Classification
Memory Characteristics
Memory Organization
Memory Types
Auxiliary Memory
Associative Memory
Cache Memory
Virtual Memory
Paging and Segmentation Difference
Multiprocessor
Interconnection Structures
Interprocessor Arbitration
Interprocessor Communication and Synchronization
Cache Coherence
Shared Memory Multiprocessors

Input Output Interface
Asynchronous Data Transfer
Modes of Data Transfer
Input-Output Programming
Priority Interrupt
Microprogramming
Control Memory
Address Sequencing
Micro Program Examples
Direct Memory Access
Input-Output Processor
Serial Communication

TheCScience

We at TheCScience.com are working towards the goal to give free education to every person by publishing in dept article about Secondary, Senior-Secondary, and Graduation level subjects.

Pages

About US

Contact US

Privacy Policy

DMCA

Our Tools

Hosting - get 20% off

Engineering Subjects

Internet of Things

Human Values

Digital Communication

Computer System Architecture

Programming Tutorials

Data Structure and Algorithm

C

Java

NCERT

Class 12th

©2026 TheCScience | WordPress Theme by SuperbThemes