Microprocessor (CT and Semester)
Microprocessor (CT and Semester)
CT1
Here is the full answer sheet for your Class Test-01:
1. Define Machine Cycle, Instruction Cycle, Fetch and Execute Cycle (Marks: 05)
Machine Cycle: A machine cycle is the basic operation cycle of the microprocessor to
execute a single operation like reading from memory, writing to memory, fetching an
instruction, or executing an instruction.
Instruction Cycle: It is the time required to fetch and execute a complete instruction. It
consists of one or more machine cycles.
Fetch Cycle: The fetch cycle is the part of the instruction cycle where the microprocessor
fetches the instruction from memory.
Execute Cycle: The execute cycle is the part where the control unit interprets the
instruction and performs the required operation.
2. Determine the Addressing Modes for the Following Instructions (Marks: 10)
1|Page
o 13699H = 53H
4. Give the contents of the flag register after execution of addition 65D1H + 2359H
(Marks: 05)
Let’s add:
65D1H
+ 2359H
--------
892AH
Flags Summary:
CF = 0
ZF = 0
SF = 1
OF = 0
AF = 1
PF = 1
CT2
1. Why Are Interrupts Important?
2|Page
Interrupts are essential in microprocessor systems because they allow the processor to respond to
real-time events efficiently without continuously checking the status of all devices (polling).
Interrupts make the system more responsive and help to manage tasks asynchronously, enabling
the CPU to focus on processing tasks instead of being dedicated to I/O operations.
1. Interrupt Request (IRQ): An external device sends an interrupt request signal (IRQ) to
the microprocessor.
2. Interrupt Acknowledge (IAK): The microprocessor acknowledges the interrupt request.
3. Context Saving: The processor saves the current context (e.g., registers, program
counter) onto the stack.
4. Interrupt Service Routine (ISR): The processor jumps to the interrupt service routine
(ISR) associated with the interrupt.
5. ISR Execution: The ISR handles the interrupt (e.g., reading data, performing a specific
task).
6. Context Restoration: After the ISR completes, the processor restores the saved context
(registers, program counter).
7. Return from Interrupt: The processor returns to the previous instruction in the main
program.
XLAT (Translate):
o Purpose: Used to translate a byte from the AL register using a lookup table.
3|Page
o Usage: XLAT replaces the value in AL with the byte at the memory location [BX +
AL].
o Example: If BX = 1000h and AL = 05h, XLAT would replace AL with the byte
from memory location 1005h.
PUSH:
o Purpose: Pushes a register or memory value onto the stack.
o Usage: PUSH <operand>
o Example: PUSH AX will store the value of AX on the stack.
POP:
oPurpose: Pops a value from the stack into a register or memory.
oUsage: POP <operand>
oExample: POP BX will load the value from the top of the stack into the BX
register.
XCHG (Exchange):
o Purpose: Exchanges the contents of two registers or a register with a memory
location.
o Usage: XCHG <operand1>, <operand2>
o Example: XCHG AX, BX exchanges the values of AX and BX.
+-----------------+
| Processor |
| (CPU) |
+-----------------+
|
+--------+--------+
| |
+-----------+ +-----------+
| DMA Controller| | I/O Device|
+-----------+ +-----------+
| |
+------+ +-------+
| Memory| | Memory|
| Block | | Block |
+------+ +-------+
4|Page
2. Request: When an I/O device (e.g., a disk or keyboard) needs to transfer data to/from
memory, it sends a DMA request signal to the DMA controller.
3. CPU: The processor relinquishes control of the system bus to the DMA controller after
checking if the bus is available.
4. Data Transfer: The DMA controller directly transfers data between the I/O device and
memory. This frees the CPU to perform other tasks while data transfer occurs in the
background.
5. Interrupt: After the data transfer is completed, the DMA controller sends an interrupt to
the CPU to signal the completion of the operation.
In summary, DMA improves system efficiency by allowing data transfer to occur directly
between memory and I/O devices, without continuous CPU intervention. This allows the CPU to
focus on other tasks while data is being transferred.
SESSION 2020-21
Sure! Here's a more detailed explanation for each question of your Class Test-1
(Microprocessor) on the 8086 microprocessor, with proper headings and clear formatting:
CT
1. Write down and briefly describe the steps to initialize an 8254 Programmable
Peripheral Device with the control word format.
Marks: 5 + 5
The Intel 8254 is a programmable timer/counter chip with three independent 16-bit counters.
Each counter can be programmed for various modes like delay generation, frequency division, or
event counting.
5|Page
1. Select the counter (Counter 0, 1, or 2).
2. Set the mode (e.g., mode 0: interrupt on terminal count, mode 2: rate generator, etc.).
3. Choose read/load format (e.g., LSB only, MSB only, or LSB followed by MSB).
4. Write the control word to the Control Register.
5. Load the initial count value into the selected counter.
D7 D6 D5 D4 D3 D2 D1 D0
SC1 SC0 RW1 RW0 M2 M1 M0 BCD
These define how a peripheral device is accessed via memory or I/O. Two main types:
1. Memory-Mapped I/O:
o Devices treated like memory locations.
o Full memory instructions (e.g., MOV, ADD) can be used.
o Higher memory address range usage.
2. Isolated I/O (I/O Mapped I/O):
o Separate I/O address space (using IN and OUT instructions).
o Needs special control signals (like IO/M).
o Limited to 256 input and 256 output ports (8-bit address).
6|Page
So, control jumps to memory address 0008H–000BH (holds CS:IP of ISR).
Marks: 3½
+------------------------------+
| Current Instruction |
+------------------------------+
↓
Push FLAGS to Stack
↓
Clear IF and TF
↓
Push CS to Stack
↓
Push IP to Stack
↓
Load CS:IP from vector table (INT n * 4)
↓
Jump to ISR
4. Suppose that while the 8086 is executing the IR4 service routine, an interrupt
signal arrives at IR7 input pin of 8259A. Now illustrate the response of 8259A
with a diagram.
Marks: 3½
7|Page
8259A receives interrupt on IR7 while servicing IR4.
If priority is fixed: IR7 > IR4, so it waits (IR7 is pending).
If priority is rotating or auto EOI, it may accept IR7.
After IR4 ISR finishes and EOI (End of Interrupt) is issued, IR7 is processed.
Would you like a diagram showing IR7 arriving during IR4? I can generate it for better
understanding.
Summary
Would you like this entire content as a downloadable, printable PDF with proper formatting
and diagrams included?
Or should I send visual diagrams separately now?
Thanks for your clarification! Here's the updated and improved version of the answers based
on your modified questions:
1. Clearly explain the sequence of operations that take place for data transfer in
non-burst and burst mode.
Sequence:
8|Page
4. This repeats for each data transfer.
In burst mode, DMA takes control of the system bus and transfers many bytes
continuously.
The CPU is blocked until the entire block is transferred.
It is faster, used for high-speed data transfers.
Sequence:
In Cycle Stealing Mode, the DMA controller pauses the CPU for one clock cycle to
transfer a byte of data.
CPU is not completely stopped — just one cycle is "stolen" per transfer.
It balances CPU work and data transfer.
Real-Life Example:
Like a friend interrupting you for just 1 second to borrow a pen — you continue your work right
after.
The 8237 DMA Controller is used to transfer data between memory and I/O devices
without involving the CPU.
4 DMA Channels
Address Register (per channel)
Word Count Register (per channel)
Command Register
Request & Mask Registers
Status Register
9|Page
Data Bus Buffer
Control Logic
Would you like me to provide a ready-to-use diagram image of the 8237? I can generate
that.
4. Briefly describe the differences between an I/O channel and an I/O processor.
Summary:
The DMA controller has several working cycles. Two common ones are:
a) Read Cycle:
b) Write Cycle:
10 | P a g e
Sets MEMW or IOW low and sends data.
Would you like this full answer as a well-formatted PDF with a diagram of the 8237 DMA
controller included?
Thanks for pointing that out! Below is the corrected answer for addressing modes of the 8086
microprocessor, with clear definitions and examples.
Example:
Example:
11 | P a g e
The instruction contains the memory address directly.
Effective when accessing fixed memory locations.
Example:
The address of the operand is in a register (like BX, SI, DI, BP).
More flexible than direct addressing.
Example:
Example:
Example:
Example:
12 | P a g e
MOV AX, [BX + SI] ; Load AX from address = BX + SI
Example:
These addressing modes allow the 8086 to access data from registers, memory, and
immediate values efficiently, supporting both simple and complex data structures.
Would you like a clean PDF version of all the answers (including 8237 block diagram and these
addressing modes)?
SEMESTER
Here’s a clear and simple explanation of the requested topics from the 8086 microprocessor
syllabus:
S1 S0 Operation
0 0 Interrupt Acknowledge
0 1 Read
1 0 Write
1 1 Passive (No operation)
13 | P a g e
S3 and S4 (Segment Select Lines)
S4 S3 Segment Register
0 0 Extra Segment (ES)
0 1 Stack Segment (SS)
1 0 Code Segment (CS)
1 1 Data Segment (DS)
8086 has a 16-bit data bus, but memory is organized in bytes (8-bit).
So memory is divided into two banks:
o Even Bank: Lower byte (D0–D7)
o Odd Bank: Upper byte (D8–D15)
Bank selection is done using:
o A0 (Address line): decides odd/even
o BHE (Bus High Enable): enables upper byte
Why it matters: Allows the 8086 to access 16-bit data in one cycle if aligned properly.
14 | P a g e
(ii) Instruction Queue
8086 uses segmentation to divide memory into logical blocks, each 64 KB.
Four main segments:
o Code Segment (CS) – for instructions
o Data Segment (DS) – for data
o Stack Segment (SS) – for stack
o Extra Segment (ES) – for extra data/string operations
Segmentation allows accessing 1 MB memory using 16-bit registers by combining
segment:offset.
Example:
Would you like this in PDF format with diagrams for segmentation and memory banking?
Here is a clear and simplified explanation for each question you asked:
1. Write down and briefly describe all the steps to initialize an 8254
Programmable Peripheral Device with the control word format
Steps:
15 | P a g e
| D7 D6 | D5 D4 D3 | D2 D1 | D0 |
| SC | RW | M | BCD|
2. Explain the "Hardware Retriggerable One Shot" mode of 8254 counter and its
application
How it works:
Applications:
Given:
16 | P a g e
Counter: 0 (SC = 00)
Read/Write: LSB+MSB (RW = 11)
Mode: 3 (M = 011)
BCD: 0 (binary)
Step 3: Initialization
8086 has 8 general-purpose registers, each 16-bit, and can be accessed as two 8-bit registers.
Register Function
AX Accumulator for arithmetic, logic, and I/O operations
BX Base register (used in memory addressing)
CX Count register (used in loops and shifts)
DX Data register (used in multiplication and division)
SI Source Index (used in string operations)
DI Destination Index (used in string operations)
BP Base Pointer (used to access stack data)
SP Stack Pointer (points to top of stack)
Formula:
Example:
17 | P a g e
If:
Segment = 1234H
Offset = 0020H
Then:
What is Interfacing?
Types:
Example:
Certainly! Here's the question followed by the full answer with clear explanation and values:
18 | P a g e
Question:
Suppose that you want to use counter 0 of the 8254 to produce a stable 78.6 KHz square
wave signal for a UART clock by dividing down the 2.45 MHz PCLK signal available on
the SDK-86 board. Now write down the complete control word and describe it.
Answer:
To generate a 78.6 KHz square wave from a 2.45 MHz clock using Counter 0 of the 8254
Programmable Interval Timer, we need to follow these steps:
We use Mode 3 (Square Wave Generator) because it produces a continuous square wave with
50% duty cycle, ideal for UART timing.
| D7 D6 | D5 D4 | D3 D2 D1 | D0 |
| SC | RW | Mode | BCD|
19 | P a g e
Field Value Explanation
BCD 0 Binary counting mode (not BCD)
Assuming:
Write Sequence:
Summary Table
What Happens?
The 8254 Timer now divides the 2.45 MHz clock by 32.
Output of Counter 0 becomes:
Note: If exact 78.6 KHz is needed, then Count ≈ 31, but that gives less symmetry. Using 32
ensures a stable square wave for UART even if slightly under 78.6 KHz.
20 | P a g e
Would you like me to include this in a print-ready PDF or add a labeled diagram of the 8254 and
waveform?
Question:
1. What is addressing mode? Determine the addressing modes for the following
instructions:
o MOV CH, 8
o MOV AX, DS:START
o MOV [SI], AL
2. Describe memory segmentation. What are the advantages of using a segmented
memory scheme?
3. Describe how the cascading of multiple 8259A controllers can extend the number of
interrupt lines.
Answer:
Addressing mode is the way in which an instruction accesses the data (operand) that it needs to
work with. The addressing mode defines how the effective address of an operand is calculated.
i) MOV CH, 8
21 | P a g e
Explanation: Here, the data in register AL is moved into the memory location pointed to
by the SI (Source Index) register. The SI register holds the memory offset and is used as
an index to calculate the effective address of the operand.
2. Memory Segmentation
Memory Segmentation refers to the way memory is divided into smaller, manageable segments,
such as code, data, stack, and extra. Each segment has its own base address, and a segment
register points to the starting address of that segment.
In segmented memory, the CPU uses segment registers like CS (Code Segment), DS (Data
Segment), SS (Stack Segment), and ES (Extra Segment) to access different parts of
memory.
Each segment can address a specific portion of memory, which is useful for organizing
and protecting memory in large programs.
The 8259A Programmable Interrupt Controller (PIC) can handle up to 8 interrupt lines.
However, in a system with more than 8 interrupt lines, multiple 8259A controllers can be
cascaded together to extend the number of interrupt lines.
A master 8259A PIC controls the primary interrupt lines (IR0-IR7), and it can be
connected to one or more slave 8259A controllers.
The slave controllers can handle additional interrupt lines (IR8-IR15, IR16-IR23, etc.).
The master PIC controls the flow of interrupt requests from the slave controllers.
22 | P a g e
A cascade wire (INTA) is used to pass interrupt requests from the slave controller to the
master controller.
1. Increases the Number of Interrupt Lines: Cascading allows systems to support more
than 8 interrupt lines, as each slave 8259A can add 8 more interrupt lines.
2. Efficient Management of Interrupts: The master controller can prioritize interrupts and
pass them to the CPU in a managed way, even from multiple slave controllers.
3. Scalability: This method is scalable; as many as 8 slave controllers can be added to
extend the interrupt line count to 64 interrupt requests.
Summary
1. Addressing Modes:
o MOV CH, 8 → Immediate Addressing
o MOV AX, DS:START → Segmented Addressing
o MOV [SI], AL → Indexed Addressing
2. Memory Segmentation:
o Divides memory into logical segments like code, data, and stack.
o Advantages include efficient memory use, modularity, protection, and easier
memory management.
3. Cascading 8259A Controllers:
o Cascading allows extending interrupt lines beyond 8 by connecting slave
controllers to a master controller.
o It increases the number of interrupt lines and provides efficient interrupt
management.
Question:
1. What is an Interrupt? Draw the internal block diagram of 8259A Priority Interrupt
Controller.
2. If an interrupt has been requested, the 8086 responds to the interrupt by stepping
through some series of major actions. Now summarize those steps with necessary
diagrams.
3. Suppose that while the 8086 executes the IR4 service procedure, an interrupt signal
arrives at the IR7 input of the 8259A. Now illustrate the response of 8259A with a
program flow diagram.
4. What are the advantages and disadvantages of DMA mode?
5. What is Cycle Stealing mode?
6. Distinguish between I/O channels and I/O processors.
7. Describe the DMA operation with a block diagram.
23 | P a g e
Answer:
1. What is an Interrupt?
An interrupt is a mechanism by which a CPU can temporarily halt its current execution to
address an external or internal event (like input from a keyboard, a timer, or an error condition).
After addressing the interrupt, the CPU resumes its previous execution. Interrupts allow efficient
CPU time management by handling asynchronous events.
+--------------------+
| Data Bus Buffer |
+--------------------+
|
+--------------------+ +---------------------+
| Interrupt Logic | <--> | Priority Encoder |
+--------------------+ +---------------------+
| |
+------------------+ +---------------+
| Mask Register | | Interrupt Request|
+------------------+ +---------------+
When the 8086 microprocessor receives an interrupt request, it follows these steps to handle the
interrupt:
Steps:
24 | P a g e
1. Interrupt Acknowledgement: The 8086 acknowledges the interrupt request by sending
a signal to the 8259A.
2. Save CPU Context: The 8086 saves the current program counter (PC) and the status
flags in memory.
3. Vectoring to Interrupt Handler: Based on the interrupt number, the 8086 reads the
interrupt vector (address of the interrupt service routine) from the interrupt vector table.
4. Interrupt Service Routine (ISR): The 8086 starts executing the interrupt service routine
at the determined vector address.
5. Restore CPU Context: After the ISR completes, the 8086 restores the previous CPU
context (program counter and flags).
6. Resume Normal Execution: The 8086 resumes normal execution from where it was
interrupted.
+---------------------+ +----------------------+
| Interrupt Request | ---> | Save CPU Context |
+---------------------+ +----------------------+
|
v
+------------------------+
| Interrupt Vector Table |
+------------------------+
|
v
+-------------------------+
| Execute ISR (Interrupt Service Routine) |
+-------------------------+
|
v
+-------------------------+
| Restore CPU Context |
+-------------------------+
|
v
+-------------------------+
| Resume Normal Execution |
+-------------------------+
When the 8086 is executing an interrupt service routine (ISR) for IR4, and a new interrupt
request comes at IR7, the 8259A handles it as follows:
1. Interrupt Service Routine for IR4: The 8086 is executing the ISR for IR4.
2. Interrupt Request at IR7: IR7 is asserted, requesting a new interrupt.
3. IR7 Prioritization: The 8259A gives priority to IR7 because it has a higher priority than
IR4.
25 | P a g e
4. Interrupt Acknowledgment: The 8259A acknowledges the IR7 interrupt and triggers
the 8086 to begin processing the new interrupt.
+------------------------+
| Execute ISR for IR4 |
+------------------------+
|
v
+------------------------+
| Interrupt Request at IR7 |
+------------------------+
|
v
+------------------------+
| 8259A Prioritizes IR7 |
+------------------------+
|
v
+------------------------+
| Acknowledge IR7 Interrupt |
+------------------------+
|
v
+------------------------+
| Execute ISR for IR7 |
+------------------------+
DMA (Direct Memory Access) mode allows peripherals to directly transfer data to/from
memory without involving the CPU.
Advantages:
Faster Data Transfer: DMA allows high-speed data transfers without CPU intervention.
CPU Efficiency: The CPU is free to perform other tasks while data transfer occurs in the
background.
Reduced CPU Load: Since DMA handles data transfer directly, it reduces the load on
the CPU.
Disadvantages:
26 | P a g e
6. What is Cycle Stealing Mode?
Cycle Stealing Mode is a type of DMA operation where the DMA controller temporarily takes
control of the system bus to transfer a byte of data to/from memory. After one data cycle is
completed, control is returned to the CPU, allowing the CPU to resume its execution until the
next cycle is "stolen."
I/O Channels: Dedicated hardware in a system that handles data transfers between I/O
devices and memory. It is typically used to handle bulk data transfer between devices.
I/O Processors: More sophisticated processors that manage and control I/O operations,
performing tasks such as error checking and managing multiple devices. I/O processors
are usually programmable.
DMA Operation:
Summary
27 | P a g e
Interrupt: A mechanism to handle asynchronous events.
8259A: Prioritizes and manages interrupts from multiple sources.
Interrupt Handling: Involves saving CPU context, executing ISR, and restoring context.
DMA: Enables direct data transfer between devices and memory without CPU
involvement, with cycle stealing mode allowing partial CPU control.
I/O Channels vs I/O Processors: Channels handle data transfers, while processors
manage and control I/O operations.
Questions:
Answers:
The auto-initialization facility in a DMA (Direct Memory Access) controller allows the
controller to automatically reset and restart a data transfer after completing the current transfer.
This means that once a data transfer is completed, the DMA controller will automatically reload
the source and destination addresses (for continuous transfers) without requiring further
intervention from the CPU. This is useful for tasks that involve repetitive data transfers, such as
moving blocks of data from memory to I/O devices or vice versa.
How it works:
When auto-initialization is enabled, after each transfer, the DMA controller automatically
reloads its control register (source, destination, count) to continue the operation.
Example:
It is commonly used in applications like audio or video data transfer, where continuous
data movement is needed.
28 | P a g e
Advantages of DMA mode:
Faster Data Transfer: DMA allows peripherals to transfer data directly to/from memory
without involving the CPU, which speeds up the process significantly.
CPU Efficiency: The CPU can perform other tasks while DMA handles the data transfer.
Reduced CPU Load: DMA reduces the need for the CPU to manage data transfer,
freeing it up for other computations.
Hardware Complexity: The system requires extra hardware, the DMA controller, which
adds to the system complexity.
Potential Resource Conflicts: Multiple DMA controllers or devices can compete for
access to the system bus, which could cause delays or conflicts.
Overhead in Configuration: Setting up and configuring DMA transfers requires special
handling in the software and controller configuration.
DMA (Direct Memory Access) Operation allows data to be transferred directly between
memory and peripheral devices without involving the CPU.
Block Diagram:
29 | P a g e
DMA Request Signal: Initiated by an I/O device to request data transfer.
DMA Controller: Manages the data transfer between memory and I/O devices.
Bus Arbitration: The controller checks if the system bus is available and then accesses
the bus.
Data Transfer: Direct data movement between memory and I/O device, bypassing the
CPU.
4. If DMA and all are reactive, then mention what is the bus access priority
structure.
In systems with DMA and multiple peripherals that require bus access, there needs to be a bus
access priority structure to determine which device can access the system bus at any given
time.
Fixed Priority: A priority scheme where each device has a fixed priority. For example,
the DMA controller may always have higher priority over other I/O devices.
Rotating Priority: The priority rotates among the devices, so each device gets a turn to
access the bus in a round-robin manner.
Dynamic Priority: The priority is determined based on certain conditions like urgency,
with DMA having higher priority when performing critical operations.
5. Define register.
A register is a small, fast storage location in the processor used to store data that is being
processed or temporarily held during operations. Registers are integral to the CPU's function and
can store:
General-purpose registers: Used for general data manipulation (e.g., AX, BX, CX in
x86 architecture).
Special-purpose registers: Such as the program counter (PC), stack pointer (SP), etc.
Status registers: Used to store flags or status information (e.g., Zero Flag, Carry Flag).
30 | P a g e
6. Write down the significance of the queue in the 8086 microprocessor.
In the 8086 microprocessor, the instruction queue plays a significant role in improving the
efficiency of instruction fetch operations.
Prefetching Instructions: The 8086 has a 6-byte instruction queue that allows it to
prefetch the next instructions while executing the current ones. This enables faster
processing as the CPU can fetch instructions ahead of time.
Pipeline Effect: By overlapping instruction fetch and execution, the queue helps achieve
a pipeline effect, reducing instruction latency.
Improved Performance: The instruction queue allows the 8086 to fetch the next set of
instructions while executing the current one, leading to faster execution of programs.
Sure! Here's a complete answer to your question written in a simple and easy-to-understand way:
Question:
Describe the minimum mode pin functions of 8086. Draw the internal architecture of 8086
microprocessor.
Answer:
31 | P a g e
The 8086 microprocessor can work in two modes:
In Minimum Mode, the 8086 acts as the only processor in the system. Some pins have special
functions in this mode. These are:
These pins help 8086 to communicate with memory, I/O devices, and control data flow.
Summary:
Would you like a clean, labeled diagram image of the 8086 architecture as well?
33 | P a g e
Let’s answer it along with question 4 where you ask to distinguish between 8253 and 8254
counters.
2. Explain Distance
This question is unclear as written. If you meant "Explain serial data transmission over a long
distance", that is already addressed in question 5. If you meant something else, please clarify.
+--------------------------+
| Data Bus Buffer |
+--------------------------+
|
+--------------------------+
| Read/Write Logic |
+--------------------------+
|
+--------------------------+
| Control Logic |
+--------------------------+
/ | \
/ | \
+---------+ +---------+ +---------+
| Group A | | Group B | | Control |
| (Port A) | | (Port B) | | Register|
+---------+ +---------+ +---------+
| | |
+---------+ +---------+ +---------+
| Port A | | Port B | | Port C |
+---------+ +---------+ +---------+
Explanation:
34 | P a g e
Feature 8253 8254
Technology NMOS HMOS (more power efficient)
No. of Counters 3 3
Clock Frequency Up to 2.6 MHz Up to 10 MHz
Read/Write Can't read counter while counting Can read current count on-the-fly
Binary/BCD Only Binary Counting Binary and BCD Counting supported
Compatibility Older systems Improved and compatible with 8253
RS-232 Protocol:
RS-232 is a serial communication standard used to connect computers and devices like
modems.
How It Works:
Serial Transmission: Sends data bit by bit using a single wire for transmission (TX) and
one for receiving (RX).
Voltage Levels:
o Logic 1 = –3V to –15V
o Logic 0 = +3V to +15V
(Opposite of typical logic levels)
Start Bit: Marks the beginning of a byte.
Data Bits: Usually 7 or 8 bits.
Parity Bit (Optional): Used for error checking.
Stop Bit(s): Marks the end of data.
35 | P a g e
Let me know if you'd like neat diagram images for the 8255 block diagram or RS-232
communication—I can provide those!
Let’s answer each part of your question in a clear and simple way:
You are asking to check Hamming Code (for single error detection and correction).
Position 1 2 3 4 5 6 7 8 9 10
Bit 0110010010
Others are data bits: positions 3, 5, 6, 7, 9, 10 → D3, D5, D6, D7, D9, D10
P1 checks bits: 1, 3, 5, 7, 9
→ Bits: 0, 1, 0, 0, 1 → sum = 2 (Even) → P1 OK
P2 checks: 2, 3, 6, 7, 10
→ Bits: 1, 1, 1, 0, 0 → sum = 3 (Odd) → P2 ERROR
P4 checks: 4, 5, 6, 7
→ Bits: 0, 0, 1, 0 → sum = 1 (Odd) → P4 ERROR
P8 checks: 8, 9, 10
→ Bits: 0, 1, 0 → sum = 1 (Odd) → P8 ERROR
36 | P a g e
But we only have 10 bits! So this is not possible.
Final Answer:
Explanation:
Harvard architecture uses separate memory for program (instructions) and data.
This allows simultaneous access to instructions and data.
It improves performance in embedded and DSP systems.
+---------------------+
| CPU |
| +-------------+ |
| | Instruction | |
| | Unit |<--- Program Memory
| +-------------+ |
| +-------------+ |
| | Data |<--- Data Memory
| | Unit | |
37 | P a g e
| +-------------+ |
+---------------------+
Explanation:
In 8086, the BIU (Bus Interface Unit) creates Physical Address using:
Example:
Suppose:
o Code Segment (CS) = 2000H
o Instruction Pointer (IP) = 0010H
→ Physical Address = 2000H × 10H + 0010H
→ = 20000H + 0010H
→ = 20010H
Let me know if you’d like a diagram image for Harvard Architecture or want me to recheck
the Hamming Code if you give a corrected codeword.
Definition of Microprocessor:
38 | P a g e
Control operations (data flow between memory and devices)
+---------------------+
| CPU |
| +-----------------+ |
| | Control Unit | |
| +-----------------+ |
| +-----------------+ |
| | ALU (Calculator)| |
| +-----------------+ |
+---------|-----------+
|
+--------+--------+
| Memory |
| (Data + Program)|
+--------|--------+
|
+------+------+
| Input/Output |
+---------------+
39 | P a g e
Here are the key features of the Intel 8086 microprocessor:
1. 16-bit Processor
o It processes 16 bits of data at a time.
2. 20-bit Address Bus
o Can access up to 1 MB (2^20 bytes) of memory.
3. Segmented Memory
o Uses Code, Data, Stack, and Extra Segment registers for dividing memory.
4. Registers
o Has 14 Registers, including general-purpose and segment registers.
5. Clock Speed
o Typically 5 MHz to 10 MHz.
6. Instruction Set
o Supports about 117 instructions for data handling, arithmetic, logic, control, etc.
7. Pipelining
o Has two units:
EU (Execution Unit): Executes instructions
BIU (Bus Interface Unit): Fetches instructions
o Makes it faster through instruction prefetching.
8. Modes of Operation
o Minimum Mode (single processor)
o Maximum Mode (multiprocessor)
9. Hardware Support
o Supports Interrupts, DMA, and external devices.
10. Compatible
Let me know if you'd like a labeled diagram image for Von Neumann Architecture!
In the 8086 microprocessor, there are 8 general-purpose registers. These are used to store
temporary data, perform operations, and manage program execution.
They are 16-bit registers, and some of them can be split into 8-bit parts.
40 | P a g e
General-Purpose Registers:
Explanation:
+-----------------------------+
| 8086 CPU |
+-----------------------------+
| Execution Unit (EU) |
41 | P a g e
| +-----------------------+ |
| | Arithmetic Logic Unit | |
| | Control Unit | |
| | General Registers | |
| +-----------------------+ |
+-------------|---------------+
|
+-------------|---------------+
| Bus Interface Unit (BIU) |
| +--------------------------+ |
| | Instruction Pointer | |
| | Segment Registers | |
| | Instruction Queue (6-byte)| |
+------------------------------+
Let me know if you’d like an image diagram for the 8086 architecture or RISC vs CISC
comparison.
Here’s a clear and easy-to-understand explanation for each part of your question:
Question 1:
What will be the output of the status flags after executing the instruction SUB AX, BX where
AX = FEEFh and BX = 1F8Eh?
42 | P a g e
Step-by-step Explanation:
AX - BX = FEEFh - 1F8Eh = ?
We do subtraction in hexadecimal:
E161h = 57761 (unsigned), but as a signed 16-bit value, it represents a negative number
because the MSB is 1.
E161h = -6783 (signed)
Final Result:
AX = E161h
Status Flags:
o CF = 1
o ZF = 0
o SF = 1
o OF = 0
o PF = 0
o AF = (assume 1 if asked)
43 | P a g e
Question 2:
Suppose that you want to use counter 0 of the 8254 to produce a stable 78.6 KHz square-
wave signal for a UART clock by dividing down the 2.45 MHz PCLK signal available on
the SDK-86 board. Now write down the control word and describe it.
Step-by-step Explanation:
We want:
Bit 7 6 5 4 3 2 1 0
SC1 SC0 RW1 RW0 M2 M1 M0 BCD
For Counter 0, Mode 3, Read/Write LSB then MSB, Binary Mode (not BCD):
44 | P a g e
Summary:
Sure! Let’s answer your questions one by one with simple explanations and proper step-by-
step methods.
Question 1:
Position Bit
13 1
12 0
11 0
10 1
9 1
8 0
7 0
6 1
5 0
45 | P a g e
Position Bit
4 1
3 0
2 1
1 0
46 | P a g e
Result:
Dataword = 10011001
Question 2:
Answer:
In the 8086 microprocessor, the queue is part of the Bus Interface Unit (BIU) and is used for
prefetching instructions.
47 | P a g e
Significance:
In short:
The queue helps 8086 work faster by fetching instructions in advance and reducing idle time of
the execution unit.
Question 3:
Answer:
Key points:
Benefits:
In short:
Memory banking lets the processor access 16-bit data faster by organizing memory into even and
odd byte banks.
48 | P a g e
Would you like these answers in a downloadable PDF format for printing or submission?
Sure! Here's a simple and clear explanation for each of your questions related to the 8259A
Programmable Interrupt Controller.
Question 1:
Describe the use of CAS0, CAS1, and CAS2 lines in a system with cascaded 8259A.
Answer:
In simple words:
CAS0, CAS1, and CAS2 help the master 8259A to select which slave PIC should respond when
an interrupt is acknowledged.
Question 2:
Answer:
1. Send ICW1:
o Tells 8259A that initialization is starting.
o Selects edge/level trigger, cascade/single mode, and ICW4 needed or not.
2. Send ICW2:
o Sets the base address (interrupt vector) of the interrupt (e.g., 08H for master).
3. Send ICW3:
o In master: indicates which IR lines are connected to slaves.
49 | P a g e
o In slave: gives the slave ID (binary value) to be matched with CAS lines.
4. Send ICW4 (if needed):
o Selects 8086/8088 mode, auto EOI, buffered mode, etc.
5. Send Operation Command Words (OCWs) after initialization for controlling masks
and priorities.
Question 3:
Describe the response that an 8259A will make if it is servicing an IR4 interrupt and an
IR2 interrupt signal occurs at the same time. Assume fixed priority for the IR inputs. Also
draw the response diagram.
Answer:
In fixed priority mode, IR0 has the highest priority, and IR7 has the lowest.
Here, IR4 is being serviced (lower priority than IR2), and IR2 occurs at the same time
(higher priority).
Step-by-step response:
In simple terms:
The 8259A will wait until IR4 is completed, then immediately service IR2, because IR2 has a
higher fixed priority.
IR4: ──────────────┐
└────(Service completed)────┐
│
IR2: ────────┐ │
└──────────────────────────►│
(Now IR2 is serviced)
50 | P a g e
Would you like this full answer in a nicely formatted downloadable PDF?
Sure! Here's a full answer with clear, simple explanations for each of your questions related to
8085 microprocessor and interrupts, including diagram.
Answer:
An interrupt is a signal that temporarily stops the CPU's current task and jumps to a special
routine (ISR) to respond to an important event (e.g., keyboard input, timer, I/O).
Purpose of Interrupt:
51 | P a g e
Question 2: What is the difference between maskable and non-maskable
interrupt?
In simple terms:
SID and SOD are used for serial communication — one bit at a time.
52 | P a g e
1. Power Supply & Clock Signals:
Vcc: +5V
Vss: Ground
X1, X2: Crystal oscillator connections (6 MHz typical)
CLK (OUT): Provides system clock to other devices
4. Interrupt Signals:
53 | P a g e
READY: Wait signal for slow devices
RESET IN / RESET OUT: To reset the microprocessor
IO/M̅, S1, S0: Timing and control
In summary: The 8085 microprocessor uses its 40 pins to manage power, data, control,
interrupts, serial communication, and timing.
Would you like this full explanation (including diagram) as a PDF for printing or class
submission?
Here are the answers to your questions with easy explanations and clear formatting. Each
question is answered separately for clarity.
DMA (Direct Memory Access) allows peripherals to access memory without CPU
involvement.
Steps:
Purpose: Speeds up data transfer and frees CPU for other tasks.
Simple input/output.
No handshake signals.
Ports A, B, C are used as simple I/O lines.
Memory Interface:
Uses:
o Address Bus to select memory location.
o Data Bus to read/write data.
o Control Lines (RD, WR, etc.) to manage operations.
I/O Interface:
Uses either:
o Memory-Mapped I/O: I/O devices are treated like memory.
o I/O-Mapped I/O (Isolated I/O): Separate address space.
Register Function
Interrupt Request Register
Holds all pending interrupts that are waiting to be serviced.
(IRR)
In-Service Register (ISR) Keeps track of which interrupt is currently being serviced.
Interrupt Mask Register Used to mask (disable) specific interrupt lines so they are
(IMR) ignored.
55 | P a g e
Flash ROM:
Shadow ROM:
Technique where BIOS contents from ROM are copied into RAM during boot.
Speeds up access because RAM is faster than ROM.
56 | P a g e
Would you like a PDF version of all these answers with diagrams included for study or
assignment submission?
SESSION 2019-20
CT
Here are the answers to your questions, clearly explained in simple language with each
question mentioned.
Definition of Microprocessor:
A microprocessor is an electronic chip that performs all arithmetic and logic operations of a
computer. It is the central processing unit (CPU) on a single integrated circuit (IC).
1. Bus Interface Unit (BIU) – handles address generation, instruction fetching, and
memory access.
2. Execution Unit (EU) – executes instructions using ALU, registers, and control logic.
57 | P a g e
3. Write Short Note on 4-bit and 32-bit Microprocessor
4-bit Microprocessor:
o Processes 4 bits at a time.
o Used in simple devices like calculators.
o Example: Intel 4004.
32-bit Microprocessor:
o Processes 32 bits at a time.
o Supports larger memory and faster processing.
o Used in modern computers.
o Example: Intel 80386.
Memory Segmentation:
Why Needed:
Let's now answer the following question again, with the updated value of AX = 1EEFH and BX
= 1F8EH:
Question: Find out and explain what will be the output of the status flags
after executing the instruction ADD AX, BX where AX = 1EEFH and BX = 1F8EH
58 | P a g e
Step 1: Convert to Hex and Add
AX = 1EEFH (hex) = 7919 (decimal)
BX = 1F8EH (hex) = 8078 (decimal)
Final Answer:
Result in AX = 3E7Dh
Status Flags:
o Carry Flag (CF) = 0
o Overflow Flag (OF) = 0
o Zero Flag (ZF) = 0
o Sign Flag (SF) = 0
o Auxiliary Carry (AF) = 1
o Parity Flag (PF) = 1
Let me know if you want a step-by-step binary breakdown or this in PDF format for your
notes.
59 | P a g e
Here are clear and simple answers for your questions, with each question mentioned and
explained step-by-step:
1. Define Pin Diagram. Describe the Minimum Mode Pins of the 8086
Microprocessor
A pin diagram shows the physical layout of all the input and output pins (connections) of a
microprocessor. Each pin has a specific function like providing power, transferring data, or
controlling operations.
8086 operates in minimum mode when it is the only processor in the system. In this mode, it
generates all control signals internally.
These pins help manage data flow, interrupts, and control signals when the microprocessor
works alone.
2. Which Pins Indicate Which Segment Register Is Being Used for Memory
Accesses? Explain.
In 8086, memory is accessed through segment registers (CS, DS, SS, ES). The following pins
indicate which segment register is used:
60 | P a g e
A16/S3 → Indicates Code Segment (CS)
A17/S4 → Indicates Data Segment (DS)
A18/S5 → Used to show Interrupt Enable flag (not directly a segment)
These status lines (S3–S6) help external hardware know which part of memory is being
accessed.
Memory Banking:
Memory banking is a technique used to divide memory into multiple banks (sections),
allowing parallel access to improve speed and efficiency.
The even and odd banks work together to access 16-bit data quickly.
Device Controller:
A device controller is a hardware component that controls a specific I/O device (like a
keyboard, printer, hard disk). It acts as a bridge between the processor and the device.
61 | P a g e
It receives commands from the CPU
Converts them into device-specific signals
Handles interrupts, data buffering, and sometimes DMA
Let me know if you'd like diagrams or a PDF version of this explanation for easy revision.
Here is a clear and simple explanation for each of your questions, with proper headings and easy-
to-understand language:
The read-back feature in the 8254 timer allows the CPU to read the current count value and
status of the timer without stopping it.
It is useful for debugging, synchronizing, or checking how much time remains in a timer
operation.
62 | P a g e
Operation:
Timing Diagram:
CLK: ▄▁▄▁▄▁▄▁▄▁▄▁▄▁▄▁
OUT: ▀▀▀▁▁▁▀▀▀▁▁▁ (Square wave)
Application:
Used to:
Problem:
One 8259A can handle 8 interrupts (IR0–IR7). But if we have more than 8 devices, we need to
expand.
Diagram:
CPU
│
└── Master 8259A
├── IR0 – Device 1
├── IR1 – Device 2
├── IR2 – Slave 8259A
│ ├── IR0 – Device 3
│ ├── IR1 – Device 4
│ └── ...
└── IR3–IR7 – Other devices
63 | P a g e
This supports up to 64 interrupts, but 2 cascaded 8259s give 16 interrupts.
A DMA controller allows direct data transfer between memory and I/O device without
involving the CPU in every byte transfer.
1. Idle Cycle:
o DMA waits for a device to request data transfer.
2. Bus Request Cycle:
o Device sends a request to DMA.
o DMA sends HOLD to CPU asking for bus control.
3. Bus Grant Cycle:
o CPU responds with HLDA (Hold Acknowledge), giving control of address/data
bus.
4. DMA Transfer Cycle:
o DMA sends address and control signals to memory/I/O.
o Transfers data directly (read/write).
5. Completion Cycle:
o After transfer is complete, DMA returns control to CPU.
Timing Diagram:
Let me know if you'd like a PDF, diagram images, or simplified notes for quick revision!
Here are the answers to your questions, explained in a detailed yet simple way:
64 | P a g e
SEMESTER
What is a Microprocessor?
A microprocessor is an integrated circuit (IC) that acts as the central processing unit (CPU) of
a computer or electronic system. It is capable of performing arithmetic operations, logical
operations, data manipulation, and control tasks based on instructions from the software
(programs).
The microprocessor receives input, processes it according to pre-defined instructions, and then
produces output. It’s essentially the "brain" of any computing system, whether in computers,
mobile phones, or embedded systems.
65 | P a g e
Explanation:
In other words, by simply changing the software or program, the microprocessor can perform
different tasks, which makes it a programmable device. For example, the same microprocessor
in a mobile phone can perform various tasks, like running a game, handling calls, or browsing
the internet, depending on the program it is running.
The Intel 8086 microprocessor operates in two modes: Minimum Mode and Maximum Mode.
These modes refer to how the 8086 communicates with the rest of the system and whether it
functions as a single processor or as part of a multiprocessor system.
Mode Description:
o The 8086 acts as the only processor in the system.
o It directly generates the control signals required for memory and I/O operations.
o This mode is used for small systems or simple applications where only one
processor is needed.
Control Signals:
o The 8086 controls the Address Bus, Data Bus, and Control Signals such as
ALE, WR, RD, etc., on its own.
Pins Used to Select Minimum Mode:
o The MN/MX̅ pin is set LOW to select Minimum Mode.
66 | P a g e
Mode Description:
o The 8086 works as a part of a system with multiple processors (master/slave
configuration).
o In this mode, the 8086 relies on a separate controller, such as the 8288 Bus
Controller, to generate the necessary control signals.
o It’s used in larger systems or those requiring multiple processors.
Control Signals:
o The control signals such as ALE, WR, RD, and IORC are controlled by the
8288 Bus Controller.
o The 8086 in Maximum Mode only provides address and data signals and leaves
the generation of control signals to the 8288.
Pins Used to Select Maximum Mode:
o The MN/MX̅ pin is set HIGH to select Maximum Mode.
Summary of Differences:
This concludes your answers with simple and detailed explanations. Let me know if you'd like
diagrams or further clarification!
1. Describe 8086 Bus Activities During a Read Machine Cycle with Timing
Diagram
67 | P a g e
The 8086 microprocessor performs operations using machine cycles. A Read Machine Cycle
occurs when the processor needs to read data from memory or an I/O device. The cycle
involves the following activities:
Timing Diagram:
Clock: |---|---|---|---|---|---|
ALE: |---|-------------------|
Address: A0 A1 A2 A3 ... A19 (Memory Address)
RD̅: -----| |-----|
Data: -------| Data Transfer |
READY Pin:
The READY pin is used to synchronize the processor with slower memory or peripherals.
When READY is low, the processor waits for the slower device to finish before
continuing with the operation.
When READY is high, the processor continues without waiting.
TEST Pin:
The TEST pin is used to pause the processor and check a condition during the execution of
instructions.
68 | P a g e
LOCK Pin:
The LOCK pin is used to lock the bus during certain critical operations (e.g., while reading or
writing to memory).
It prevents other processors or devices from accessing the bus during this time.
It’s typically used in multiprocessor systems to prevent data corruption.
A coprocessor is used to offload specific tasks from the main processor. It helps in increasing
system performance by handling complex or time-consuming operations, such as:
By using a coprocessor, the main processor can focus on its primary tasks, while the coprocessor
takes care of specialized tasks, leading to faster processing and improved overall
performance.
Example:
The 8087 Coprocessor is a floating-point coprocessor used with the 8086 microprocessor. It
is used for advanced mathematical operations, especially for handling floating-point
arithmetic in scientific or engineering applications.
A coprocessor communicates with the main processor through a dedicated bus or control
signals. The main processor sends specific instructions to the coprocessor, which then performs
the operation and returns the result to the main processor.
The 8086 uses a bus interface with the 8087 coprocessor, allowing it to send and
receive data to/from the coprocessor.
Coprocessor instructions are sent via the control bus, and the processor knows when to
wait for results or continue with its own tasks.
69 | P a g e
4. Write an 8086 Assembly Language Program That Will Perform the
Following Operation:
5 * AL - 6 * BH + (BH / 8) -> CX
; Perform 5 * AL
MUL AL ; AL = AL * 5 -> AX (AL is the low byte of AX)
; Subtract 6 * BH
MOV DL, BH ; Copy BH into DL for multiplication
MUL BL ; Multiply AL (AX) by BL (6), result goes to AX
SUB AX, BX ; Subtract the result of 6*BH from AL
; Add (BH / 8)
MOV DL, BH ; Copy BH into DL
DIV 8 ; Divide BH by 8, quotient stored in AL
Explanation:
This program first multiplies AL by 5, then subtracts 6 * BH, and adds the result of BH /
8 to produce the result in CX.
The MOV instruction loads values into registers.
MUL performs multiplication, and DIV is used for division.
Finally, the result is stored in the CX register.
The 8085 microprocessor has a simple architecture with a 5-register set and is designed to
perform arithmetic and logic operations. The basic programming model of the 8085 includes:
1. Registers:
70 | P a g e
o A: Accumulator (primary register for arithmetic and logic operations).
o B, C, D, E, H, L: These are general-purpose registers used for data manipulation.
o Program Counter (PC): Keeps track of the memory location of the next
instruction to be executed.
o Stack Pointer (SP): Points to the top of the stack in memory.
2. Flags:
o Sign (S): Set if the result is negative.
o Zero (Z): Set if the result is zero.
o Auxiliary Carry (AC): Set if there is a carry from bit 3 to bit 4.
o Parity (P): Set if the result has an even number of 1s.
o Carry (CY): Set if there is a carry-out from the most significant bit.
3. Instruction Set:
o 8085 supports a wide range of instructions for arithmetic (ADD, SUB), logic
(AND, OR), data transfer (MOV, MVI), branching (JMP, CALL), and stack
operations (PUSH, POP).
4. Memory:
o 8085 can address up to 64 KB of memory (16-bit address bus).
This concludes the detailed answers for all your questions. Let me know if you'd like to dive
deeper into any specific topic or need more diagrams!
In the 8086 microprocessor, the queue plays a significant role in improving the efficiency of
instruction fetching and execution. Here's how:
Instruction Queue (Prefetch Queue): The 8086 microprocessor uses a 6-byte FIFO
(First-In, First-Out) instruction queue. This queue holds instructions fetched from
memory before they are executed. The purpose of this is to improve instruction
execution speed by ensuring that the processor is never waiting for an instruction to be
fetched.
How It Works:
o When an instruction is executed, the next instruction is already being fetched and
placed in the queue.
o Pipelining is achieved as the microprocessor fetches the next instruction while it
is executing the current one.
o This mechanism reduces idle time and increases the overall execution speed.
Significance:
o It helps to speed up execution because the processor can continuously execute
instructions without waiting for them to be fetched.
o It helps in optimizing the system performance, especially in applications where
instructions are executed sequentially and frequently.
71 | P a g e
o It reduces the instruction fetch latency by ensuring that instructions are already
available in the queue.
i. Status Pin:
The status pins in the 8086 microprocessor are used to indicate the current status of the
processor's operations. These pins provide information about the type of operation the
processor is performing.
o S2, S1, S0: These are the status pins that indicate the type of operation. They
can represent various operation modes like:
IO/M: Indicates if the operation is an I/O operation (low for I/O, high for
memory).
M/IO: This determines if the processor is performing a memory operation
or an I/O operation.
o READY: This pin is used to synchronize the processor with slower peripherals or
memory. If it is low, the processor waits; if it is high, the processor continues.
Function:
o These pins help external devices understand what the processor is doing (e.g., if
it's reading data or writing data, if it's executing a program, etc.).
Interrupt-related pins in the 8086 microprocessor are used to handle interrupt requests from
external devices. These pins manage the interrupt mechanisms and the prioritization of
interrupts.
72 | P a g e
iii. Queue-Related Pins:
The 8086 microprocessor uses pins related to its internal queue mechanism to
support its operation:
o QS1 and QS0: These pins are used to indicate the status of the queue. They show
if the queue is being used, whether it is empty or full, and they help manage the
prefetch mechanism.
o They help control the flow of instructions and synchronize the processor with
the external memory or I/O devices.
3. Status Flags after Executing ADD AX, BX where AX = FFEFH and BX = 1F8FH
When you execute the instruction ADD AX, BX with the given values for AX and BX, the status
flags will be updated. Let's break it down step by step:
Now, let's check how the status flags will change after the addition:
1. Carry (CY):
o The carry flag is set if there is a carry-out of the most significant bit (MSB). In
this case, no carry-out is generated, so CY = 0.
2. Zero (Z):
o The zero flag is set if the result of the operation is zero. The result here is 11E8F,
which is non-zero, so Z = 0.
3. Sign (S):
o The sign flag indicates if the result is negative. Since the result is positive, S = 0.
4. Parity (P):
o The parity flag indicates whether the number of 1s in the result is even or odd. In
this case, the result is 11E8F, which has even parity, so P = 1.
5. Auxiliary Carry (AC):
o The auxiliary carry flag is used when dealing with BCD (Binary Coded
Decimal) operations. It indicates if there is a carry from bit 3 to bit 4. In this
case, AC = 0.
73 | P a g e
Flag Value
Carry (CY) 0
Zero (Z) 0
Sign (S) 0
Parity (P) 1
Auxiliary Carry (AC) 0
Conclusion:
The queue in the 8086 microprocessor plays a vital role in improving execution speed
and efficiency by allowing the processor to fetch instructions while executing others.
The status pins help indicate the current operational state of the processor to external
devices, while the interrupt-related pins handle interrupt management.
After the ADD AX, BX operation, the status flags will show a Carry of 0, Zero of 0,
Sign of 0, Parity of 1, and Auxiliary Carry of 0, indicating that the addition of AX and
BX resulted in a positive number with even parity.
The 8259A is a programmable interrupt controller (PIC) that is used to handle interrupts in a
system. Cascading refers to connecting multiple 8259A chips to expand the number of interrupt
lines in a system, enabling the processor to handle more interrupts than a single PIC could
provide.
Cascading 8259A
To increase the number of interrupt lines, multiple 8259A ICs can be connected in a cascading
manner, allowing more than 8 interrupt lines. The primary (master) 8259A controls the interrupt
requests from multiple slave 8259A controllers.
Master 8259A: This PIC controls the primary set of interrupts (IR0 to IR7).
Slave 8259A: Each slave handles additional interrupts (IR8 to IR15) and sends interrupt
requests to the master.
In a cascaded configuration:
1. Master and Slave Connection: The master 8259A is connected to the CPU, while the
slave 8259A controllers are connected to the master.
2. IR Lines: The master 8259A has 8 interrupt request (IR) lines (IR0 to IR7). The slave
8259A can have 8 more interrupt lines (IR8 to IR15).
74 | P a g e
3. Cascade Pin: The slave 8259A has a cascade pin (CAS0, CAS1, CAS2), which is used
to connect the master and slave PICs. This is how they communicate when multiple
interrupts occur.
4. Interrupt Request (IRQ): When an interrupt request is raised, the PIC sends the
interrupt signal to the CPU through the interrupt request line.
5. Control Pins: Each PIC has control pins (like INT, INTA, etc.) to signal the processor
when an interrupt is happening and to initiate an interrupt service routine (ISR).
Cascading Diagram:
+-------------------+
| CPU (Processor) |
+-------------------+
|
(INT pin of CPU)
|
+-------------------+
| 8259A (Master) |
+-------------------+
/ | \
(IR0-IR7) (CAS) (IRQ8-IRQ15)
| |
+---------+ +---------+
| 8259A | | 8259A |
| (Slave)| | (Slave) |
+---------+ +---------+
(IR8-IR15) (IR16-IR23)
In this diagram:
To configure the 8259A PIC, the following steps are typically followed to initialize it:
75 | P a g e
Load ICW3: This configures the cascade pins (CAS0, CAS1, CAS2) and tells
o
which PIC is the master and which are slaves.
o Load ICW4: This defines the operation mode (e.g., 8086 mode, 8080 mode) and
if the PIC should use the special fully nested mode.
2. Mask Interrupts:
o Set the Interrupt Mask Register (IMR) to enable/disable interrupt requests.
Each bit in the IMR corresponds to an interrupt line (IR0 to IR7). Setting a bit to 1
will mask that interrupt, preventing it from reaching the CPU.
3. Enable the PIC:
o Set the Control Word (CW) to enable the PIC. The interrupts will now be
processed.
The 8259A PIC uses a fixed priority method for servicing interrupts. The interrupt with the
higher priority will be serviced first, regardless of the arrival order. The priority order is as
follows:
IR0 has the highest priority, followed by IR1, IR2, and so on, with IR7 having the
lowest priority.
Scenario:
In this case, the 8259A will first service IR4 and then move on to IR2.
76 | P a g e
| Service IR2 ISR |
| (Interrupt |
| Acknowledged) |
+---------------------+
Summary:
In cascading, the master 8259A controls the system's interrupt requests and interacts
with the slave 8259A controllers through the CAS pins. This increases the number of
interrupt lines in the system.
To initialize the 8259A, the Initialization Command Words (ICWs) are loaded to
configure the PIC for the system's operation, followed by setting the mask to enable or
disable specific interrupts.
When multiple interrupts like IR4 and IR2 occur, the PIC serves the higher-priority
interrupt first based on the fixed priority scheme.
Let me know if you'd like more details or if you need further clarification on any point!
Sure! Here's the complete answer with clear headings and explanations for each part of your
question:
When an interrupt is accepted by a microprocessor (like the 8085 or 8086), the Interrupt
Acknowledge (INTA) cycle is used to acknowledge and process the interrupt request from
an interrupting device (like the 8259A).
Purpose:
To fetch the interrupt vector number or instruction (like CALL) from the interrupt controller
or memory after the processor accepts the interrupt.
77 | P a g e
Timing Diagram (simplified for 8085):
T1 T2 T3 T1 T2 T3
|-----|-----|-----|-----|-----|----->
| M1: INTA̅ active | M2: INTA̅ active |
| No data | Opcode from PIC |
Mode 2 is called the Rate Generator Mode. It is one of the 6 modes of operation in the 8254
programmable interval timer.
Purpose:
It is used to generate a continuous stream of pulses at regular intervals — useful for baud rate
generation in serial communication.
CLK: |‾|_|‾|_|‾|_|‾|_|‾|_|‾|_|‾|
OUT: ‾‾‾‾‾‾‾‾‾|____|‾‾‾‾‾‾‾‾‾|____|‾‾‾‾
Each "low" pulse in OUT is 1 clock wide and comes after (N) clock cycles.
Application of Mode 2:
78 | P a g e
Keyboard scanning or watchdog timer.
Summary:
Interrupt Acknowledge Machine Cycle lets the processor fetch the vector or ISR
address after acknowledging an interrupt. It involves 2 machine cycles with INTA̅
signals.
Mode 2 of 8254 is a Rate Generator, producing regular pulses used in serial
communication, etc.
8254 is an advanced version of 8253, with higher speed and better features (like read-
back command).
Let me know if you’d like diagrams or hand-drawn notes to better visualize this.
Here is a detailed and easy-to-understand answer with proper explanation to each of your
questions:
DMA (Direct Memory Access) is a technique where data is transferred directly between I/O
devices and memory, bypassing the CPU. This makes data transfer faster and efficient.
How It Works:
79 | P a g e
A DMA controller (like Intel 8237) manages the data transfer.
When a device wants to transfer data (e.g., a disk or sound card), it sends a DMA request
(DRQ) to the DMA controller.
The DMA controller requests the CPU to release the control of the system bus.
The CPU responds with a HLDA (Hold Acknowledge) signal and gives up control of
the bus.
Then the DMA controller takes control of the buses and transfers data directly between
I/O and memory.
After the transfer, control is returned to the CPU.
Advantages:
Polling:
In polling, the CPU keeps checking the status of an I/O device to know if it’s ready for data
transfer.
Example:
Repeat:
Check printer status
Until:
Printer is ready
Send data to printer
80 | P a g e
Disadvantage: CPU stays busy checking, which wastes time.
Handshaking:
Handshaking is a technique where signals are exchanged between CPU and I/O devices to
coordinate data transfer.
Diagram:
Advantage of Handshaking:
Segmented Memory is a technique used in 8086 microprocessor to divide memory into logical
parts called segments. This helps in better organization and access of memory.
Segments in 8086:
Example:
CS = 2000h, IP = 0010h
Physical Address = 20000h + 0010h = 20010h
Efficient memory use: Code, data, and stack are kept separate.
Easier program modularity: Different modules can be placed in different segments.
Supports multitasking: Each task can be given its own segment.
Helps in memory protection and management.
Summary:
Let me know if you'd like diagrams for DMA transfer, handshaking, or segment calculations!
Here are the answers with simple explanations and proper structure as requested:
I/O Channels are special-purpose processors that handle input/output operations, freeing up
the main CPU.
82 | P a g e
Advantages of I/O Channels:
An I/O Processor (IOP) is a special processor designed to control I/O devices like printers,
disk drives, etc.
Functions:
Benefits:
83 | P a g e
Queues the rest to handle later.
Ensures that no interrupt is lost.
Works efficiently with both maskable and non-maskable interrupts.
Without a controller like 8259A, 8086 can only handle one interrupt line, making it inefficient
in multi-device systems.
Sending Order:
1. ICW1 – Sent first. Tells the 8259A to start initialization and mode (e.g., edge/level
triggered).
2. ICW2 – Sets the base address of the interrupt vector table.
3. ICW3 – Required only in cascaded mode (master/slave info).
4. ICW4 – Defines additional settings (e.g., 8086 mode, buffered mode).
Summary Table:
Item Description
I/O Channels Separate hardware for I/O tasks
IO Processor Handles I/O independently from CPU
Priority Interrupt Controller Controls interrupt priorities for multiple devices
8259A ICW Order ICW1 → ICW2 → ICW3 (if needed) → ICW4
Sure! Here's the proper explanation for each part of your question using easy-to-understand
language and structured clearly:
SESSION 2018-19
CT
1. Define Microprocessor
84 | P a g e
A Microprocessor is the central processing unit (CPU) of a computer built on a single chip.
It is a programmable device that takes input, processes it using instructions stored in memory,
and gives output.
It performs:
Main Components:
+-------------+ +------------+
| Input Unit |<------->| |
+-------------+ | |
| Control |
85 | P a g e
+-------------+ | Unit |<--------> Clock
| Output Unit|<------->| |
+-------------+ +------------+
|
v
+------------------+
| ALU (CPU core) |
+------------------+
|
v
+------------------+
| Memory Unit | <-- Program & Data both
stored here
+------------------+
4. Write down the content and operations of BIU unit of 8086 Microprocessor
The Bus Interface Unit (BIU) in 8086 is responsible for fetching instructions, reading/writing
data, and communicating with memory and I/O.
Contents of BIU:
Operations:
5. What will be the output of the status flags after executing the instruction:
Let’s calculate:
AX = 1EEFH
BX = 1F8EH
86 | P a g e
BX = BX + AX
= 1F8E + 1EEF = 3E7D
In Hex:
CF = 0
ZF = 0
SF = 0
OF = 0
Let me know if you want the flag values calculation step-by-step, or a diagram for Von
Neumann architecture!
Here is the full answer to your question, written in clear and easy-to-understand language,
with explanations and block diagrams:
This means:
Features:
87 | P a g e
Faster because instructions and data can be fetched simultaneously.
Used in microcontrollers and signal processing devices.
+------------------+
| Control Unit |
+--------+---------+
|
+-------------+-------------+
| |
+------+-----+ +------+-----+
| Instruction | | Data |
| Memory | | Memory |
+------+-----+ +------+-----+
| |
+-------+------+ +--------+------+
| Instruction | | Data Bus |
| Bus | +---------------+
+---------------+
Summary:
Each segment has a segment register, and memory is accessed using a combination of:
88 | P a g e
Why Do We Need Memory Segmentation?
Reason Explanation
1. Efficient Memory Segmentation allows easy handling of large programs by dividing
Management them into logical parts.
2. Modular Programming Code, data, and stack can be handled independently.
By changing only the offset or segment register, we can quickly
3. Faster Access
access different parts of memory.
4. Increases Addressable Although registers are 16-bit, segmentation helps access 1MB
Memory memory in 8086.
Let me know if you want a diagram for memory segmentation or a comparison between
Harvard and Von Neumann architecture!
Here is the full answer with simple explanations for each part of your question:
In a system like 8086, multiple devices can request interrupts at the same time. A Priority
Interrupt Controller like 8259A helps manage these interrupt requests.
1. Multiple Interrupts Handling: It allows 8086 to handle many interrupt sources (more
than one at a time).
2. Priority Management: It decides which interrupt is more important (higher priority) and
sends that to the CPU first.
3. Efficient Execution: Prevents lower-priority devices from disturbing the CPU when
higher-priority interrupts are being serviced.
4. Reduces CPU Workload: The CPU does not have to check each device. The controller
manages requests.
89 | P a g e
+--------v----------+
| Read/Write |
+--------+----------+
|
+---------------+--------------------+
| | |
+---v---+ +-----v-----+ +------v------+
| IRR | | Priority | | In-Service |
| (IRQ) | --> | Resolver | ----> | Register |
+-------+ +-----------+ +-------------+
| |
+---------> Control Logic <---------+
|
+------v-------+
| INT (to CPU) |
+--------------+
In Minimum Mode, the 8086 works as a single processor system (no other processor like
coprocessor or another CPU).
Here are some important pins in Minimum Mode and their functions:
90 | P a g e
Let me know if you'd like a clean diagram version of the internal block or pin functions!
Here’s the detailed explanation of your questions in clear and simple words:
In Maximum Mode, the 8086 microprocessor is used in multiprocessor systems (with a co-
processor or multiple CPUs). In this mode, control signals are not generated by 8086 itself;
instead, they are generated by an external bus controller (like 8288).
2. What Are the Differences Among INTR, INTA̅, and NMI Pins in 8086
Microprocessor?
91 | P a g e
This is an output pin from the processor.
When 8086 receives a request through INTR, it sends a low pulse on INTA̅ to tell the
device that its request is accepted.
Usually used with INTR only.
Let me know if you'd like a diagram of pin layout or a real-life use case example!
Here’s a detailed, easy-to-understand answer with proper explanation, timing diagram, and step-
by-step structure as per your request:
Mode 2 is used to generate periodic interrupts or pulses at regular intervals. It behaves like a
divide-by-N counter, meaning it divides the clock input frequency.
The output goes low for one clock pulse, and high for the remaining N–1 clock pulses.
Once the count is loaded, the counter automatically reloads and continues, so no
reloading is needed manually.
This makes it suitable for generating repeating interrupts to the CPU.
92 | P a g e
Timing Diagram:
CLK: ─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐
┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘
OUT: ────────────────┐________┐________
↓ ↓
Low for 1 clk → auto reload
II. Write Down and Briefly Describe All the Steps to Initialize an 8254
Programmable Peripheral Device with the Control Word Format. (10 marks)
Bit 7 6 5 4 3 2 1 0
Use SC1 SC0 RW1 RW0 M2 M1 M0 BCD
III. Define Cycle Stealing. Write Down the Differences Between DMA and I/O
Processor.
Cycle Stealing:
Cycle Stealing is a feature of DMA (Direct Memory Access) where the DMA controller
temporarily takes control of the system bus from the CPU to transfer data.
It "steals" one clock cycle at a time, without completely stopping the CPU.
This way, DMA can transfer data in the background with minimal effect on CPU
performance.
Let me know if you'd like the 8254 control word format table, timing diagrams as images, or
a diagram of 8237 DMA controller!
SEMESTER
Let’s answer both questions with full, easy-to-understand explanations as requested:
94 | P a g e
When a PC is powered on, the following sequence of events happens:
2. Define "Hardware Retriggerable One Shot" Mode of 8254 Counter and Its
Application
In this mode, the counter produces a single low pulse for a fixed amount of time
whenever a trigger (rising edge on GATE input) is received.
If another trigger comes before the time expires, the counter restarts the timing again
— this is called retriggerable behavior.
Key Points:
OUT goes low on trigger and remains low for the duration of the count.
New trigger resets the count and restarts the one-shot.
Used to generate timed pulses after events.
Timing Diagram:
CLK: ─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐
┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘
GATE: ↑ ↑
Trigger Trigger again
95 | P a g e
OUT: ─────────┐ ┐
└───────┘← Retriggered
Application of Mode 1:
Let me know if you'd like the timing diagram as an image or explanation of another 8254
mode!
The clock in a microprocessor plays a crucial role in coordinating the timing of operations. It
helps synchronize all internal and external components of the microprocessor.
Clock Signal: The clock generates a regular sequence of pulses (often referred to as
"ticks"). Each tick represents a timing cycle, and operations inside the microprocessor are
aligned with these ticks.
Timing Control: The clock signal controls the timing of instructions and synchronizes
the flow of data between the microprocessor and peripherals. Every operation or
instruction, like fetching, decoding, and executing, takes place in sync with the clock
pulses.
Clock Speed (Frequency): The clock speed (measured in Hz or cycles per second)
determines how fast the microprocessor can process instructions. A higher clock speed
allows the microprocessor to perform more operations per second.
The 8086 microprocessor has five important flags in the Flag Register. These flags indicate the
status of certain operations and influence conditional operations.
Flags in 8086:
96 | P a g e
o Set if the number of 1-bits in the result is even. Otherwise, it is cleared (for odd
parity).
o This is used for error detection.
3. Auxiliary Carry Flag (AF):
o Set if there is a carry from bit 3 to bit 4 during binary addition or subtraction.
o Useful for BCD (Binary Coded Decimal) operations.
4. Zero Flag (ZF):
o Set if the result of an operation is zero (i.e., the operands are equal).
o Used for making decisions in conditional branches.
5. Sign Flag (SF):
o Set if the result of an operation is negative (i.e., the most significant bit of the
result is 1).
o Used to indicate the sign of the result.
6. Overflow Flag (OF):
o Set if the result of a signed operation is too large to be represented in the given
number of bits.
o Indicates overflow in signed arithmetic operations.
7. Trap Flag (TF):
o Used to enable single-step execution mode for debugging.
o Each instruction execution will be interrupted for debugging.
8. Interrupt Flag (IF):
o Controls the interrupts. If set, interrupts are enabled. If cleared, interrupts are
disabled.
9. Direction Flag (DF):
o Determines the direction for string processing (string instructions like MOVSB,
LODS, etc.).
o Set for decrementing the pointer; cleared for incrementing.
The 8086 microprocessor supports several addressing modes to specify where operands (data)
are located. Here are 5 addressing modes:
97 | P a g e
o Example: MOV AX, [1234h]
(Here, the data at memory address 1234h is moved into AX).
4. Indirect Addressing Mode:
o The operand is at a memory location pointed to by a register.
o Example: MOV AX, [SI]
(Here, the content of the memory location pointed to by SI is moved into AX).
5. Based Indexed Addressing Mode:
o Combines both a base register and an index register to compute the effective
memory address.
o Example: MOV AX, [BX+SI]
(Here, the contents of the memory location computed by adding BX and SI are
moved into AX).
The 8086 microprocessor is a 16-bit processor and follows a Harvard architecture (separate
data and instruction buses). Its internal structure consists of several key components:
98 | P a g e
o The BIU manages the interaction between the microprocessor and memory or I/O
devices.
o It consists of:
Instruction queue: Holds pre-fetched instructions.
Segment registers: Used to hold the memory segments.
Bus control unit: Controls the communication on the system bus.
5. Execution Unit (EU):
o The EU executes the instructions provided by the BIU.
o It includes the ALU, general-purpose registers, and flags that are used during
instruction execution.
6. Instruction Queue:
o The 8086 has a 6-byte instruction queue that allows the processor to pre-fetch
instructions while executing the current one. This helps improve performance by
increasing instruction throughput.
The 8086 microprocessor uses a segmented memory model. This means that memory is
divided into segments, and each segment is addressed using a segment register. The segment
registers are used to define the starting address of different memory segments.
99 | P a g e
o It is often used in string manipulation instructions like MOVSB, LODSB, etc.
The segment registers are used in combination with the offset address to calculate a full
physical memory address. The physical address is calculated as:
This helps to address memory locations beyond the 64KB limit of the 16-bit address bus.
The 8085 and 8086 are both microprocessors, but there are several key differences between
them:
We are asked to find the unknown value for the physical address in two scenarios. The 8086
uses segmented memory addressing, where the physical address is calculated as:
100 | P a g e
Physical Address=(Segment Address×16)+Offset Address\text{Physical Address} =
(\text{Segment Address} \times 16) + \text{Offset Address}
Here, the segment address is A000H and the offset address is 0123H.
The physical address is given as A0123H.
So,
Now,
Here, the segment address is unknown, and the offset address is CD21H.
The physical address is given as 32D21H.
So,
101 | P a g e
Let's isolate the segment address:
Example:
Example:
o If memory at address 2378H holds the value 1234H, then AX = 1234H after
executing MOV AX, [2378H].
Summary of Differences:
102 | P a g e
Instruction Description Operation on AX
MOV AX, Moves the value stored at the memory address AX = content at memory
[2378H] 2378H into the AX register. address 2378H
The INTR (Interrupt Request) pin in the 8086 microprocessor is part of the interrupt handling
mechanism. When an interrupt is received via the INTR pin, the microprocessor needs to stop its
current execution to service the interrupt. However, if the interrupt is not masked, there is a risk
of the same interrupt being triggered again while the processor is still servicing the first interrupt.
To prevent nested interrupts (interrupts occurring before the current interrupt is fully serviced),
the 8086 automatically disables the INTR pin when it begins processing the interrupt. This is
done by clearing the interrupt enable flag in the IF (Interrupt Flag) register.
INTR is an interrupt request input, and when the interrupt is acknowledged, the
microprocessor disables the INTR input to ensure that no further interrupts are processed
while the current interrupt is being serviced.
After the interrupt service routine (ISR) completes, the interrupt enable flag (IF) is re-
enabled, allowing further interrupts to occur.
This behavior ensures that the interrupt service routine can complete without being interrupted
by another interrupt, providing atomic processing of the interrupt.
2. Architecture of 8087:
The 8087 is a floating-point coprocessor designed to work with the 8086/8088 microprocessor.
It provides hardware support for floating-point arithmetic operations like addition, subtraction,
multiplication, and division, which the main processor (8086/8088) does not handle efficiently.
Architecture of 8087:
103 | P a g e
Status Register: Provides information about the status of the coprocessor operations,
including the error conditions.
Tag Register: This register stores the status of the floating-point registers. It indicates
whether a register contains a valid or invalid value.
Data Registers (ST(0) to ST(7)): These are used to store floating-point numbers.
Execution Unit (EU): This performs arithmetic operations like addition, subtraction, etc.
Instruction Queue: Similar to the 8086, it holds the instructions before they are
executed.
+------------------------+
| Control Register |
+------------------------+
|
v
+------------------------+
| Status Register |
+------------------------+
|
v
+------------------------+ +---------------------+
| Data Registers | <---------> | Execution Unit |
| (ST(0) to ST(7)) | +---------------------+
+------------------------+
|
v
+------------------------+
| Tag Register |
+------------------------+
The 8087 coprocessor has several important registers that control its operations and track the
status of computations:
The Status Register of the 8087 provides information on the current operation, such as
whether an error has occurred during an operation, whether an operation is still in
progress, or whether the coprocessor is idle.
It has several flags, including:
o C0 to C3 (Condition flags): These flags store conditions of floating-point
operations, such as whether the result was zero, overflow, etc.
o C (Carry flag): Indicates a carry condition for floating-point arithmetic.
o D (Display flag): Indicates the current floating-point format.
104 | P a g e
The Control Register is used to control the behavior of the 8087 coprocessor.
o It includes flags to control rounding modes, precision, and error handling.
o The EM (Exception Mask) in the control register helps mask or enable
exceptions like division by zero or invalid operations.
o The PC (Precision Control) and RC (Rounding Control) fields in the register
set the precision and rounding mode for floating-point operations.
The Tag Register keeps track of the status of the 8 floating-point registers (ST(0) to
ST(7)).
Each bit in the tag register corresponds to one floating-point register and indicates
whether the register contains a valid number or is empty.
o Valid (V): If the bit is set to 0, it means the corresponding register contains a
valid value.
o Empty (E): If the bit is set to 1, it means the corresponding register is empty.
o This helps the 8087 determine which registers are available for use during
operations.
Summary:
1. INTR Input Disabling: The INTR input is disabled when an interrupt is being serviced
to prevent nested interrupts from occurring while the microprocessor is still handling the
current interrupt.
2. Architecture of 8087: The 8087 is a floating-point coprocessor with components such as
the control register, status register, tag register, data registers, and execution unit. It
handles floating-point arithmetic operations for the 8086/8088 processor.
3. Registers in 8087:
o Status Register (SREG): Provides information about the operation status and
error conditions.
o Control Register (CREG): Controls the behavior of the coprocessor, including
rounding, precision, and error handling.
o Tag Register (TAGREG): Tracks the validity of the floating-point registers
(ST(0) to ST(7)).
1. What is Direct Memory Access (DMA)? Why is DMA data transfer faster than
doing the same data transfer with program instruction?
Direct Memory Access (DMA) is a method of data transfer in which an external device (like a
peripheral) can directly transfer data to/from memory without involving the CPU. The DMA
controller takes over the data transfer process, allowing the CPU to perform other tasks
simultaneously, which increases the overall system efficiency.
105 | P a g e
Why DMA is faster than program instructions for data transfer:
CPU Involvement: In traditional data transfer using program instructions (like using MOV
in assembly), the CPU must process each byte/word individually. The CPU executes
instructions to read from the source, write to the destination, and manage any necessary
conditions. This involves several cycles per data transfer, leading to slower performance.
DMA Operation: In DMA, the CPU is not involved in the actual data transfer process.
The DMA controller manages the data transfer directly between the I/O device and
memory, allowing data to be moved quickly without CPU intervention. The CPU only
needs to initiate the DMA operation and can perform other tasks while the DMA
controller handles the data transfer.
Efficient Use of System Resources: Since DMA allows data to transfer directly between
memory and devices, the CPU doesn't need to spend time managing each byte of data.
This reduces the CPU load, allowing it to perform other tasks while the DMA controller
works, thereby improving system throughput.
Advantages of DMA:
1. Faster Data Transfer: DMA allows data to transfer directly between memory and I/O
devices, avoiding the CPU’s intervention, which speeds up the process compared to using
program instructions.
2. Reduced CPU Load: By handling data transfers autonomously, DMA frees up the CPU
to perform other operations, improving overall system performance.
3. Efficient Use of Resources: Since DMA can transfer data in bursts without needing
constant CPU interaction, it optimizes the use of both CPU and memory.
4. Multitasking Capability: DMA enables multitasking by allowing the CPU to perform
other tasks while data is being transferred, enhancing the system's overall throughput.
Disadvantages of DMA:
106 | P a g e
3. Describe different bus systems with diagram in a microcomputer.
A bus system in a microcomputer refers to the set of physical connections (wires or traces) that
carry data, addresses, and control signals between various components, such as the CPU,
memory, and I/O devices.
1. Data Bus:
o The data bus carries data to and from the CPU, memory, and peripheral devices.
o The width of the data bus (i.e., the number of lines) determines the amount of data
that can be transferred simultaneously. For example, an 8-bit data bus can transfer
one byte of data per cycle, while a 16-bit bus can transfer two bytes.
2. Address Bus:
o The address bus carries the address information to specify the source or
destination of data in memory or I/O devices.
o The width of the address bus determines the maximum amount of addressable
memory. For example, a 16-bit address bus can address 64KB of memory, while a
32-bit address bus can address up to 4GB.
3. Control Bus:
o The control bus carries control signals that manage the operations of the CPU,
memory, and I/O devices.
o These signals include read/write signals, clock pulses, interrupt requests, and bus
request signals.
Diagram:
+---------------------+ +-----------------------+
| CPU | | Memory/ I/O |
| +------------+ |<----->| +------------+ |
| | Address | | | | Address | |
| | Bus | | | | Bus | |
| +------------+ | | +------------+ |
| +------------+ | | +------------+ |
| | Data Bus | |<----->| | Data Bus | |
| +------------+ | | +------------+ |
| +------------+ | | +------------+ |
| | Control Bus| |<----->| | Control Bus| |
| +------------+ | | +------------+ |
+---------------------+ +-----------------------+
107 | P a g e
The Interrupt Vector Table (IVT) is a special table used by the microprocessor to store the
addresses of the interrupt service routines (ISR) for different interrupts. It essentially provides
the microprocessor with the location of the code to be executed when an interrupt is triggered.
When an interrupt occurs, the microprocessor uses the interrupt vector table to determine
which ISR to execute.
Each interrupt type has a specific location (address) in the interrupt vector table.
The microprocessor looks up the vector address corresponding to the interrupt number,
retrieves the address of the ISR from that location, and then jumps to that address to
execute the interrupt service routine.
The IVT is typically located at the start of memory (from address 0x0000 to 0x03FF in an 8086
system). Each entry in the table contains the address of the ISR for a specific interrupt.
SESSION 2017-18
CT
108 | P a g e
1. Define Word and Instruction.
Word:
o A word is the basic unit of data used by a processor. The size of a word depends
on the architecture of the processor. For example, in an 8085 microprocessor, a
word is 8 bits (1 byte), whereas in the 8086 microprocessor, a word is 16 bits (2
bytes). A word is typically the amount of data the processor can process or
operate on in one machine cycle.
Instruction:
o An instruction is a binary-coded operation that tells the microprocessor what
operation to perform. Instructions can involve arithmetic operations, data transfer,
or control operations. For example, in the 8086 microprocessor, instructions can
include MOV (move), ADD (add), and SUB (subtract).
Machine Language:
o Machine language is the lowest-level programming language, consisting of
binary instructions directly understood by the processor. It uses binary code (0s
and 1s) to represent instructions that the processor executes.
o Example: A machine language instruction for the 8085 microprocessor might look
like 01010000 00000001 (which might represent a particular operation in the
8085’s instruction set).
o It is difficult for humans to read and write, as it involves raw binary codes.
Assembly Language:
o Assembly language is a higher-level programming language closely related to
machine language but uses mnemonics (symbolic representations) for
instructions, making it easier for humans to read and write.
o Example: An assembly instruction for the 8085 microprocessor could be MOV A,
B (which means move the value in register B to register A).
o Each assembly language instruction corresponds to a specific machine language
instruction. Assembly language is converted to machine code by an assembler.
Accumulator-based Microprocessor:
109 | P a g e
o In an accumulator-based microprocessor, the primary focus of most operations
is on the accumulator (A) register. The accumulator acts as both a source and a
destination for most operations.
o Operations like addition, subtraction, and multiplication typically involve the
accumulator. The microprocessor uses the accumulator for intermediate storage,
and most arithmetic operations are performed on it.
o Example: In 8085, many instructions like ADD B, MOV A, B, etc., involve the
accumulator directly.
General-purpose Register-based Microprocessor:
o In a general-purpose register-based microprocessor, multiple registers (besides
the accumulator) are used to store data. These registers allow for more flexibility
in data processing since operations can involve any of the available registers.
o The microprocessor can perform operations between different registers, which
reduces the dependency on a single accumulator.
o Example: In 8086, there are multiple general-purpose registers (like AX, BX, CX,
DX) that can be used in various operations, allowing for more parallelism and
efficient data handling.
The 8086 microprocessor is a 16-bit processor, and its internal architecture includes several key
components:
110 | P a g e
Flags Register:
o The Flags Register stores the status of various operations performed by the ALU,
such as carry, zero, sign, overflow, and parity flags.
The 8086 microprocessor supports several addressing modes, which determine how the
effective address of an operand is calculated. Here are the key addressing modes:
111 | P a g e
If you need more details or further clarification on any of the topics, feel free to ask!
Let's answer each question in order with clear explanations and simple language:
The BIU (Bus Interface Unit) is one of the two main parts of the 8086 microprocessor. It works
as the interface between the processor and memory or I/O devices. Its main job is to handle
communication with memory and external devices.
1. Instruction Fetching:
o BIU fetches instructions from memory in advance and stores them in a 6-byte
instruction queue (called prefetch queue). This helps the processor run faster
(pipelining).
2. Address Calculation:
o BIU calculates the physical address of memory by combining the segment
register and the offset.
3. Bus Operations:
o It handles the address bus, data bus, and control signals for memory and I/O
read/write operations.
4. Segment Handling:
o It holds the segment registers: CS, DS, ES, SS. These registers define different
memory areas (code, data, stack, etc.).
Addressing Mode refers to the way in which the operand (data) of an instruction is specified.
i) MOV CH, 8
→ Immediate Addressing Mode
(Here, 8 is directly given in the instruction)
112 | P a g e
ii) MOV AX, DS:START
→ Direct Addressing Mode with Segment Override
(START is a memory label, DS:START specifies a specific memory location in the data
segment)
Given:
DS = 1120H
SI = 2498H
AX = 53EFH
[13698H] = EFH
[13699H] = 53H
113 | P a g e
This moves the immediate value 2437H directly into AX.
Immediate Addressing Mode
This moves the value from memory location 2437H (in DS segment) into AX.
Direct Addressing Mode
6. Draw the Diagram of Flag Register of 8086 & Mention the Function of AF, SF,
IF, DF
|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|
| | | | |OF|DF|IF|TF|SF|ZF|--|AF|--|PF|--|CF|
Important Flags:
Would you like a clean, printable PDF version of this answer for exam preparation?
What is a Channel?
A channel is a communication path or medium that connects two devices and allows data
transfer between them.
In microprocessor systems, channels are often used for input/output (I/O) operations or
memory access, and they help the CPU manage multiple tasks or devices.
114 | P a g e
What is a DMA Channel?
A DMA (Direct Memory Access) Channel is a dedicated communication path used by the
DMA controller to transfer data directly between memory and I/O devices without involving
the CPU.
Each DMA channel is assigned to a specific device (like a disk drive, sound card, or
network adapter).
Multiple channels can be present in a DMA controller (e.g., 4 or 8 channels).
The CPU gives control to the DMA controller, which then manages the transfer
through the assigned channel.
It uses bus arbitration to gain control of the system buses (address, data, control).
Example:
Suppose you are copying a large file from a hard drive to RAM.
Without DMA: CPU reads data from the hard drive, then writes to memory – slow and
busy CPU.
With DMA: DMA controller uses a DMA channel to move data directly – CPU is free
for other tasks.
115 | P a g e
Improved system performance
Let me know if you'd like a diagram of the DMA data flow using channels.
SESSION 2016-17
SEMESTER
Here is a clear and organized answer to your questions:
1. Define Microprocessor
A microprocessor is an integrated circuit (IC) that contains the central processing unit (CPU) of
a computer. It performs arithmetic and logic operations, controls system activities, and processes
data. It is the brain of a computer system, but it needs external memory and input/output devices
to function.
116 | P a g e
Feature 8085 8086
Memory Segmentation Not available Available
Number of Registers Fewer More (including segment registers)
Clock Frequency Up to 3 MHz 5, 8, or 10 MHz
Released In 1976 1978
Would you like me to draw and send the block diagram image of 8086?
There are 9 active flags in the 16-bit flag register of 8086, divided into status and control
flags:
Status Flags:
o CF (Carry Flag)
o PF (Parity Flag)
117 | P a g e
o AF (Auxiliary Carry Flag)
o ZF (Zero Flag)
o SF (Sign Flag)
o OF (Overflow Flag)
Control Flags:
o TF (Trap Flag)
o IF (Interrupt Enable Flag)
o DF (Direction Flag)
2c) Write Down the Difference Between 8085 and 8086 Microprocessor
Would you like a summarized one-page PDF of this content for study or print?
In the 8086 microprocessor, the Opcode Pre-Fetch Queue is a 6-byte instruction queue that
is part of the Bus Interface Unit (BIU).
Main Functions:
118 | P a g e
Effect on Status Flags for the Following Instruction Sequence:
MOV AX, 1234H ; AX = 1234H
MOV BX, 0ABCDH ; BX = ABCDH
CMP AX, BX ; Compares AX - BX (1234H - ABCDH)
CMP AX, BX subtracts BX from AX, i.e., 1234H - ABCDH, but does not store the result.
It sets status flags based on the result of subtraction.
Subtraction:
This results in a negative value, so let's analyze what happens to the flags:
Flag Status
CF 1 (Set)
ZF 0 (Clear)
SF 1 (Set)
OF 0 (Clear)
PF Depends on lower byte of result
AF Undetermined without exact bit-level subtraction
119 | P a g e
Would you like me to explain how to calculate Parity Flag (PF) or Auxiliary Carry (AF) in this
context?
CARRY_SET:
INC CL ; If carry, set CL = 01H
STORE_RESULT:
MOV SI, 4202H
MOV [SI], AL ; Store lower byte of result
INC SI
MOV [SI], CL ; Store higher byte (carry if any)
HLT
Explanation:
120 | P a g e
❷ Describe Arithmetic and Program Execution Transfer Instructions of 8086
Microprocessor
Arithmetic Instructions:
These perform mathematical operations like addition, subtraction, increment, and decrement.
Instruction Meaning
ADD A, B Adds B to A (A = A + B)
SUB A, B Subtracts B from A (A = A - B)
INC A Increments A by 1
DEC A Decrements A by 1
ADC A, B Add B + Carry to A
SBB A, B Subtract B + Borrow from A
CMP A, B Compares A and B (A - B, result not stored, only flags affected)
NEG A Two’s complement of A (0 - A)
MUL B Unsigned multiply (AL × B)
IMUL B Signed multiply
Instruction Meaning
JMP label Unconditional jump to label
JE / JZ Jump if equal / zero flag is set
JNE / JNZ Jump if not equal / zero flag is not set
JC Jump if carry flag is set
JNC Jump if no carry
CALL Call a procedure (saves return address)
RET Return from procedure
LOOP Loop using CX register
INT Software interrupt
The 8086 microprocessor can operate in two modes based on the pin MN/MX̅
(Minimum/Maximum mode):
Register Description
AX (Accumulator) Used for arithmetic, logic, and data transfer. Commonly holds results.
BX (Base) Used as base pointer in addressing.
122 | P a g e
Register Description
CX (Count) Used as counter in loops and shifts.
DX (Data) Used in multiplication/division and I/O operations.
B. Segment Registers
Register Description
CS (Code Segment) Points to the code segment (instructions).
DS (Data Segment) Points to the data segment.
SS (Stack Segment) Points to the stack segment (for push/pop).
ES (Extra Segment) Used for additional data storage or string operations.
Register Description
SP (Stack Pointer) Points to top of the stack.
BP (Base Pointer) Used to access parameters in the stack (esp. in procedures).
SI (Source Index) Used in string operations (source string).
DI (Destination Index) Used in string operations (destination string).
Register Description
IP (Instruction
Holds offset address of next instruction to be executed.
Pointer)
Contains status flags (like Zero, Sign, Carry, etc.) that indicate result of
FLAGS Register
operations or control processor behavior.
Key Features:
Feature Description
Data Bus Width 16-bit (can handle 16 bits of data at a time)
20-bit (can address up to 1 MB of memory: 2²⁰ = 1,048,576
Address Bus Width
bytes)
Instruction Queue 6-byte prefetch queue (supports pipelining)
14 total: including 4 general-purpose, 4 segment, pointer/index,
Registers
IP, and FLAGS
Memory Segmentation Supports segment-based memory (code, data, stack, extra)
Minimum Mode (single CPU) and Maximum Mode
Operating Modes
(multiprocessor)
Clock Speed Typically 5, 8, or 10 MHz
Multiplication & Division Supports both unsigned and signed operations
Supports Assembly
Like MOV, ADD, SUB, MUL, JMP, CALL, etc.
Instructions
Supports Interrupts Hardware and software interrupts supported
I/O Address Space Separate 64 KB I/O space (via IN and OUT instructions)
If you want, I can also give you a diagram of 8086 register structure or internal architecture.
Would you like that?
Here's a detailed explanation of all three questions, with easy-to-understand language and
structured format:
The 8086 microprocessor has a 20-bit address bus, which means it can generate 2²⁰ =
1,048,576 unique addresses.
124 | P a g e
1 MB (1 Megabyte = 1024 × 1024 bytes)
How?
Features:
125 | P a g e
┌──▼──┐ ┌──▼──┐
│Port A│ │Port B│
└─────┘ └─────┘
┌──────────────┐
│ Port C │ ← Split into PC7-4 (PCU) and PC3-0 (PCL)
└──────────────┘
Working Procedure:
Would you like me to draw and send you a labeled diagram of 8255A?
126 | P a g e
1. Explain the Block Diagram of the 7-Segment Display
Interface and Its Operations
What is a 7-Segment Display?
A 7-segment display is an electronic display device used to show decimal numbers (0–9) and
some hex digits (A–F) using 7 LEDs arranged in the shape of the number 8. Each segment is
labeled a to g.
--a--
| |
f b
| |
--g--
| |
e c
| |
--d--
Components:
Operation:
127 | P a g e
To allow the microprocessor to read/write data to memory or I/O devices, they must be
properly connected and addressed.
Memory Interfacing:
I/O Interfacing:
Two methods:
Isolated I/O: Separate I/O and memory space. Use special instructions like IN and OUT.
Memory-Mapped I/O: I/O devices are treated as memory locations.
How it works:
Would you like a diagram of the 7-segment display interface with labels?
128 | P a g e
Let’s answer your questions one by one in a simple, clear way:
Features of 8251:
Where:
If a chip is K × 8, then:
129 | P a g e
It stores K × 1024 locations (Kilo = 1024).
Address range = from 0000H to (K × 1024 - 1) in hex.
Example:
130 | P a g e
│ CS1 → EPROM 2 (Odd) │ ← A0 = 1
│ CS2 → RAM 1 (Even) │ ← A0 = 0
│ CS3 → RAM 2 (Odd) │ ← A0 = 1
└─────────────────────────┘
Would you like me to draw and send you a diagram of this memory interfacing circuit for better
visualization?
Here is a simple and clear comparison between synchronous and asynchronous data
transmission:
Summary:
Would you like a diagram to visualize the timing difference between them?
131 | P a g e
SESSION 2015-16
SEMESTER
Let’s go through these questions step by step:
Key reasons:
The machine cycle is the time taken by the microprocessor to complete a basic operation like
reading, writing, or performing an arithmetic operation. It includes several clock pulses.
For example, the 8086 microprocessor needs 4 clock cycles for each machine cycle (this can
vary with different microprocessors).
2. Instruction Cycle:
The instruction cycle is the entire process that a microprocessor follows to fetch, decode, and
execute an instruction. The instruction cycle typically consists of multiple machine cycles.
The instruction cycle could take multiple machine cycles, depending on the complexity of the
instruction.
3. Fetch Cycle:
The fetch cycle is part of the instruction cycle and refers specifically to the process where the
microprocessor:
In this cycle:
4. Execute Cycle:
133 | P a g e
The execute cycle is the part of the instruction cycle where the microprocessor executes the
instruction that was fetched and decoded. This could involve:
Summary of Cycles:
Machine Cycle: The basic cycle for a single operation (e.g., read/write).
Instruction Cycle: The overall cycle that includes fetch, decode, and execute.
Fetch Cycle: The cycle where the microprocessor fetches the instruction from memory.
Execute Cycle: The cycle where the fetched instruction is executed.
The 8086 can operate at a maximum clock frequency of 10 MHz in its original
configuration. However, the actual clock frequency depends on the version of the 8086
microprocessor and the external clock used.
134 | P a g e
Typically, the clock speed is half of the microprocessor’s internal processing speed due
to the internal pipeline architecture.
This instruction moves the value from the memory location START in the data segment (DS) to
the AX register.
135 | P a g e
iii) MOV [SI], AL
This instruction moves the value in the AL register into the memory location pointed to by the
SI (Source Index) register.
Summary:
Would you like more details on any of these topics or another example?
Let's break down your questions and go through the answers step by step:
a) PUSH Instruction
The PUSH instruction is used to push data onto the stack. It decrements the stack pointer
and stores the operand (data) at the memory location pointed by the stack pointer.
Syntax:
PUSH operand
Example:
PUSH AX
This pushes the contents of the AX register onto the stack. The stack pointer (SP) is
automatically decremented, and the data is stored at the memory location [SS:SP].
b) POP Instruction
The POP instruction is used to pop data from the stack. It loads the operand from the stack
and increments the stack pointer.
136 | P a g e
Syntax:
POP operand
Example:
POP AX
This pops the data from the stack into the AX register. The stack pointer (SP) is
automatically incremented after the data is removed from the stack.
The AAA instruction is used to adjust the result of an ASCII addition operation. When
performing arithmetic operations on ASCII values, the result may not be valid as an ASCII
character, so the AAA instruction corrects the result.
Syntax:
AAA
Example:
ADD AL, 30H ; AL = '3' + '4' = 37H (incorrect ASCII)
AAA ; Adjust the result for ASCII addition
After executing the AAA instruction, the result will be adjusted back into a valid ASCII
range.
Segment Address: The 16-bit segment base address (points to the segment).
Offset Address: The 16-bit offset (or displacement) from the segment base.
To obtain the physical address, the microprocessor combines the segment base and offset:
Formula:
Physical Address = (Segment Address × 16) + Offset Address
Where:
137 | P a g e
Let's calculate the physical address for the following examples:
Here, we need to calculate the physical address using ES (Extra Segment) and DI (Destination
Index):
Summary of Calculations:
138 | P a g e
Let’s break down your questions step by step:
In the 8086 microprocessor, the bus cycle refers to the sequence of events that occur when the
processor communicates with memory or I/O devices. It includes the fetch, decode, and execute
stages, but in more detail, it specifically involves interactions with the address, data, and control
buses.
1. Address Cycle:
o The processor places the address of the memory location or I/O device on the
address bus.
o The memory read/write operation is then specified by the control bus.
2. Memory Cycle:
o If it's a read operation, data is retrieved from memory or I/O and placed on the
data bus.
o If it's a write operation, data from the data bus is written to memory or I/O.
3. Control Signals:
o The control bus carries signals such as MEMR (memory read), MEMW
(memory write), and IOR (I/O read), which control the operation of memory and
I/O devices.
4. Data Transfer:
o After the address is set, the appropriate data is either read from memory or
written into memory.
The 8086 microprocessor uses these bus cycles to handle operations like reading from or
writing to memory or performing I/O operations.
In the 8086 microprocessor, when adding signed numbers, an overflow occurs if the result
exceeds the capacity of the destination register (i.e., it cannot fit in the register width).
For example, adding two large positive signed numbers or two large negative signed
numbers might lead to a result that cannot be represented within the range of the signed
number format.
Overflow Flag (OF): When an overflow occurs, the Overflow Flag (OF) in the flag
register is set to 1.
139 | P a g e
Example:
If you add 127 (7F in hexadecimal) and 127 (7F in hexadecimal) in an 8-bit register,
the result is 254 (FE in hexadecimal). However, 254 cannot be represented as an 8-bit
signed number (since the range of signed 8-bit values is from -128 to 127). Hence, the
overflow flag will be set.
In 8086, the Overflow Flag (OF) also gets set when an overflow occurs during a division
operation. This happens if the result exceeds the storage capacity of the registers used for storing
the quotient and remainder.
In 16-bit division (using DX:AX for the dividend), an overflow occurs if the quotient
cannot fit in the AX register or if the remainder cannot fit in the DX register.
Overflow Flag (OF): If the quotient or remainder overflows, the Overflow Flag (OF) is
set to 1.
Example:
If you divide a large dividend (e.g., FFFFH in DX:AX) by a small divisor (e.g., 2), the
quotient might not fit in the AX register, causing an overflow.
Let’s perform the addition of 65D1H and 2359H and examine the flag register.
1. Step-by-Step Addition:
2. 65D1H
2359H
8B2AH
140 | P a g e
- **Auxiliary Carry Flag (AF)**: No carry between bit 3 and bit 4 during the
addition, so **AF = 0**.
- **Parity Flag (PF)**: The result **8B2AH** has an even number of 1s in its
binary representation (**1000101100101010**), so **PF = 1**.
---
### **4. Show the Contents of Memory Locations After Execution of `MOV
[SI], AX`**
#### **Given**:
- **DS = 1120H**
- **SI = 2498H**
- **AX = 53EFH**
- **MOV [SI], AX** means that the contents of the **AX register** (which is
**53EFH**) will be moved to the memory location pointed to by the **SI
register**.
---
### **Summary**:
1. **Basic 8086 Bus Cycle**: It involves the address cycle, memory cycle, and
data transfer cycle.
2. **Overflow in Addition of Signed Numbers**: The Overflow Flag (OF) is set
when the result exceeds the signed number range.
3. **Overflow in Division**: The Overflow Flag (OF) is set if the quotient or
remainder overflows.
4. **Flags after Addition**: The flags after adding **65D1H** and **2359H**
are **CF = 0, OF = 0, SF = 0, ZF = 0, AF = 0, PF = 1**.
141 | P a g e
5. **MOV [SI], AX**: The contents of memory at **13798H** and **13799H** will
be **EF** and **53**, respectively, based on the values in **AX**.
---
Purpose of Interrupts:
Interrupts are used in microprocessors to handle asynchronous events (events that occur
independently of the processor's current execution). When an interrupt occurs, the processor
temporarily suspends its current execution to handle the interrupt, processes it, and then resumes
its previous task.
142 | P a g e
Here’s a simple Interrupt Processing Flow Diagram:
+------------------+
| Interrupt Occurs |
+------------------+
|
V
+----------------------+
| Processor Acknowledges |
| the Interrupt |
+----------------------+
|
V
+------------------------+
| Save Context (Registers)|
+------------------------+
|
V
+--------------------------+
| Fetch Interrupt Vector |
+--------------------------+
|
V
+---------------------------+
| Execute ISR (Interrupt |
| Service Routine) |
+---------------------------+
|
V
+----------------------------+
| Restore Context |
+----------------------------+
|
V
+----------------------------+
| Return to Main Program |
+----------------------------+
Definition: Maskable interrupts can be disabled (masked) by the processor. This means
that the processor can temporarily ignore these interrupts.
Example: Hardware interrupts, such as those for I/O devices, can be masked by
clearing the Interrupt Enable (IF) flag.
Usage: These are used when the processor is busy with higher-priority tasks and needs to
ignore certain interrupts temporarily.
143 | P a g e
Definition: Non-maskable interrupts cannot be disabled by the processor, meaning they
always have priority and cannot be ignored.
Example: Critical hardware errors, like power failure, are non-maskable interrupts that
need immediate attention.
Usage: These are reserved for situations where immediate attention is required, like
power failure or system crash scenarios.
Key Differences:
Pipelined Architecture:
Stages of Pipeline:
1. Fetch: The instruction is fetched from memory.
2. Decode: The instruction is decoded to determine the operation.
3. Execute: The operation is executed (e.g., ALU operations).
4. Memory Access: Data is read from or written to memory if needed.
5. Write-back: The result is written back to the register.
This parallelism improves the instruction throughput of the CPU, increasing its performance.
Pipelining in 8086:
The 8086 microprocessor uses a form of pipelining, but it’s not as advanced as in modern
CPUs. The 8086 has a two-stage pipeline consisting of:
1. Pre-fetch Queue:
o The 8086 uses a 6-byte pre-fetch queue to store instructions that are fetched in
advance.
o While the current instruction is being executed, the next instructions are fetched
and stored in the queue.
2. Execution:
144 | P a g e
o After the instruction is fetched from the queue, the processor decodes and
executes it.
o The pre-fetch queue allows the processor to fetch the next instruction while the
current instruction is being executed, leading to efficient use of the CPU's time.
Although the 8086's pipelining is simple (it only uses a pre-fetch queue), it still improves
performance by overlapping fetch and execution cycles.
Pipelining in 8086:
Fetch: While the current instruction is being executed, the next instruction is fetched and
stored in the pre-fetch queue.
Decode: The instruction is decoded, and the CPU begins executing it.
Execute: The instruction executes, but the next instruction is already ready to be
decoded.
Summary:
1. Interrupts allow the processor to handle external events efficiently. Interrupt processing
involves saving the context, processing the interrupt, and restoring the context.
2. Maskable Interrupts can be disabled by the processor, while Non-Maskable
Interrupts cannot be ignored and have higher priority.
3. Pipelined Architecture enables parallel processing of instructions, and in 8086,
pipelining is implemented using a pre-fetch queue that fetches instructions while others
are being executed.
What is DMA?
DMA (Direct Memory Access) is a feature that allows peripherals (e.g., I/O devices like disk
drives, sound cards, etc.) to directly transfer data to or from the memory without the involvement
of the CPU. This reduces the CPU’s workload and speeds up data transfer.
DMA Controller:
The DMA Controller is a special hardware component that manages data transfer between I/O
devices and the system’s memory. It takes over control of the system bus to directly move data
between I/O devices and memory, bypassing the CPU, which speeds up data transfer and reduces
CPU overhead.
DMA Channels: 8237 has 4 independent DMA channels (Channel 0 to Channel 3) for
data transfer.
Control Registers: These are used for configuring and controlling DMA operations.
Request Line (DREQ): The line that an external device uses to request a DMA transfer.
Acknowledge Line (DACK): The line used by the DMA controller to acknowledge that
a DMA request is accepted and data transfer can begin.
Status Register: Contains flags to indicate the status of each DMA channel.
Bus Control Lines: These are used to take control of the system bus and allow DMA
data transfer.
+------------------------+
| Control Registers |
+------------------------+
| Channel 0 | Channel 1 |
| Channel 2 | Channel 3 |
+------------------------+
|
+----------------------------+
| DMA Request (DREQ) |
| & Acknowledge (DACK) |
+----------------------------+
|
+----------------------+
| Memory/Peripheral |
+----------------------+
|
+------------------+
| CPU (Bus Cycle) |
+------------------+
Key Functions:
DMA Request (DREQ): I/O devices use this line to signal that they need to transfer
data.
DMA Acknowledge (DACK): When the controller acknowledges a request, data is
transferred.
Channel Control: Each channel is independently controlled by the DMA controller to
facilitate transfers between devices and memory.
146 | P a g e
Interrupt Controller 8259A:
The 8259A is a programmable interrupt controller used to manage multiple interrupt sources in a
microprocessor system. It allows the CPU to handle interrupts more efficiently by prioritizing
interrupt requests and enabling/disabling specific interrupts.
The 8259A interrupt controller provides a mechanism for handling interrupts in a system by
providing control over interrupt requests. It can manage multiple interrupt sources and prioritize
them.
+-----------------------------------+
| Interrupt Control Registers |
+-----------------------------------+
| Command Register (ICW1, ICW2) |
| Interrupt Mask Register (IMR) |
| Priority Register (IRR) |
| End of Interrupt Register (EOI) |
+-----------------------------------+
| | |
| | |
+------------------------+------------------------+
| IRQ Lines |
+-----------------+ +-----------------+ +-----------------+
| IRQ0 (Timer) | | IRQ1 (Keyboard) | | IRQ2 (Cascade) |
+-----------------+ +-----------------+ +-----------------+
| |
V V
+-------------------------+
| CPU (INTERRUPT SERVICE) |
+-------------------------+
Key Components:
1. Interrupt Request Lines (IRQ0 to IRQ7): These lines receive the interrupt requests
from various peripherals. Each interrupt line corresponds to a specific device (e.g., IRQ0
for the timer, IRQ1 for the keyboard, etc.).
2. Interrupt Mask Register (IMR): It is used to mask (disable) specific interrupts. Each bit
in the IMR corresponds to an interrupt request line. If the bit is 1, the interrupt is
disabled; if 0, the interrupt is enabled.
3. Interrupt Request Register (IRR): This register holds the interrupt requests from
devices. It indicates which devices are requesting an interrupt.
4. Priority Register: This register holds the priority level of the active interrupt requests.
The 8259A uses a priority scheme to determine which interrupt to service first.
5. End of Interrupt (EOI) Register: This register is used to send an EOI signal to the
8259A when an interrupt service routine has been completed, signaling that the processor
can handle another interrupt.
147 | P a g e
6. Initialization Command Word (ICW1, ICW2, ICW3, ICW4): These are command
words that initialize the interrupt controller. ICW1 starts the initialization sequence,
ICW2 provides the interrupt vector base, ICW3 defines the cascade configuration, and
ICW4 sets the operating mode.
Features of 8259A:
Summary:
1. DMA Controller (8237) allows direct data transfer between memory and peripherals,
reducing CPU load. It includes channels for multiple data transfers.
2. Interrupt Controller 8259A efficiently manages and prioritizes interrupts from multiple
devices, with features like masking, priority management, and the ability to cascade
multiple controllers.
If you need more detailed information on any of these components, feel free to ask!
The 8255A is a versatile Programmable Peripheral Interface (PPI) used to interface the
microprocessor with I/O devices, enabling the microprocessor to communicate with peripherals
like keyboards, displays, sensors, etc. It has three primary operating modes:
Purpose: This is the simplest mode of operation for interfacing the microprocessor with
I/O devices. It supports basic digital input and output operations.
Operation:
o Each of the 8 pins of Port A, Port B, and Port C (which are divided into two 4-bit
halves) can be individually programmed as input or output.
o Data can be read from or written to the port.
o There is no handshake involved in this mode.
Example Use: A basic push-button interface for input or a simple LED control for output.
148 | P a g e
2. Mode 1 (Strobed Input/Output Mode)
Purpose: This mode is designed for devices that require data to be latched. It is suitable
for situations where a peripheral device (like a sensor or keyboard) needs to send data to
the microprocessor in a controlled manner using strobe signals.
Operation:
o Data is transferred to or from the microprocessor via a strobe signal, which
controls when data is read or written.
o Port A or Port B operates in input or output mode, and Port C provides control
signals (such as the strobe signal) to synchronize data transfers.
Example Use: Interfacing with a keypad, where the microprocessor can read the keys when the
strobe signal is triggered.
Purpose: This mode allows for bidirectional data transfer, making it suitable for
interfacing with devices that require two-way communication (e.g., data transfer between
the microprocessor and memory or other peripherals).
Operation:
o Port A is used in this mode for bidirectional data communication.
o Port C controls the direction of data flow (input or output) using two control
signals (called Read/Write).
o It allows data to be written to or read from Port A in both directions, depending
on the control signals.
o This mode provides handshaking signals that control when data is transferred.
Example Use: A communication interface between the microprocessor and another device,
where both devices can send and receive data (e.g., communication with a printer).
Microprocessors typically communicate with memory and I/O devices through a system of buses
(address bus, data bus, and control bus). These buses are used to transmit the necessary
information to access memory locations or interact with I/O devices.
The memory interface connects the microprocessor with the memory (RAM or ROM) of a
system. Here’s how it works:
Address Bus: The microprocessor sends an address to the memory. This address
corresponds to a specific memory location.
149 | P a g e
Data Bus: The data is either written to or read from the specified memory location. The
data bus transmits this data.
Control Bus: The control signals tell the memory whether the operation is a read or
write and when it should occur.
I/O devices (such as keyboards, sensors, printers) are interfaced with the microprocessor using
various I/O ports (either directly or through peripherals like the 8255 PPI).
Port-mapped I/O (PM I/O): The I/O devices are treated as if they are memory locations.
The microprocessor accesses them by placing their I/O address on the address bus.
Memory-mapped I/O (MM I/O): The I/O devices share the same address space as the
memory. The microprocessor uses the same address and data buses to access both
memory and I/O devices.
1. The microprocessor sends the I/O address to the I/O device via the address bus.
2. The microprocessor sends a read signal to the I/O device through the control bus.
3. The I/O device places the data on the data bus, and the microprocessor reads it.
The microprocessor places the address of the 8255 in the address bus.
150 | P a g e
The 8255 peripheral can be configured to operate in different modes (Input, Output,
Bidirectional) depending on the requirements.
The microprocessor communicates with the 8255 to send or receive data.
Summary:
1. 8255A Modes:
o Mode 0: Basic I/O.
o Mode 1: Strobed I/O (used for interfacing devices like keypads).
o Mode 2: Bidirectional Bus I/O (used for communication with devices needing
two-way data flow).
2. Microprocessor Interface with Memory:
o Involves the address, data, and control buses for accessing memory locations
(read/write).
3. Microprocessor Interface with I/O:
o Port-mapped I/O: Treats I/O devices as memory addresses.
o Memory-mapped I/O: Shares address space between memory and I/O devices,
enabling data transfer using the same bus system.
The 8259 Programmable Interrupt Controller (PIC) is used to handle interrupt requests from
external devices. It has several important registers involved in managing interrupts:
Function: This register keeps track of the interrupts that are currently being serviced.
Working: When an interrupt request is acknowledged, the corresponding bit in the ISR is
set to 1. Once the interrupt is processed, the bit is cleared.
Purpose: It ensures that interrupts that are being handled are not re-triggered.
Function: The masking register is used to control which interrupt requests are enabled
or disabled.
Working: Each bit in the register corresponds to a particular interrupt. If the bit is set to
1, the interrupt is masked (disabled). If the bit is set to 0, the interrupt is enabled.
Purpose: It prevents the processing of interrupts that are not yet to be handled or
interrupts that should be ignored during certain operations.
151 | P a g e
Function: The IRR holds the pending interrupt requests.
Working: When an interrupt request (IRQ) is raised by an external device, the
corresponding bit in the IRR is set to 1. This register keeps track of all interrupts waiting
to be serviced.
Purpose: It helps the interrupt controller keep track of multiple interrupt requests,
enabling the system to prioritize them and process them in order.
The 8254 Programmable Interval Timer (PIT) is used for time-delay generation and
frequency control in systems. Some of its features include:
Three independent 16-bit counters: Each counter can be used to generate timed
intervals or specific frequencies.
Programmability: The 8254 allows you to program the timer to operate in different
modes, such as generating square waves or time delays.
Multiple Operating Modes: It supports several modes of operation like Mode 0
(Interrupt on Terminal Count), Mode 2 (Rate Generator), Mode 3 (Square Wave
Generator), etc.
Clock Input: It uses an external clock frequency to generate time intervals.
Counter Control Register: This register is used to configure the operation and behavior
of the timers.
Both the 8253 and 8254 are programmable interval timers, but there are some differences
between them:
In short, the 8254 offers more flexibility and better performance compared to the 8253.
152 | P a g e
4) Polling Method and Pipeline Method
Definition: In the polling method, the CPU repeatedly checks (polls) the status of an I/O
device or peripheral to see if it needs attention. This happens in a loop, where the CPU
checks the device status and handles it if necessary.
Disadvantage: The CPU spends time checking devices even when no interrupts are
present, which can waste processing power and reduce efficiency.
Example: The CPU checks every few cycles whether a device like a keyboard is ready to send
data.
Definition: The pipeline method refers to the technique used in processor design where
multiple instructions are overlapped in execution to increase the CPU’s throughput. This
is different from the polling method, as it's related to the processor's internal handling of
instructions, not device management.
Purpose: It allows multiple stages of instruction execution (fetch, decode, execute) to
happen simultaneously for different instructions, leading to better performance.
Example: An instruction is being fetched while another is being decoded and yet another is
being executed in parallel.
The 8254 Programmable Interval Timer operates in several modes, each with a distinct
functionality:
In this mode, the timer generates an interrupt when the counter reaches zero (terminal
count).
The counter generates a single pulse when triggered and then stops until triggered again.
153 | P a g e
The counter generates a square wave at a programmable rate. The period of the wave can
be adjusted by the value in the timer.
Similar to Mode 2 but the output is a square wave, continuously generated until the
counter is reset.
Similar to Mode 4, but the strobe is triggered by hardware input rather than software.
Direct Memory Access (DMA) is a feature that allows peripherals to directly access memory
without involving the CPU, enabling faster data transfer.
154 | P a g e
1. DMA Controller (8237): It manages the data transfer between I/O devices and memory.
2. CPU: Initiates the DMA process but does not control data transfer.
3. Memory: Stores data transferred by the DMA controller.
4. I/O Device: Sends or receives data to/from the memory.
DMA Operation:
The CPU initiates a DMA transfer by informing the DMA controller of the data transfer.
The DMA controller takes control of the system bus, temporarily suspends the CPU, and
transfers data directly between the memory and the I/O device.
Once the transfer is complete, the DMA controller signals the CPU that the operation is
finished.
I hope this clarifies everything! Let me know if you need further explanations on any part.
SESSION 2014-15
1) Evolution of Microprocessor
The evolution of microprocessors has been driven by advances in technology, leading to smaller,
more powerful, and energy-efficient processors. Here is a brief overview of the evolution:
Intel 4004 (1971): The first commercially available microprocessor with a 4-bit
architecture.
Intel 8008 (1972): The first 8-bit microprocessor, marking the transition to more
powerful processing.
Intel 8080 (1974): A significant advancement, it supported more instructions and more
memory, becoming popular in early personal computers and embedded systems.
Zilog Z80 (1976): A widely used 8-bit processor with an architecture similar to the Intel
8080, but with better support for interrupt handling and I/O operations.
Intel 8086 (1978): The first 16-bit microprocessor with a 16-bit data bus and 20-bit
address bus, allowing access to 1MB of memory. This was the precursor to the x86
architecture.
Intel 80286 (1982): Improved upon the 8086, allowing for protected mode, which
enabled multitasking.
155 | P a g e
1.4 32-bit Microprocessors:
Intel 80386 (1985): Introduced 32-bit processing, enabling more powerful applications
and better multitasking with 4GB of addressable memory.
Intel 80486 (1989): Featured an integrated floating-point unit (FPU) and improved
performance.
Intel Pentium Pro (1995): Introduced 64-bit processing for better performance in
scientific and engineering applications.
Intel Core i7 (2008): A high-performance 64-bit microprocessor that laid the foundation
for modern CPUs used in laptops, desktops, and servers.
As of today, processors are continually evolving with increased core count, higher clock speeds,
better energy efficiency, and support for parallel processing, such as in AMD Ryzen and Intel
Core series.
In microprocessor terminology, a bus refers to the physical pathways used for communication
between the processor and other components (such as memory and I/O devices).
8-bit Bus: The processor can transfer 8 bits (1 byte) of data at a time. It can handle an
address space of up to 256 bytes of memory (with an 8-bit address bus).
16-bit Bus: The processor can transfer 16 bits (2 bytes) of data at a time. It supports a
larger memory address space and allows for better performance in handling larger chunks
of data.
32-bit Bus: The processor can transfer 32 bits (4 bytes) of data at a time, allowing it to
access a larger memory address space (4GB of RAM or more) and perform more
complex calculations.
Performance: A wider bus means the processor can transfer more data at once,
improving speed and processing power.
Memory Addressing: The size of the address bus determines how much memory the
processor can address. For example, a 32-bit address bus can access up to 4GB of
memory.
156 | P a g e
Physical Address:
o The actual address in the physical memory (RAM).
o This is the address that the memory management unit (MMU) translates the
logical address into.
Logical Address:
o Also called virtual address, it is the address generated by the CPU during a
program's execution.
o The logical address is mapped to a physical address by the MMU using paging or
segmentation.
Key Differences:
Given:
5) Show the Contents of Memory Locations after the Execution of MOV [SI], AX
Given:
DS = 1120H
157 | P a g e
SI = 2498H
AX = 53EFH
The MOV [SI], AX instruction moves the contents of the AX register into the memory location
addressed by the SI register.
After executing MOV [SI], AX, the contents of memory location 3618H will be:
Thus, memory location 3618H will contain EF, and 3619H will contain 53.
These features made the 8086 a significant improvement over earlier microprocessors like the
8080 and laid the foundation for modern x86 architecture.
158 | P a g e
Let me know if you need more clarification!
The primary goal of Instruction Set Design is to create a set of instructions that allows the
processor to execute operations efficiently and effectively, balancing performance, ease of
implementation, and flexibility. Here are the key goals:
1. Simplicity: The instruction set should be easy for the programmer to understand and use.
Simple instructions reduce the complexity of writing and debugging code.
2. Efficiency: The instruction set should allow the processor to execute programs as
efficiently as possible. This involves optimizing for speed and minimizing the number of
cycles required to execute common operations.
3. Completeness: The set of instructions should be comprehensive enough to handle all
necessary computational tasks for general-purpose computing, including arithmetic,
logical operations, data movement, and control operations.
4. Flexibility: The instruction set should be flexible to accommodate a variety of
applications. It should support the ability to address memory, perform calculations, and
handle conditional logic.
5. Orthogonality: The instruction set should minimize exceptions and restrictions. Ideally,
different instructions should use the same modes of addressing and operand types,
allowing for generality and simplicity.
6. Size: The number of instructions should be balanced. Too few instructions may limit the
capability of the processor, while too many may lead to complex design and slow
execution.
7. Compatibility: The instruction set should be backward compatible to ensure that existing
programs can run on newer processors with minimal changes.
Purpose: The XLAT instruction translates the value of the operand through a lookup
table in memory. It is used with the AL register and the BX register.
Operation: The AL register contains the byte to be translated, and the BX register points
to the base address of the translation table. The value at the memory address BX + AL is
loaded into the AL register.
Example:
XLAT
This instruction is commonly used for tasks like character translation or encryption.
159 | P a g e
PUSH (Push to Stack)
Purpose: The PUSH instruction is used to place a 16-bit value onto the stack.
Operation: It decrements the stack pointer (SP) and then stores the value at the location
pointed to by the stack pointer.
Example:
PUSH AX
This will push the contents of the AX register onto the stack, effectively saving its value.
Purpose: The POP instruction is used to retrieve the 16-bit value from the top of the
stack.
Operation: It loads the value from the stack into the specified register and increments the
stack pointer (SP).
Example:
POP BX
This will pop the value from the stack and store it in the BX register.
XCHG (Exchange)
Purpose: The XCHG instruction swaps the contents of two registers or a register and a
memory location.
Operation: It exchanges the values between the two operands.
Example:
XCHG AX, BX
The 8086 microprocessor has a set of predefined interrupt vectors. These interrupt types are a
part of the interrupt system and are used for various hardware and software events.
1. Interrupt 0 - Divide Error: This interrupt occurs when there is a division by zero or an
overflow in division. It is triggered automatically by the processor if a division operation
results in an error.
2. Interrupt 1 - Single Step: This interrupt is used for debugging purposes. It causes the
processor to stop after each instruction is executed.
160 | P a g e
3. Interrupt 2 - Non-maskable Interrupt (NMI): This interrupt is used for critical errors
or hardware failures and cannot be disabled by masking.
4. Interrupt 3 - Breakpoint: Similar to the single-step interrupt, but it is triggered by a
INT 3 instruction in the program. It is also used for debugging.
5. Interrupt 4-15: These are software interrupts that the programmer can define and use
in the software for various system operations. They are called using the INT instruction
and are used for system calls, error handling, and custom interrupt handling.
These interrupts allow the processor to handle different events in an organized manner, allowing
for multitasking and error detection.
These signals are part of the 8085 microprocessor's control signals used for managing the
operation of the microprocessor and its interaction with external devices.
Purpose: This signal is used to indicate that the processor is in a specific state (usually
when the processor is executing an instruction).
Operation: This is typically used in debugging or when the external system needs to
know the status of the processor.
READY:
Purpose: The READY signal is used to synchronize the microprocessor with slower
external devices (like memory or I/O devices).
Operation: If the external device is ready to send or receive data, the READY signal is
activated. If the device is not ready, the READY line stays low and causes the processor
to wait for the device to be ready before proceeding with further operations.
HOLD:
Purpose: The HOLD signal is used by external devices to request control of the system
bus, typically when another device needs to perform some operations that require bus
access.
Operation: When HOLD is activated, the microprocessor relinquishes control of the
system bus.
Purpose: The HLDA signal is used to acknowledge the HOLD signal from external
devices.
161 | P a g e
Operation: When the microprocessor receives the HOLD signal, it acknowledges the
request by sending the HLDA signal, indicating that it has given up control of the system
bus.
These functions play a crucial role in ensuring proper synchronization between the
microprocessor and external peripherals, enabling efficient data transfer and system control.
The Intel 8259A is a programmable interrupt controller used in the 8085 microprocessor system.
Some of its key features include:
The Accumulator (A register) is one of the most important registers in the 8085
microprocessor. It is used for:
162 | P a g e
3) What is a Bus? Explain the Bus Structure of the 8085 Microprocessor
A Bus is a system of pathways used for communication between the microprocessor and other
devices (memory, I/O devices, etc.). The bus carries data, address, and control signals.
1. Data Bus (8 bits): This bus is used for transferring data between the microprocessor and
memory or I/O devices. The 8085 has an 8-bit data bus, meaning it can transfer 8 bits of
data at a time.
2. Address Bus (16 bits): The address bus carries the address of the memory or I/O device
that the processor wants to access. The 8085 has a 16-bit address bus, allowing it to
address 64KB (65536) memory locations.
3. Control Bus: The control bus is used to send control signals, such as read/write signals,
to indicate whether the processor is reading data from or writing data to memory or I/O
devices. It also includes signals like IO/M (memory or I/O operation) and RD (read) or
WR (write).
163 | P a g e
5) What Do You Mean by Pipelined Architecture? How is it Implemented in
8086?
Pipelined Architecture:
Pipelining is a technique used in modern processors to increase their throughput (the number of
instructions completed per unit of time). In a pipelined architecture, multiple instruction stages
are overlapped, allowing the next instruction to begin processing before the previous one has
finished.
For example:
Each of these stages works in parallel, so while one instruction is being executed, the next
instruction can be fetched and decoded, improving the overall processing speed.
Implementation in 8086:
The pipelining in 8086 allows instructions to be executed more quickly because while the
processor is executing one instruction, it can fetch the next instruction, thus optimizing the
processor's overall performance.
Channel Property:
In DMA (Direct Memory Access) systems, a channel is the pathway through which data is
transferred between the memory and I/O devices without the involvement of the processor. Each
channel has specific properties that determine its capabilities, such as:
164 | P a g e
In systems with multiple DMA channels, priority determines which channel gets access to the
system bus first when multiple DMA requests are made. Typically:
Priority Arbitration: DMA channels are assigned priority levels, and higher-priority
channels are allowed to use the bus first.
Round-robin or Fixed Priority: In some systems, DMA channels are handled in a
round-robin manner (equal priority), while in others, specific channels may be given
fixed priority based on their importance or type of data being transferred.
In a DMA system, triggers are signals that initiate the data transfer process. Different DMA
triggers include:
Each trigger type ensures that data transfers occur at the right time without unnecessary
processor intervention, improving system efficiency.
165 | P a g e
3. Advantages & Disadvantages of Assembly Language Over High-Level
Language
Advantages Disadvantages
Faster execution (more efficient) Hardware-dependent
Precise control over hardware Difficult to write and debug
Uses less memory Not portable across platforms
Useful in embedded systems Requires deep knowledge of architecture
4. Assembly Code: Input Two Integers and Print Result if Less Than 10
(8086 Example)
Note: 8086 doesn't have built-in I/O. The following is a conceptual code assuming the inputs are
in registers.
ADD AL, BL ; AL = AL + BL
SKIP_PRINT:
This example assumes the use of DOS INT 21h services. In a real system, user input/output
would require proper hardware interfacing or OS calls.
Would you like the same program written in C language or more advanced 8086 format with
input handling?
SESSION 2013-14
SEMESTER
Here’s a detailed and easy-to-understand explanation for your questions:
166 | P a g e
1. Explain the Programming Model of 8085 Microprocessor
The programming model of the 8085 microprocessor refers to the internal structure visible to
the programmer. It includes:
Accumulator (A):
Flag Register:
16-bit register that holds the address of the next instruction to be executed.
Temporary Register:
167 | P a g e
2. How Does a Microprocessor Differentiate Between Data and Instruction
Code?
So, it is the control logic and program flow that tells the microprocessor which bytes are data
and which are instructions.
Instruction:
JMP 2050H
This instruction tells the 8085 to jump to the address 2050H unconditionally.
Machine Code:
C3 50 20
Byte Meaning
C3H Opcode for JMP addr16
50H Lower byte of address (2050H)
20H Higher byte of address (2050H)
Note: In 8085, addresses are stored in little-endian format (low byte first, then high byte).
Would you like a list of other jump instructions and their machine codes too?
168 | P a g e
1. What is a Flag in Microprocessor?
A flag is a 1-bit status indicator used to show the result of arithmetic and logic operations.
In the 8085 microprocessor, there are 5 important flags in the flag register:
Flag Meaning
S Sign Flag – Set if result is negative
Z Zero Flag – Set if result is zero
AC Auxiliary Carry – Used in BCD ops
P Parity – Set if result has even parity
CY Carry Flag – Set if carry is generated
2. Why Are Program Counter (PC) and Stack Pointer (SP) 16-bit Registers?
Because the 8085 has a 16-bit address bus, it can address up to 2¹⁶ = 65,536 (64 KB) memory
locations.
So, both PC and SP must be 16-bit to store any valid memory address between 0000H and
FFFFH.
The Program Counter (PC) is a 16-bit register that holds the address of the next instruction
to be executed.
4. If the Memory Chip Size is 256 × 4 bits, How Many Chips Are Required to
Make Up 1K Bytes?
169 | P a g e
Step 2: Required memory = 1K = 1024 bytes
Primary Memory:
Secondary Memory:
Cache Memory:
Registers:
The 8085 microprocessor uses control signals and status lines to generate these:
For Memory:
Generated using:
For I/O:
Generated using:
These signals are decoded using logic circuits (like NAND/AND gates) along with control/status
signals from the 8085.
Would you like diagrams for memory and I/O control signal generation too?
a. Illustrate the steps of data flow when the instruction code (8AH – MOV D, A),
stored in location 2006H, is being fetched
171 | P a g e
Instruction: MOV D, A
Opcode = 8A (this tells the processor to move the contents of register A to register D)
Stored at memory location = 2006H
1. PC points to 2006H
o The Program Counter (PC) holds the address 2006H.
2. Address is placed on the address bus
o The 8085 microprocessor sends the address 2006H via the address bus (split as
high and low using multiplexing).
3. Memory Read (MEMR̅) signal is activated
o Tells the memory to place the data at 2006H on the data bus.
4. Opcode (8A) is placed on the data bus
o Memory puts the instruction 8A on the data bus.
5. Data is read by the microprocessor
o The instruction MOV D, A (8A) is loaded into the Instruction Register.
6. PC is incremented to 2007H
o PC is ready to fetch the next instruction.
1. The microprocessor places the lower address (A0–A7) on AD7–AD0 during T1.
2. A control signal ALE (Address Latch Enable) goes HIGH during T1.
3. An external latch (like 74LS373) captures this address using ALE.
4. When ALE goes LOW after T1, AD7–AD0 lines are now used as a data bus.
5. The previously latched address is held in the external latch for memory access.
Result: Address and data are separated using ALE and a latch.
172 | P a g e
c. How the Physical Address is Obtained from a Logical Address (in 8086)
In 8086, addresses are 20-bit physical addresses, but instructions use 16-bit segment and 16-
bit offset (logical address).
Formula to convert:
Example:
173 | P a g e
SBB: Subtract with borrow.
INC: Increment. Example: INC AX
DEC: Decrement. Example: DEC CX
NEG: Two’s complement. Example: NEG AL
MUL: Unsigned multiply.
IMUL: Signed multiply.
DIV: Unsigned divide.
IDIV: Signed divide.
CMP: Compares two operands (like subtraction but doesn’t store result).
DF (Direction Flag):
o Controls string operations.
o DF = 0 → Auto-increment (forward)
o DF = 1 → Auto-decrement (backward)
SF (Sign Flag):
o Indicates sign of result.
o SF = 1 → Negative result
o SF = 0 → Positive result
ADD_LOOP:
MOV AX, [SI]
ADC AX, [DI] ; Add with carry
MOV [BX], AX ; Store result
INC SI
INC SI
INC DI
INC DI
INC BX
INC BX
LOOP ADD_LOOP
174 | P a g e
5. Discuss the Address Bus and Data Bus Concepts of 8086 Microprocessor:
Address Bus:
o 20-bit wide
o Can address up to 1MB (2²⁰) memory
o Unidirectional
Data Bus:
o 16-bit wide
o Transfers data between CPU and memory/I/O
o Bidirectional
Invalid Instruction
BLis an 8-bit register; CX is a 16-bit register.
You can't move data between different sizes directly.
Correct way:
o MOV CL, BL (both 8-bit)
o MOV BX, CX (both 16-bit)
Steps:
175 | P a g e
5. Returns control to CPU via HLDA (Hold Acknowledge).
DMA is faster and efficient for bulk data transfer, like from disk to memory.
SESSION 2012-13
CT
Sure! Let’s go through each question one by one in simple and clear language:
Advantage Description
Speed Programs written in assembly are faster and use less memory.
Hardware Control Provides direct access to hardware (e.g., memory, ports).
Highly optimized programs can be created for time-critical
Efficiency
systems.
Size Code size is smaller compared to high-level language code.
Useful for Embedded
Ideal where resources (RAM/ROM) are limited.
Systems
However, assembly language is more difficult to learn and write than high-level languages like C
or Python.
1. Memory-Mapped I/O:
o I/O devices are treated as if they are memory locations.
176 | P a g e
o The same instructions (like MOV) used to access memory can be used to access
I/O.
o Takes up memory address space.
2. I/O Mapped I/O (Isolated I/O):
o Separate address space for I/O devices.
o Uses special instructions like IN and OUT.
o Does not consume memory address space.
3. Direct Memory Access (DMA) Mapping:
o Used when DMA controller directly transfers data between I/O and memory.
o Processor is bypassed temporarily.
o Efficient for large data transfer.
Example:
MVI A, 05H
ADD B ; Adds value of register B to accumulator A
What is a Bus?
A bus is a group of wires used to transfer data, address, or control signals between
components of a computer system.
177 | P a g e
5. Calculate the address lines required for a 16K-byte memory chip for 8085
microprocessor.
Solution:
1K = 1024 bytes
16K = 16 × 1024 = 16384 bytes
So:
2^n = 16384
=> n = log₂(16384) = 14
Here are clear and direct answers to each of your questions related to microprocessor
fundamentals and interfacing:
Techniques:
1. Memory Decoding:
o Full decoding: All address lines are used to select unique memory locations.
o Partial decoding: Only some address lines are used (simpler but may cause
mirroring).
2. Address Mapping:
178 | P a g e
oDivide address range for ROM, RAM, and I/O.
3. Memory Chip Selection:
o Use decoder circuits (e.g., 3-to-8 decoder) to select memory chips based on
address.
4. Banking:
o Used in 16-bit systems to combine 8-bit memory chips (even and odd banks for
high/low byte).
Instruction Function
MOV A, B Copy content from register B to A
LDA 2500H Load accumulator from memory address 2500H
STA 2700H Store accumulator value to memory location 2700H
MVI C, 0AH Move immediate data (0A) into register C
5. Explain INTR instruction in detail and give the difference from other
hardware interrupts.
179 | P a g e
Requires external hardware to provide the instruction to execute (usually via data bus).
A pending interrupt is an interrupt request that has occurred but hasn’t been serviced
yet because:
o Interrupts are disabled (IF=0).
o CPU is currently executing a higher priority interrupt.
o Instruction cycle hasn’t reached a point to check for interrupts.
8. Design an interfacing circuit to read data from an A/D converter using the
8255A in memory-mapped I/O.
180 | P a g e
Example Memory Map:
Code Example:
181 | P a g e