CHAPTER 1: BASIC CONCEPTS
Contents
1.1. Welcome to Assembly Language
1.2 Virtual Machine Concept
1.3 Data Representation
1.4 Boolean Expressions
1.5 Chapter Summary
1
1.1 Welcome to Assembly Language
Introduction
Assembly language is a low-level programming language that provides a direct way to
communicate with a computer’s hardware. It sits between machine language (binary code) and
high-level languages (like C, Python, or Java).
Each instruction in assembly language corresponds closely to a single machine instruction
understood by the CPU.
Low-level languages are those that provide little or no abstraction from a computer’s
hardware.
Assembly language directly corresponds to the machine instructions (binary code) that
the CPU executes.
Each assembly instruction usually translates into one machine instruction, giving the
programmer direct control over:
o CPU registers
o Memory addresses
o Hardware operations
Assembly Language:
Uses mnemonics (symbolic names) to represent those binary instructions, making
programs easier to read and write.
Example: MOV AL, 61h
Comparison:
Type Example Level of Description
Abstraction
Machine 10110000 None Raw binary code executed by the CPU
Language 01100001
Assembly MOV AL, Very Low Uses mnemonics to represent binary
2
Language 61h instructions
High-Level x=a+b High Uses human-readable syntax, automatically
Language translated into many machine instructions
1. Machine Language vs. Assembly Language
Machine Language:
The CPU’s native language, consisting of binary codes (0s and 1s).
Example: 10110000 01100001
Machine Language — The Lowest Level
Machine language is made up of machine instructions.
It is considered a low-level language, specifically the lowest-level because:
o It communicates directly with the hardware.
o It uses binary (or sometimes hexadecimal) codes.
o It is CPU-specific — different processors have different instruction sets.
2. The Role of the Assembler
An assembler is a program that translates assembly language code into machine code so the
CPU can execute it.
3. Why Study Assembly Language
Helps you understand how computers work at the hardware level.
Useful for:
o Embedded systems programming
o Operating system development
o Device drivers
o Performance-critical applications
o Reverse engineering / cybersecurity
Builds a foundation for understanding computer architecture, CPU design, and
machine-level data handling.
3
1.2 Virtual Machine Concept
A virtual machine (VM) is an abstract computing environment that behaves like a real
computer system.
In the context of assembly language, it provides a model of how the CPU, memory, and I/O
devices interact.
An abstract computing environment is a simplified, conceptual model of a computer system
that hides the complex physical details of the hardware while showing only the essential parts
needed to understand how programs run. The word “abstract” means it’s not physical — it’s a
representation of how the computer works, not the actual machine.
Key Points:
A virtual machine hides the hardware details and offers a consistent interface for
programming.
It consists of:
o Instruction set (operations it can perform)
o Registers (small, fast storage locations)
o Memory (stores data and programs)
o Input/Output system
1.3 Data Representation
Data representation refers to the way information such as numbers, characters, and
instructions is stored and processed inside a computer.
Since computers can only understand binary digits (0 and 1), all types of data are eventually
converted into binary form.
1️⃣ Numeric Data
a. Binary (Base 2)
The fundamental representation used by computers.
4
Consists of only two digits: 0 and 1.
Each binary digit (bit) represents an ON (1) or OFF (0) electronic signal.
Example:
Decimal number 5 → Binary form 101
Decimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
b. Decimal (Base 10)
The human-readable number system we use every day.
Uses digits 0–9.
Computers convert decimal numbers into binary before processing.
Example:
Decimal 13 → Binary 1101
c. Hexadecimal (Base 16)
A compact way to represent long binary numbers.
Uses digits 0–9 and letters A–F (where A=10, B=11, …, F=15).
Example:
Binary 1111 1111 → Hexadecimal FF
Binary Hexadecimal
0000 0
5
0001 1
1010 A
1111 F
Why Hex?
It’s much shorter and easier to read than binary.
2️⃣ Characters
Characters (letters, numbers, symbols) are stored as numeric codes using standard systems.
ASCII (American Standard Code for Information Interchange):
o Uses 7 or 8 bits per character.
o Example:
'A' = 65 (Decimal) = 01000001 (Binary)
'a' = 97 (Decimal) = 01100001 (Binary)
Unicode:
o A newer system that supports all languages and symbols.
o Example: 'अ' (Hindi letter A) has Unicode code point U+0905.
3️⃣ Integers
Represent whole numbers (positive or negative).
Stored in binary form.
Unsigned integers: Only positive numbers.
Example:
00001010 = 10
Signed integers: Include positive and negative numbers using two’s complement.
Example (8-bit):
o 00001010 = +10
o 11110110 = -10
Example:
6
MOV AL, 05h
This instruction in binary (for an Intel CPU) might look like:
10110000 00000101
Here:
Opcode (10110000) → represents “MOV to register AL”
Operand (00000101) → represents value 05h (5 in decimal)
️ Summary
Data Type Representation Example
Binary Base 2 1011 = 11
Decimal Base 10 15
Hexadecimal Base 16 FF = 255
Character ASCII/Unicode 'A' = 01000001
Integer Binary (two’s complement) -10 = 11110110
Floating-point IEEE 754 6.5 = 01000000110100000000000000000000
Instruction Opcode + Operand MOV AL, 05h = 10110000 00000101
1.4 Boolean Expressions
Boolean logic is the foundation of all digital circuits and decision-making in programming.
It operates using only two values: True (1) and False (0).
These logical values are used to control program flow, conditions, and hardware operations.
Boolean Values
Value Meaning
1 True
0 False
Basic Boolean Operators
7
1. AND (·) or &&
Returns True (1) only if both operands are true.
A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1
Example:
A = 1, B = 0
Result = A AND B = 1 AND 0 = 0
2. OR (+) or ||
Returns True (1) if at least one operand is true.
A B A OR B
0 0 0
0 1 1
1 0 1
1 1 1
Example:
A = 0, B = 1
Result = A OR B = 0 OR 1 = 1
3. NOT (¬) or !
Inverts the Boolean value.
o If the input is 1 → output is 0
8
o If the input is 0 → output is 1
A NOT A
0 1
1 0
Example:
A=1
Result = NOT A = 0
Boolean Algebra Laws
1. Commutative Law
o A+B=B+A
o A·B=B·A
2. Associative Law
o (A + B) + C = A + (B + C)
o (A · B) · C = A · (B · C)
3. Distributive Law
o A(B + C) = AB + AC
4. De Morgan’s Theorems
o ¬(A + B) = ¬A · ¬B
o ¬(A · B) = ¬A + ¬B
Example (De Morgan’s Theorem):
Let A = 1, B = 0
¬(A + B) = ¬(1 + 0) = ¬(1) = 0
¬A · ¬B = (¬1) · (¬0) = 0 · 1 = 0
Both sides are equal → Theorem verified
Boolean Operations in Assembly Language
9
Boolean operations are implemented using bitwise instructions, which work directly on the
binary representation of data stored in registers.
Instruction Operation Example Result Explanation
(Binary)
AND Bitwise AND AL = 1100b, BL = 1010b AL = 1000b Only bits that are 1 in
→ AND AL, BL both remain 1
OR Bitwise OR AL = 1100b, BL = 1010b AL = 1110b Bits that are 1 in either
→ OR AL, BL become 1
XOR Bitwise AL = 1100b, BL = 1010b AL = 0110b Bits that differ are set
Exclusive → XOR AL, BL to 1
OR
NOT Bitwise NOT AL = 1100b → NOT AL AL = 0011b Inverts all bits
1.5 Chapter Summary
Assembly Language provides a symbolic way to write instructions for the CPU.
The Virtual Machine concept simplifies understanding of how hardware executes code.
Data Representation explains how information is stored and manipulated in binary
form.
Boolean Expressions describe logical operations that underpin all digital computation.
Understanding these concepts lays the foundation for mastering computer architecture and low-
level programming.
10