0% found this document useful (0 votes)
8 views15 pages

Assembly Language Notes

The document provides comprehensive study notes on assembly language, covering key concepts such as flags, registers, processor evolution, and definitions related to programming. It details the types of flags and registers, their purposes, and the evolution of processors from 4-bit to 64-bit architectures, including notable AMD and Intel processors. Additionally, it includes multiple-choice questions (MCQs) to test understanding of the material presented.

Uploaded by

rafiqueusman258
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)
8 views15 pages

Assembly Language Notes

The document provides comprehensive study notes on assembly language, covering key concepts such as flags, registers, processor evolution, and definitions related to programming. It details the types of flags and registers, their purposes, and the evolution of processors from 4-bit to 64-bit architectures, including notable AMD and Intel processors. Additionally, it includes multiple-choice questions (MCQs) to test understanding of the material presented.

Uploaded by

rafiqueusman258
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

Assembly Language

Complete Study Notes

Flags · Registers · Definitions · Processor Evolution · MCQs

# Topic

Q1 What is a Flag?

Q2 Types of Flags

Q3 What is a Flag Register?

Q4 Registers and Their Types

Q5 Definitions (Language, Assembly Language, LPS, Branching, CMP, Jumps)

Q6 Processor Evolution: Bits, Registers & OS + MCQs

Q7 AMD Processors + MCQs

Q8 Types of Registers According to Bits + MCQs


Q1. What is a Flag?
A flag is a single-bit indicator inside the CPU that shows the status of an operation.

Why is it Used?
• Check results of operations (positive, negative, zero).
• Make decisions in a program (like IF conditions).
• Control program flow using conditional jumps.

Common Types of Flags

Flag Name Purpose

ZF Zero Flag Result is zero.

CF Carry Flag Carry or borrow occurred.

SF Sign Flag Result is negative.

OF Overflow Flag Overflow in signed operations.

PF Parity Flag Even number of 1s.

Example
MOV AX, 5

SUB AX, 5

Result = 0

So, ZF = 1 (because result is zero)


Q2. Types of Flags
Flags are broadly divided into two main categories, and under them come all individual flags.

(i) Status Flags


Status flags reflect the outcome of arithmetic or logical operations.

Flag Name Purpose

CF Carry Flag Set when a carry or borrow occurs.

PF Parity Flag Set if result has an even number of 1s.

AF Auxiliary Carry Flag Carry from lower 4 bits (BCD operation).

ZF Zero Flag Set when result is zero.

SF Sign Flag Set when result is negative.

OF Overflow Flag Set when signed overflow occurs.

(ii) Control Flags


Control flags manage the way the processor executes instructions.

Flag Name Purpose

TF Trap Flag Executes program step by step (debugging).

IF Interrupt Flag Enables or disables interrupts.

DF Direction Flag Controls direction of string operations.


Q3. What is a Flag Register?
A flag register is a special CPU register that stores flags (status bits). Each bit inside this register
represents a specific condition that occurs after an operation.

Why is the Flag Register Used?


• Check the result of operations.
• Make decisions (like IF conditions).
• Control program flow (loops, jumps).
• Handle interrupts and debugging.

Example
Suppose a processor performs a subtraction between two numbers and the result becomes zero. In
that case, the Zero Flag (ZF) inside the flag register is set to 1 automatically.

Uses of Flag Register

Use Description

Debugging Allows step-by-step debugging using Trap Flag.

Decision Making Helps CPU perform conditional operations.

Result Status Indication Shows the condition of a result.

Program Flow Control Controls jumps, loops, and execution.

Arithmetic Support Detects carry, overflow, and errors in calculation.


Q4. What are Registers? Explain Their Types.
A register is a small, high-speed storage location inside the CPU used to temporarily hold data,
instructions, or addresses during program execution.

Key Points
• Located inside the CPU.
• Very fast compared to RAM.
• Stores temporary data.
• Directly used by the processor during execution.

Why are Registers Important?


• Hold instructions and addresses.
• Control program execution.
• Perform fast calculations.

Working of a Register
Registers temporarily store data, instructions, and addresses inside the CPU. During execution, the
CPU loads data into registers, performs operations, stores the result back in registers, and updates
flags accordingly.

Types of Registers

* General Purpose Registers


These are used to store temporary data for calculations.

Register Name Use

AX Accumulator Arithmetic operations.

BX Base Register Memory addressing.

CX Counter Loop and counting.

DX Data Register Data operations.

* Special Purpose Registers


These are registers that perform specific tasks inside the CPU.

Register Name Use

IP Instruction Pointer Controls program flow.

SP Stack Pointer Used in function calls; accesses data in stack.


Register Name Use

BP Base Pointer Used for string and array operations.

IR Index Register Used for string and array operations.

* Segment Registers
These are used for memory segmentation.

Register Name Use

CS Code Segment Program code.

DS Data Segment Data storage.

SS Stack Segment Stack memory.

ES Extra Segment Extra data.


Q5. Definitions

(i) Language
Language is a system of communication that uses symbols, sounds, or gestures to convey meaning,
ideas, and emotions between individuals.
Example: English, Urdu, and C++ are all languages.
Tip/Trick: Think of language as a 'bridge' between two minds. Without it, no message can travel.

(ii) Assembly Language


Assembly language is a low-level programming language that is closely related to the machine
language of a specific computer.
Example: MOV AX, 5 — this moves the value 5 into register AX.
Tip/Trick: Remember: Assembly is one step above machine code. It uses mnemonics (short words)
instead of 0s and 1s.

Key Points
• Easier to understand than machine language.
• Faster execution than high-level languages.
• Essential for writing system software.

(iii) Language Processing System (LPS)


A language processing system is a system or program that converts a program written by a
programmer into machine code, so that the computer can execute it. Computers understand only
machine language, while programmers usually write programs in high-level or assembly language.
The LPS translates these programs step by step until they become executable by the computer.
Example: A compiler translating a C++ program into machine code is an example of LPS.
Tip/Trick: LPS = Translator. It takes human-readable code and converts it into 0s and 1s the CPU can
understand.

Components of LPS
• (i) Preprocessor
• (ii) Compiler
• (iii) Interpreter
• (iv) Assembler
• (v) Loader

(iv) Branching
Branching means changing the normal flow of program execution. Normally a program runs line by
line. But with branching, the program can jump to another instruction instead of following the
sequence.
Example: An IF statement in a program that jumps to a different block based on a condition.
Tip/Trick: Imagine reading a book but on page 5 it says 'If YES, go to page 10; if NO, continue.' That is
branching!

(v) CMP (Compare Instruction)


CMP is an instruction used to compare two values in assembly language. CMP compares two
operands by subtracting them, but does not store the result. It only updates flags in the CPU.
Example: CMP AX, BX — this compares AX and BX. If they are equal, ZF is set to 1.
Tip/Trick: CMP = Compare but do NOT save. It subtracts silently and only tells the flags what
happened.

(vi) Conditional Jump


A conditional jump is an instruction that jumps to another location only if a specific condition is true.
Example: JZ LABEL — jump to LABEL only if ZF = 1 (result was zero).
Tip/Trick: Conditional = 'depends on something'. If condition is true, jump. Otherwise, keep going.

Types of Conditional Jumps


• (i) Equality Jumps
• (ii) Signed Jumps
• (iii) Unsigned Jumps

(vii) Unconditional Jump


An unconditional jump is an instruction that jumps to a specific label or memory address every time it
is executed, regardless of flags or conditions.
Example: JMP START — always jumps to the label START, no matter what.
Tip/Trick: Unconditional = No condition needed. It ALWAYS jumps. Think of it as a one-way teleport.

(viii) Jump
In C and assembly language, a jump (also called a branch) is an instruction that changes the normal
flow of program execution.
Example: JMP, JZ, JNZ are all jump instructions.
Tip/Trick: Jump = Change direction. Like a fork in a road, the program does not always go straight.

Types of Jumps
• (i) Short Jump
• (ii) Near Jump
• (iii) Far Jump
Q6. Processor Evolution: Bits, Registers & OS
As processors evolved over the decades, the size of their registers increased, allowing them to
handle more data at once. Below is the complete evolution from 4-bit to 64-bit processors.

Bits Processor Example Register Size OS / Platform

4-bit Intel 4004 4-bit Embedded Systems, Calculators (1970s)

8-bit Intel 8080, Z80 8-bit CP/M, Early DOS

16-bit Intel 8086 16-bit MS-DOS, Windows 3.x

32-bit Intel 80386, 80486 32-bit (EAX) Windows 95/98, Early Linux

64-bit Intel Core i7, AMD Ryzen 64-bit (RAX) Windows 10/11, Linux 64-bit, macOS

Tip/Trick: Remember the evolution as: 4 → 8 → 16 → 32 → 64. Each step doubled the register size.
Key names: Intel 4004 (first microprocessor), Intel 8086 (origin of x86), EAX for 32-bit, RAX for 64-bit.

MCQs — Processor Evolution


1. Which was the first microprocessor?
A) Intel 8080
B) Intel 4004
C) Intel 8086
D) AMD K5
Answer: B) Intel 4004

2. Intel 8086 uses which register size?


A) 8-bit
B) 32-bit
C) 16-bit
D) 64-bit
Answer: C) 16-bit

3. Which OS runs on 64-bit processors?


A) MS-DOS
B) Windows 3.x
C) CP/M
D) Windows 10/11
Answer: D) Windows 10/11

4. What is the 64-bit version of the AX register called?


A) EAX
B) RAX
C) AH
D) AX
Answer: B) RAX

5. Intel 80386 introduced which type of registers?


A) 8-bit
B) 16-bit
C) 32-bit
D) 64-bit
Answer: C) 32-bit

6. CP/M and Early DOS were used on which processors?


A) 4-bit
B) 8-bit
C) 32-bit
D) 64-bit
Answer: B) 8-bit
Q7. AMD Processors (Advance Micro Devices)
AMD (Advanced Micro Devices) is one of the leading CPU manufacturers. Below is the complete
timeline of AMD processors from 1975 to 2023.

Year Processor Notes

1975 AMD AM9080 Intel 8080 clone.

1982 AMD 2900 series Bit-slice processor.

1991 AMD 386 x86 compatible.

1993 AMD 486 Compatible 32-bit CPU.

1996 AMD K5 First in-house design.

1997 AMD K6 Competition to Intel Pentium.

1999 AMD Athlon High performance x86 CPU.

2003 AMD Opteron / Athlon 64 First 64-bit x86 CPUs.

2005 AMD Athlon 64 X2 First dual-core CPU.

2007 AMD Phenom Quad-core CPU.

2011 AMD FX series Bulldozer architecture.

2017 AMD Ryzen Zen architecture, multi-core focus.

2019 Ryzen 3000 7nm process.

2020 Ryzen 5000 Zen 3 architecture.

2023 Ryzen 7000 AM5 socket, latest generation.

Tip/Trick: Memory trick: 'AMD started as a clone, then grew its own throne.' Key milestones: K5 (first
own design), Athlon (first big performance), Athlon 64 (first 64-bit x86), Ryzen (Zen era, modern AMD).

MCQs — AMD Processors


1. AMD was founded and its first notable product was a clone of which processor?
A) Intel 4004
B) Intel 8086
C) Intel 8080
D) Intel Pentium
Answer: C) Intel 8080

2. Which was AMD's first in-house designed processor?


A) AMD K6
B) AMD K5
C) AMD 486
D) AMD Athlon
Answer: B) AMD K5
3. Which AMD processor was the first 64-bit x86 CPU?
A) AMD K5
B) AMD Athlon
C) AMD Opteron / Athlon 64
D) AMD Phenom
Answer: C) AMD Opteron / Athlon 64

4. AMD Ryzen was introduced in which year?


A) 2011
B) 2015
C) 2017
D) 2019
Answer: C) 2017

5. Which AMD architecture introduced multi-core focus?


A) Bulldozer
B) Zen
C) K6
D) Athlon
Answer: B) Zen

6. AMD Ryzen 7000 uses which socket?


A) AM3
B) AM4
C) AM5
D) LGA 1151
Answer: C) AM5

7. AMD Athlon 64 X2 was the first AMD processor with how many cores?
A) 1
B) 2
C) 4
D) 8
Answer: B) 2
Intel Processors — Timeline (Reference)

Year Processor Notes

1971 Intel 4004 First microprocessor, 4-bit.

1972 Intel 8008 8-bit processor.

1974 Intel 8080 Advanced 8-bit processor.


Q8. Types of Registers According to Bits
As processor architecture evolved, the size of registers also grew. Below is a detailed classification of
register types based on bits, with examples and OS information.

Register Size Table

Processo Register
Example Processor Notes
r Type Size

4-bit 4 bits Intel 4004 Old microprocessors; handles only 1 nibble of data.

8-bit 8 bits Intel 8080, Intel 8085, Zilog Z80


8-bit registers; handles max 1 byte directly; simple instructions.

16-bit 16 bits Intel 8086, 80186 16-bit general purpose registers (AX, BX, CX, DX); 16-bit data + m

32-bit 32 bits Intel 80386, 80486 32-bit registers (EAX, EBX, ECX, EDX); larger data handling; exte

64-bit 64 bits Intel Core i3/i5/i7/i9, AMD Ryzen


64-bit registers (RAX, RBX...); large addressable memory; modern

With OS / Platform

Processo Register
Example Processor Common OS / Platform
r Type Size

4-bit 4 bits Intel 4004 Early embedded systems, calculators, microcontrollers.

8-bit 8 bits Intel 8080, 8085, Zilog Z80 CP/M, early DOS (with 8-bit versions), embedded controllers.

16-bit 16 bits Intel 8086, 80186, 80286 MS-DOS, Windows 1.x / 2.x / 3.x, early OS/2, early embedded sys

32-bit 32 bits Intel 80386, 80486, PentiumWindows 95, 98, NT 4.0, Linux (early versions), Solaris 32-bit.

64-bit 64 bits Intel Core i3/i5/i7/i9, AMD Ryzen


Windows XP/7/10/11 64-bit, Linux 64-bit, macOS (Intel), modern U

Tip/Trick: Memory trick for register names: 16-bit uses AX/BX/CX/DX. Add 'E' (Extended) for 32-bit:
EAX/EBX/ECX/EDX. Add 'R' (Register 64) for 64-bit: RAX/RBX/RCX/RDX. So AX -> EAX -> RAX is the
evolution of just one register.

MCQs — Types of Registers According to Bits


1. Which register is used in a 32-bit processor as the accumulator?
A) AX
B) RAX
C) EAX
D) AH
Answer: C) EAX

2. Intel 8086 uses which size of registers?


A) 8-bit
B) 16-bit
C) 32-bit
D) 64-bit
Answer: B) 16-bit

3. Which OS is associated with 16-bit processors?


A) Windows 10
B) MS-DOS
C) macOS
D) Linux 64-bit
Answer: B) MS-DOS

4. A 64-bit register can hold up to how many bytes of data?


A) 2 bytes
B) 4 bytes
C) 8 bytes
D) 16 bytes
Answer: C) 8 bytes

5. Which processor introduced 64-bit registers?


A) Intel 8086
B) Intel 80386
C) Intel Core i7
D) Intel 4004
Answer: C) Intel Core i7

6. What is a nibble?
A) 8 bits
B) 16 bits
C) 4 bits
D) 2 bits
Answer: C) 4 bits

7. Windows 95 and 98 are associated with which type of processor?


A) 8-bit
B) 16-bit
C) 32-bit
D) 64-bit
Answer: C) 32-bit

8. Which processor series first introduced extended 32-bit registers (EAX)?


A) Intel 8086
B) Intel 80386
C) Intel 8080
D) AMD K5
Answer: B) Intel 80386

End of Notes — Assembly Language

You might also like