Microprocessor Question Solve
Microprocessor Question Solve
Microprocessor Question Solve
(Midterm-2021)
1.(a) Explain the internal Architecture of the 8086 microprocessor using a block
diagram.
Ans.
Internal Architecture of 8086:
Fig. 6.2 shows a block diagram of Internal Architecture of 8086. It is internally
divided into two separate functional units. These are the Bus Interface Unit
(BIU) and the Execution Unit (EU). These two functional units can work
simultaneously to increase system speed and hence the throughput. Throughput
is a measure of number of instructions executed per unit time.
The execution unit of Internal Architecture of 8086 tells the BIU from where to
fetch instructions or data, decodes instructions and executes instructions. It
contains
Control Circuitry
Instruction Decoder
Arithmetic Logic Unit (ALU)
Flag Register
General Purpose Registers
Pointers and Index Registers
(b) What does addressing mode mean? Discuss the several addressing modes
used by 8086 microprocessor.
Ans.
Addressing mode:
The way of specifying data to be operated by an instruction is known
as addressing modes. This specifies that the given data is an immediate data or an
address. It also specifies whether the given operand is register or register pair.
Types of addressing modes:
i.Register mode – In this type of addressing mode both the operands are
registers.
Example:
MOV AX, BX
XOR AX, DX
ADD AL, BL
ii.Immediate mode – In this type of addressing mode the source operand is a 8 bit
or 16 bit data. Destination operand can never be immediate data.
Example:
MOV AX, 2000
MOV CL, 0A
ADD AL, 45
AND AX, 0000
Note that to initialize the value of segment register an register is required.
MOV AX, 2000
MOV CS, AX
iii.Displacement or direct mode – In this type of addressing mode the effective
address is directly given in the instruction as displacement.
Example:
MOV AX, [DISP]
MOV AX, [0500]
iv.Register indirect mode – In this addressing mode the effective address is in SI,
DI or BX.
Example: Physical Address = Segment Address + Effective Address
MOV AX, [DI]
ADD AL, [BX]
MOV AX, [SI]
v.Based indexed mode – In this the effective address is sum of base register and
index register.
Base register: BX, BP
Index register: SI, DI
The physical memory address is calculated according to the base register.
Example:
MOV AL, [BP+SI]
MOV AX, [BX+DI]
vi.Indexed mode – In this type of addressing mode the effective address is sum of
index register and displacement.
Example:
MOV AX, [SI+2000]
MOV AL, [DI+3000]
vii.Based mode – In this the effective address is the sum of base register and
displacement.
Example:
MOV AL, [BP+ 0100]
viii.Based indexed displacement mode – In this type of addressing mode the
effective address is the sum of index register, base register and displacement.
Example:
MOV AL, [SI+BP+2000]
ix.String mode – This addressing mode is related to string instructions. In this the
value of SI and DI are auto incremented and decremented depending upon the
value of directional flag.
Example:
MOVS B
MOVS W
x.Input/Output mode – This addressing mode is related with input output
operations.
Example:
IN A, 45
OUT A, 50
xi.Relative mode –
In this the effective address is calculated with reference to instruction pointer.
Example:
JNZ 8 bit address
IP=IP+8 bit address
(b) Draw the block diagram of 8086 microprocessor system overview and
Explain how data is transferred with in the 8086 microcomputer system.
Ans.
The architecture of 8086 microprocessor is composed of 2 major units, the BIU
i.e., Bus Interface Unit and EU i.e., Execution Unit. The figure below shows the
block diagram of the architectural representation of the 8086 microprocessor:
Data Transfer Instructions
These instructions are used to transfer the data from the source operand to the
destination operand. Following are the list of instructions under this group −
Final Exam-2021
1.(a) What are the functions of microprocessors? Differentiate microprocessor
and microcontroller.
Ans.
Difference between microprocessor and microcontroller:
8 bit microprocessor:-
8-bit is an early computer hardware device or software program that is capable of
transferring eight bits of data at the same time
The Intel 8085 is an 8-bit microprocessor. Its data bus is 8-bit wide and hence, 8 bits of
data can be transmitted in parallel from or to the microprocessor.
16 bit microprocessor:-
The 16 bit Microprocessor means that it has 16 address lines.
A 16 bit microprocessor is having 16bit register set. It have 16 address and data lines to
transfer address and data both. Hence it is 16 address lines. The maximum addresses
are 2^16 means 65536.
a)What is the Flag register? Discuss the role of five flag registers in an ALU
operation using an example.
Ans.
Flag register:
The flag register is a special register. It is an 8-bit, 16-bit, or 32-bit register and
does not make any sense as a unit. Instead, each bit has the same meaning. The
flag register bits operate independently; their combined value has no meaning.
11011011
+ 10010101
--------------------
101100100
Sign Flag (SF): The MSB of the result is 1 (indicating a negative value); therefore,
SF is set.
Carry Flag (CF): There is no carry from the most significant bit; thus, CF is cleared.
Parity Flag (PF): The result, 101100100, has four set bits (1s), which is an even
count. Thus, PF is set.
b) Draw pin diagram of 8086 microcomputer system overview and explain how
data is transferred with in the 8086 microcomputer system.
Ans.
Following is the table showing the list of data transfer instructions:
PUSHA none put all the registers into the stack PUSHA
POPA none gets words from the stack to all registers POPA
XCHG [2050],
XCHG D, S exchanges contents of D and S
AX
OPCODE OPERAND EXPLANATION EXAMPLE
LAHF none loads AH with the lower byte of the flag register LAHF
PUSHF none copies the flag register at the top of the stack PUSHF
Ans.
4.
Ans.
Here are the main tasks of the AX (Accumulator) and IP (Instruction Pointer)
registers in the 8086 microprocessor:
AX register (Accumulator):
b) Find the memory address of the next instruction executed by the μ-processor,
when operated in the real mode, for the following CS:IP -
Ans.
In real mode of the 8086 microprocessor, the physical memory address of the
next instruction executed is calculated by combining the segment address (CS)
and the offset address (IP).
To find the memory address of the next instruction, we combine the CS and IP
values, and the result is the physical memory address.
= 67533H
ii) CS=3476H and IP=IA00H (IA00H can be read as 0A00H since IA is just a
representation of the hex value 0A):
= 55616H + 0A00H
= 56616H
Ans.
5.
Ans.
Interrupt:
Ans.
c) Write short notes on following terms:
i) LEA
ii) MOV
iii) PUSH
iv) POP
Ans.
iii) PUSH:
PUSH is an assembly language instruction used to push (store) data onto the
stack. It decrements the stack pointer and copies the value from a register or a
memory location onto the top of the stack. PUSH is commonly used to save the
context of a program before calling a subroutine or handling interrupts.
iv) POP:
POP is an assembly language instruction used to pop (retrieve) data from the
stack. It copies the value from the top of the stack into a register or a memory
location and then increments the stack pointer. POP is often used to restore the
context of a program after returning from a subroutine or an interrupt handler.
Ans.
Synchronous Transmission:
Asynchronous Transmission:
Ans.
The block diagram of a microcontroller typically includes the following key
components:
Central Processing Unit (CPU): The core that executes instructions and
performs data processing.
Memory: Program memory (Flash/ROM) holds the firmware, and data
memory (RAM) stores variables during execution.
Input/Output Ports (I/O): Interfaces with external devices for data
exchange.
Timer/Counters: Provides timing-related functions for accurate delays and
measurements.
Analog-to-Digital Converter (ADC): Converts analog signals from sensors to
digital values.
Serial Communication Interfaces: Enables communication with other
devices using UART, SPI, or I2C.
Interrupt Controller: Manages rapid response to external events.
Clock and Power Management: Provides timing and power-saving features.
These components work together to control and interact with external devices
and execute the program's instructions.
7.
a) Sub AX, BX, where AX contains 8000h and BX contains 0001h and calculate
Status flag, Parity flag, Zero flag, Carry flag and Overflow flag.
Ans.
PF = 1 because there are 8 (even number) one bits in the low byte of
the result.
a larger one.
To allocate the stack of size 100h, you would reserve 256 bytes of memory to be
used as a stack. In x86 assembly, you would typically use the SUB instruction to
adjust the stack pointer accordingly, like this:
SUB SP, 100h ; Allocate 256 bytes (100h in hexadecimal) for the stack
8.
Ans.
INPUT number1=-1250
INPUT number2=7
COMPUTE quotient1 := number1 // number2
COMPUTE quotient2 := number2 // number1
PRINT quotient1
PRINT quotient2
Ans.
The general format of a 16-bit move (MOV) machine instruction varies depending
on the architecture and instruction set of the processor. However, in a typical 16-
bit architecture, the MOV instruction format consists of two main components:
the opcode and the operands. Let's break down the format and explain each
component:
Explanation:
Opcode: The opcode is a binary code that specifies the operation to be performed
by the instruction. In the case of the MOV instruction, the opcode is used to
indicate that data should be moved from the source operand to the destination
operand. Different opcodes may be used for specific variants of the MOV
instruction, such as MOV immediate (MOV with a constant value) or MOV register
to register (MOV between two registers).
Destination Operand: This component specifies where the data will be moved to.
It could be a register, memory location, or other data storage location. The
destination operand is often represented by a register symbol or a memory
address.
Source Operand: This component specifies where the data will be moved from.
Like the destination operand, it can also be a register, memory location, or
constant value. The source operand is typically represented by a register symbol,
memory address, or an immediate value.
Example:
Suppose we have a 16-bit architecture where the opcode for the MOV instruction
is represented by 0010 in binary. We want to move the value stored in register AX
to register BX. The format of the MOV instruction would look like this:
0010 BX, AX
In this example:
The source operand is AX, indicating that the data will be moved from register AX.
When the processor executes this instruction, the value stored in register AX will
be moved to register BX.
Please note that the actual binary representation of the opcode and operands
may differ based on the specific processor architecture, and the number of bits
used for each component may vary. Always refer to the processor's instruction
set documentation for the precise format and opcode values.
i) ADD
ii) SUB
iii) MUL
iv) DIV
Ans.
Here's a very short description of how each instruction works in the 8086
microprocessor:
i) ADD (Addition): This instruction performs the addition of two operands and
stores the result in the destination operand. It sets the flags based on the result,
including the carry flag for overflow.
ii) SUB (Subtraction): This instruction performs the subtraction of the second
operand from the first operand and stores the result in the destination operand.
It sets the flags based on the result, including the borrow flag for borrow-out.
iii) MUL (Multiplication): This instruction multiplies the unsigned value of the
first operand with the unsigned value in the accumulator (AX) and stores the
result in AX (16-bit multiplication). It may set flags based on the result, including
the overflow flag.
iv) DIV (Division): This instruction performs unsigned division of the 32-bit value
formed by the DX:AX pair by the second operand. The quotient is stored in AX,
and the remainder is stored in DX. It may set flags based on the result, including
the divide-by-zero flag.