UT MP
UT MP
The 8085 microprocessor is an 8-bit microprocessor designed by Intel in the 1970s. It has a
simple yet efficient architecture, consisting of several functional blocks that allow it to
perform arithmetic, logic, and control operations. Here is an explanation of its key
components:
1. Accumulator (A Register)
8-bit register used for arithmetic, logical, and data transfer operations.
Acts as the primary register where most operations are performed.
It holds one of the operands and stores the result of the operation.
The ALU performs arithmetic operations such as addition, subtraction, and logical
operations like AND, OR, XOR.
The result of these operations is stored in the accumulator.
It works with 8-bit data and affects the flag register based on the result.
3. General-Purpose Registers
The 8085 has six general-purpose registers, each of which is 8 bits:
o B, C, D, E, H, and L.
These registers can be used individually or in pairs (BC, DE, HL) to hold 16-bit data.
HL pair can also function as a memory pointer (it holds the memory address for
certain instructions).
A 16-bit register that holds the address of the next instruction to be executed.
As each instruction is fetched, the PC is incremented to point to the following
instruction.
6. Temporary Register
7. Flag Register
The flag register is an 8-bit register that stores the result of the ALU operations in the
form of flags (status bits).
There are five significant flags:
1. Sign (S): Set if the result is negative.
2. Zero (Z): Set if the result is zero.
3. Auxiliary Carry (AC): Set if there’s a carry out from the lower nibble in
BCD arithmetic.
4. Parity (P): Set if the result has an even number of 1s (even parity).
5. Carry (CY): Set if there’s a carry out after an addition or a borrow in
subtraction.
The instruction register temporarily holds the instruction fetched from memory.
The decoder interprets the instruction and generates the necessary control signals to
execute it.
The address buffer stores the content of the Program Counter and Stack Pointer,
which helps in address generation.
The address/data buffer carries both address and data, helping with memory and I/O
communication.
Address Bus: A 16-bit bus used to address memory and I/O devices (unidirectional).
Data Bus: An 8-bit bus used to transfer data between the microprocessor and
peripherals (bidirectional).
Real mode operation allows the microprocessor to address only first 1M byte of memory space.
A combination of segment address and an offset address access memory location in real mode.
All real mode memory addresses consist of segment address plus an offset address.
The segment address located at one of the segment register, defines the beginning address of any
64K bytes memory segment.
The offset address selects any located at one of the segment register defines the beginning
address of any 64K bytes memory segment.
Segments in real mode always have a length of 64K byte memory segment.
2. Draw And explain architecture of 8086
ANS:
The 8086 microprocessor is a 16-bit processor developed by Intel, and its architecture
is more advanced compared to the 8085. The 8086 uses a 20-bit address bus to access up to
1 MB of memory and has a 16-bit data bus, making it capable of handling 16-bit data and
instructions.
The architecture of the 8086 can be divided into two main functional units:
The architecture of the 8086 is divided into several key components, as shown below.
-------------------------------
| Execution Unit |
| |
| General Purpose Registers |
| Instruction Decoder |
| ALU (Arithmetic Logic Unit) |
| Control Flags |
| Instruction Queue (6 bytes) |
-------------------------------
|
|
-------------------------------
| Bus Interface Unit |
| |
| Segment Registers (CS, DS, |
| SS, ES) |
| Instruction Pointer |
| Address Generation Circuit |
| Memory and I/O Interface |
| Address Bus (20-bits) |
| Data Bus (16-bits) |
-------------------------------
The Bus Interface Unit is responsible for interfacing the microprocessor with the memory
and input/output devices. It handles the transfer of data, addresses, and instructions between
the processor and external memory or I/O devices.
Segment Registers: The 8086 uses segment registers to access memory. The
memory in 8086 is divided into four segments, each of 64 KB.
o CS (Code Segment): Stores instructions to be executed.
o DS (Data Segment): Holds data for the program.
o SS (Stack Segment): Holds stack data (used for function calls, local variables).
o ES (Extra Segment): Used as an additional data segment.
Instruction Pointer (IP): The IP is a 16-bit register that holds the address of the next
instruction to be executed. It works with the CS register to form the 20-bit address of
the instruction.
Address Generation Circuit: The BIU generates the 20-bit physical address by
combining a segment register and an offset (e.g., the IP or other registers). The
address is used to access the memory.
Instruction Queue: The 8086 features a 6-byte instruction queue that pre-fetches
instructions from memory. This allows it to fetch instructions while executing others,
enhancing performance through pipelining.
Data and Address Bus:
o 20-bit Address Bus: Can access up to 1 MB of memory (2^20).
o 16-bit Data Bus: Transfers data between the processor and memory or I/O devices.
The Execution Unit is responsible for decoding and executing instructions fetched by the
BIU. It handles arithmetic, logic, and control operations.
General-Purpose Registers:
o AX (Accumulator): Used for arithmetic and data transfer operations.
o BX (Base Register): Primarily used for memory access with an offset.
o CX (Count Register): Used for loops and string operations.
o DX (Data Register): Used in input/output operations and division/multiplication.
These registers can also be split into 8-bit parts (e.g., AH/AL, BH/BL).
Arithmetic and Logic Unit (ALU): The ALU performs arithmetic operations
(addition, subtraction) and logical operations (AND, OR, XOR, NOT). It works with
16-bit data and produces results that affect the flag register.
Flags Register: The Flags Register contains status flags that are updated based on
the result of operations. The key flags include:
o Zero Flag (ZF): Set if the result of an operation is zero.
o Sign Flag (SF): Set if the result is negative.
o Carry Flag (CF): Set if there is a carry or borrow.
o Overflow Flag (OF): Set if there is an overflow in signed arithmetic.
o Parity Flag (PF): Set if the result has an even number of 1 bits.
o Auxiliary Carry Flag (AF): Used in BCD arithmetic.
1. Pipelining: The 8086 uses pipelining by pre-fetching instructions while the current
instruction is being executed. This allows the processor to improve execution speed.
2. 16-bit Processing: It can process 16-bit data at a time, making it faster than 8-bit processors
like the 8085.
3. 1 MB Memory Access: With its 20-bit address bus, the 8086 can address up to 1 MB of
memory.
4. Multipurpose Registers: General-purpose registers can be used for various functions, making
programming flexible.
5. Segmentation: Memory is divided into segments (code, data, stack, extra), which helps in
organizing large programs efficiently.
The 8086 microprocessor supports several types of addressing modes. These are classified
broadly into Data Addressing Modes, Program Memory Addressing Modes, and Stack
Memory Addressing Modes. Each category has specific modes to handle various types of
data access.
These modes are used to access instructions and are typically used for control flow changes
like jumps, calls, and loops.
Direct Program Memory Addressing Mode: The instruction specifies the full
address of the next instruction.
o Example: JMP 1234H (jumps to the instruction at memory location 1234H).
Relative Program Memory Addressing Mode: The address is given relative to the
current instruction pointer (IP).
o Example: JMP SHORT +10H (jumps to a location 10 bytes ahead of the current
IP).
Indirect Program Memory Addressing Mode: The jump address is stored in a
register or memory location.
o Example: JMP [BX] (jumps to the address stored in BX).
These modes deal with data stored on the stack, primarily used in function calls and interrupt
handling.
PUSH and POP Instructions: Data is pushed onto or popped from the stack. The
stack pointer (SP) is used to keep track of the top of the stack.
o Example: PUSH AX (pushes the contents of AX onto the stack), POP AX (pops
the top value from the stack into AX).
In the 8086 microprocessor, the register addressing mode is one of the most common ways
to access data. In this mode, data is transferred directly between registers, or operations are
performed using registers as operands. The source and destination operands can both be
registers, and no memory access is needed, making this mode fast and efficient.
Key Characteristics:
Types of Registers:
8-bit Registers: AH, AL, BH, BL, CH, CL, DH, DL.
16-bit Registers: AX, BX, CX, DX, SP, BP, SI, DI.
Segment Registers: CS (Code Segment), DS (Data Segment), SS (Stack Segment), ES (Extra
Segment).
Example of Register Addressing Mode:
MOV AX, BX: The contents of register BX are copied into register AX. Both are 16-bit
registers.
ADD AX, CX: Adds the value of register CX to AX, and the result is stored in AX.
XOR DX, CX: Performs a bitwise XOR between DX and CX. The result is stored in DX.
1. Speed: Since the data resides in registers, the processor doesn’t need to access memory,
leading to faster operations.
2. Simple Instructions: The instructions are shorter because the operands are registers, not
memory addresses.
Limitations:
1. Limited Storage: The size of the registers is limited, so only a small amount of data can be
held in registers at any given time.
2. Register Constraints: The number of available registers is limited, and not all registers can be
used for every operation.
Program memory addressing modes are used to determine how the processor accesses
instructions stored in memory. These modes specify how to locate the next instruction to be
fetched and executed. In microprocessors like the 8086, there are three primary types of
program memory addressing modes:
In this mode, the address of the instruction or data to be accessed is explicitly provided as
part of the instruction itself.
The memory address is stored along with the opcode, which makes it easy for the processor
to jump to or call the specific memory location.
Example:
JMP 1000H — This instruction tells the processor to jump directly to memory location
1000H for the next instruction.
Usage: This type of addressing is typically used in long jumps or far calls where the
full address is required. In a long jump, the instruction provides a 16-bit address.
In relative addressing mode, the address of the target instruction is specified relative to the
current value of the instruction pointer (IP).
Instead of giving a full address, a displacement (offset) is provided. The displacement is
added to the current IP to calculate the address of the next instruction.
Example:
JMP SHORT +05H — This instruction makes the processor jump to a location that is 5
bytes ahead of the current instruction pointer value.
Usage: This is used in conditional jumps and loops within a short range. It's efficient
because it doesn't need the full address, just the relative offset.
In indirect addressing, the memory address is not explicitly stated in the instruction. Instead,
it is stored in a register, or memory location, which is then accessed to determine the target
address.
The instruction contains the reference to a register or memory location that holds the
address of the next instruction.
Example:
JMP [BX] — This instruction tells the processor to jump to the memory location
stored in the BX register.
Usage: This is commonly used for subroutines or interrupt handling where the
jump addresses are stored in specific locations and retrieved when needed.
6. Explain about 8051 microcontroller and compare microcontroller and microprocessor
ANS:
The 8051 microcontroller was first introduced by Intel in 1981 and quickly became
one of the most widely used microcontrollers in embedded systems. It's known for being
highly versatile, with applications in various fields like robotics, automotive control,
consumer electronics, and more.
1. 8-bit Architecture: It processes 8-bit data at a time, meaning it can handle 8 bits of
data in one operation.
2. On-chip Memory:
o 4 KB ROM (Program Memory): This is used to store the program code.
o 128 bytes of RAM (Data Memory): For storing temporary data.
3. Data Bus and Address Bus:
o 8-bit Data Bus: Used for carrying data.
o 16-bit Address Bus: Used to address 64KB of memory.
4. I/O Ports: It has four 8-bit I/O ports which can be configured as input or output.
5. Timers: It has two 16-bit timers, which are used for generating time delays or as
counters.
6. Instruction Cycle: The instruction cycle is 1 microsecond when using a 12 MHz
clock crystal.
7. Interrupts: It supports 5 interrupts, allowing the microcontroller to pause the current
task and address an urgent need (like an external input).
8. Serial Communication: Supports serial communication using UART (Universal
Asynchronous Receiver-Transmitter).
9.
Description: The MVI instruction is used to load an 8-bit immediate value into a
register or memory location.
Operation: Copies an 8-bit immediate data value into a specified register or memory.
o For example:
MVI A, 25H moves the value 25H into the accumulator (A register).
MVI B, 0AH moves 0AH into the B register.
Effect on Flags: It does not affect any flags.
PUSH:
o Description: The PUSH instruction stores the contents of a register pair or
segment register onto the stack.
o Operation: Decreases the stack pointer (SP) by 2 and stores the data from the
specified register or memory onto the stack.
For example:
PUSH AX stores the value in the AX register onto the stack.
Stack pointer decreases by 2 because the data is stored in two
consecutive memory locations (since the stack works on a 16-bit
register).
o Effect on Flags: Does not affect any flags.
POP:
o Description: The POP instruction retrieves the data from the stack and stores
it back into a specified register or memory location.
o Operation: Copies data from the stack to the specified register or memory
location and then increases the stack pointer (SP) by 2.
For example:
POP AX restores the value from the stack back into the AX
register.
o Effect on Flags: Does not affect any flags.
7. Write down the 8085 programs of addition and subtraction of two 8-bit numbers
ANS: Program:
Explanation:
o MVI A, 25H: Loads 25H (first number) into the accumulator.
o MVI B, 15H: Loads 15H (second number) into register B.
o ADD B: Adds the contents of register B to accumulator A.
o The result is stored in the accumulator (A).
o HLT: Ends the program.
Program:
MVI A, 30H ; Load the first number (30H) into accumulator A
MVI B, 10H ; Load the second number (10H) into register B
SUB B ; Subtract the contents of register B from accumulator A (A
= A - B)
HLT ; Halt the program
Explanation:
o MVI A, 30H: Loads 30H (first number) into the accumulator.
o MVI B, 10H: Loads 10H (second number) into register B.
o SUB B: Subtracts the contents of register B from accumulator A.
o The result is stored in the accumulator (A).
o HLT: Ends the program.
Notes:
8.