0% found this document useful (0 votes)
50 views

Microprocessor Reviewer

micro reviewer

Uploaded by

ajnsambile
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)
50 views

Microprocessor Reviewer

micro reviewer

Uploaded by

ajnsambile
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
You are on page 1/ 4

1. Introduction to Microcomputers and Microprocessors 5.

Binary and Hexadecimal Number Systems

• Key Components of a Computer System: • Binary: Used in computers (base-2), only 0 and 1.

o Central Processing Unit (CPU): Acts as the brain, • Hexadecimal (Hex): Convenient representation of binary, using
coordinating all activities. base-16.

o Memory: Stores program instructions and data. o Conversion techniques between binary, decimal,
and hex are illustrated in the document.
o Input/Output (I/O) Devices: Allow for input and
output of information. 6. Arithmetic Operations in Binary and Hexadecimal

• Microprocessor: • Binary Arithmetic:

o The integrated circuit (IC) chip containing the CPU, o Binary addition and subtraction.
acting as the brain of the computer.
• Hexadecimal Arithmetic:
o Microcomputers are smaller computers using
microprocessors, often as personal computers. o Hexadecimal addition and subtraction methods
with examples.
• Bus System:
7. ASCII Code
o Address Bus: Identifies the memory location or I/O
device for communication. • Represents alphanumeric characters in hexadecimal format
(e.g., ‘A’ as 41H in hex).
o Data Bus: Transfers data between CPU, memory,
and I/O. 8. Important Terminology

o Control Bus: Manages whether the address is for • Bit: Smallest data unit.
memory or an I/O device.
• Byte (8 bits), Word (16 bits), Double-word (32 bits), Quad-word
• Memory Types: (64 bits): Defined data lengths.

o RAM (Random Access Memory): Volatile memory, • Data Sizes:


used for temporary storage.
o 1 KB = 2102^{10}210 bytes, 1 MB = 2202^{20}220
o ROM (Read Only Memory): Non-volatile memory, bytes, 1 GB = 2302^{30}230 bytes, etc.
data retained even when powered off.
1. History of the 80x86 Family of Microprocessors
2. Internal CPU Organization
• Evolution from 8080/8085 to 8086:
• Registers: Temporary storage for data within the CPU.
o Intel introduced the 8086 microprocessor in 1978,
• Arithmetic and Logic Unit (ALU): Executes arithmetic and logic marking a major improvement over the previous
operations. 8080/8085 series.

• Instruction Pointer: Holds the address of the next instruction to o Key differences included a 16-bit data bus, a 20-bit
execute. address bus (1 megabyte of memory), and pipelining
capabilities.
• Instruction Decoder: Interprets the instructions fetched into
the CPU. • Transition from 8086 to 8088:

3. History and Evolution of Computers o The 8088 was similar to the 8086 internally but used
an 8-bit external data bus to reduce costs.
• 1946: First-generation computer, ENIAC, based on vacuum
tubes. o IBM chose the 8088 for its PC, making it highly
successful, especially as an open system with
• 1958-1981: Transition from transistorized computers to Microsoft.
microprocessors like Intel’s 8086 and IBM's PC.
• Other Microprocessors (80286, 80386, and 80486):
• Modern Microprocessors: Intel Pentium series and beyond,
with millions of transistors and increased data/address bus o 80286 (1982): Introduced a 24-bit address bus,
capacities. virtual memory, and protected mode.

4. Evolution of Intel 80x86 Family o 80386 (1985): Featured a 32-bit data bus and
supported up to 4 GB of physical memory.
• Progression from Intel 4004 in 1971 to Intel Itanium in 2001,
each generation increasing in transistor count, clock rate, and
o 80486 (1989): Included a built-in math co-processor
and cache memory for faster processing.
bus width.
2. Architecture of the 8086 Microprocessor
• Pipelining: 1. Introduction to Assembly Language Programming

o In 8085, the CPU could only fetch or execute at a • ADD Instruction:


time. The 8086 introduced pipelining, allowing
simultaneous fetching and executing. o Used to add values from the source to the
destination. Format: ADD destination, source.
o The 8086 architecture was divided into two main
sections: o Examples provided show how values are moved into
registers using MOV and then added with ADD.
▪ Execution Unit (EU): Executes the
instructions. o Immediate operands can be directly added to a
destination register.
▪ Bus Interface Unit (BIU): Manages data
2. Program Segments
and address bus interactions and
maintains a buffer for storing upcoming
instructions.
• Segments:

o Challenges such as branch penalties occur with


o A segment is a memory area up to 64 KB, aligned at
addresses divisible by 16.
jump instructions, causing the BIU to clear its queue
and restart fetching.
o Three main segments in assembly language:

• Registers: ▪ Code Segment: Stores program


instructions.
o The 8086 includes various registers categorized by
function: ▪ Data Segment: Holds data used in the
program.
▪ General-purpose registers (AX, BX, CX,
DX), which can be accessed in 8- or 16-bit ▪ Stack Segment: Temporarily stores data,
parts. often for function calls or subroutines.

▪ Specialized registers: Used for specific


• Addresses in Segments:
tasks, with the high and low byte
accessible separately for some registers. o Physical Address: A 20-bit address on the address
bus, ranging from 00000H to FFFFFH.
3. Introduction to Assembly Language Programming
o Segment Address: A 16-bit starting address of a
• Machine and Assembly Language: segment block.
o Machine language consists of binary (0s and 1s) o Offset Address: Location within the 64 KB segment
instructions directly executed by the CPU. range (0000H to FFFFH).
o Assembly language uses mnemonics to represent o Logical Address: Combination of the segment
machine instructions, making coding more address and offset address.
accessible.
3. Addressing in Code Segment
• Assembly Language Characteristics:
• Code Segment Addressing:
o Assembly language is low-level, requiring knowledge
of the CPU’s internal structure. o The 8086 fetches instructions from the code
segment, with addresses represented by CS:IP
o Assemblers translate assembly code to machine (Code Segment and Instruction Pointer).
code, while high-level languages (like C and Pascal)
are translated by compilers. o Physical Address Calculation:

• MOV Instruction: ▪ Shift the CS register left by one hex digit,


then add the IP value.
o The MOV instruction transfers data between
registers or between memory and registers. ▪ Example: If CS = 1980H and IP = 78FEH,
the physical address is calculated as
o Key rules include: 19800 + 78FE = 210FEH.

▪ Matching source and destination sizes. 4. Addressing in Data Segment

▪ Restrictions on loading values into certain • Data Segment:


registers directly (e.g., CS, DS).
o Allocated memory for storing program data,
▪ Direct data transfer is illegal for certain including single values and arrays.
registers and data sizes exceeding their
capacity. o Addressing in the data segment uses the DS register
and offset addresses (using BX, SI, or DI registers).
o Example: If DS = 7FA2H and the offset is 438EH, the 1. Addition (16-bit):
physical address is calculated as 7FA20 + 438E =
83DAEH. o Objective: Add two 16-bit numbers using different
addressing modes.
• Why Use the Data Segment?:
o Code Sample:
o Separating code from data enhances readability and
asm
maintenance.
Copy code
o Example: A program to add several bytes can store
data in the data segment rather than mixing it within MOV AX, OPR1 ; Direct addressing mode
the code.
ADD AX, OPR2 ; Direct addressing mode
5. Little Endian Convention
MOV SUM, AX ; Store result in extra segment
• Little Endian:
2. Subtraction (16-bit):
o In this convention, for 16-bit data, the lower byte is
stored at the lower memory address, and the higher o Objective: Subtract two 16-bit numbers using
byte at the higher memory address. addressing modes.

o Example: If AX = 35F3H, storing it at DS:1500 results o Algorithm: Load data segment, perform
in DS:1500 = F3 and DS:1501 = 35. subtraction, store result.

o Big Endian (used by Motorola): The opposite 3. Multiplication (16-bit):


convention, where the high byte goes to the low
o Objective: Multiply two 16-bit numbers and store
memory address.
result in extra segment.
Part A: Introduction to MASM
o Algorithm: Load values into registers, multiply, store
Key Concepts: result.

1. Editor: A tool to write assembly language statements and save 4. Division (16-bit):
them in a source file (.ASM).
o Objective: Divide a 32-bit number by a 16-bit
2. Assembler: Converts assembly mnemonics into binary code, number.
generating an object file (.OBJ) and an assembler list file (.LST).
o Algorithm: Load values, divide, store quotient and
3. Linker: Combines multiple object files into an executable file remainder.
(.EXE).
1. Introduction to MASM and 8086 Assembly Programming
4. Debugger: Helps load, execute, and troubleshoot code,
allowing inspection and modification of registers and memory. Key Components:

MASM (Microsoft Macro Assembler): • Editor: A program to create assembly language code files
(.ASM).
• MASM integrates an editor, assembler, linker, and debugger to
facilitate assembly language programming. • Assembler: Converts assembly mnemonics to binary codes,
creating object files (.OBJ) and list files (.LST).
Execution Procedure
• Linker: Combines object files into executable files (.EXE).
1. Open Command Prompt.

2. Check MASM Installation: Type masm in the command • Debugger: Helps in testing and troubleshooting code, allowing
prompt. you to inspect and modify register and memory contents
during program execution.
3. Directory Setup: Navigate to your folder in the command
prompt. 2. Basic Execution Procedure in MASM

4. Program Writing: Use edit programname.asm to write and 1. Open Command Prompt: Start by navigating to the DOS
save assembly code. command prompt.

5. Assemble, Link, Execute: 2. Check MASM Installation: Type masm to verify installation.

3. Create and Change Directory: Set up a working folder and


o Assemble: masm programname
navigate to it.
o Link: link programname
4. Write Program: Use edit programname.asm to open the editor
o Execute: debug programname.exe and write assembly code.

16-Bit Arithmetic Operations 5. Assemble, Link, and Execute:

Experiment 2: Arithmetic Operations o Assemble with masm programname.


o Link with link programname.

o Execute with debug programname.exe.

3. Experiment 2: 16-Bit Arithmetic Operations

Objective:

Implement 16-bit addition, subtraction, multiplication, and division using


different addressing modes in 8086 assembly language.

Programs and Flow:

1. Addition:

o Initialize data segment.

o Perform addition on two 16-bit numbers and store


the result.

2. Subtraction:

o Similar steps as addition, but perform subtraction.

3. Multiplication:

o Multiply two 16-bit numbers, store the results in the


extra segment.

4. Division:

o Divide a 32-bit number by a 16-bit number, storing


quotient and remainder separately.

4. Experiment 3: Sorting an Array in 8086

Aim:

Write an ALP to sort 16-bit numbers in ascending and descending order.

Ascending Order Sorting

• Algorithm:

1. Initialize data and set up counters.

2. Compare each pair of numbers.

3. Swap if needed to arrange in ascending order.

4. Repeat until the list is fully sorted.

• Sample Code:

asm

Copy code

MOV AX, [SI]

CMP AX, [SI+2]

JC GO ; Jump if Carry (AX < [SI+2])

XCHG AX, [SI+2] ; Swap if in wrong order

Descending Order Sorting

• Algorithm:

1. Follow similar steps as for ascending order.

2. Compare and swap numbers to arrange them in


descending order.

You might also like