Microprocessor Quesion Solve-2019
Microprocessor Quesion Solve-2019
Microprocessor Quesion Solve-2019
1.
(a) What are the differences between Microprocessor and Microcontroller?
Ans.
(b) Why INTEL named the 8086 Microprocessor as '8086'? Briefly explain the
internal 4 pin diagram architecture of 8086 CPU (Draw the block diagram also).
Ans.
8086 Microprocessor is an advanced version of 8085 Microprocessor, designed by
Intel in 1976. The number 8086 denotes the IC number of this microprocessor.
That is why, INTEL named the 8086 Microprocessor as '8086'.
(c) Why we need to use latch for 8086 microprocessors?
Ans.
The latch is one of the most important circuits in the 8086, since the latches keep
track of what the processor is doing. While latches can be made in many ways,2
the 8086 uses a compact circuit called the dynamic latch.
That is why, we need to use latch for 8086 microprocessors.
(d) Define system bus. Address bus is unidirectional and data bus bidirectional,
what do think about it?
Ans.
System bus:
A system bus is a single computer bus that connects the major components of a
computer system, combining the functions of a data bus to carry information, an
address bus to determine where it should be sent or read from, and a control bus
to determine its operation.
Address bus is unidirectional and data bus bidirectional:
Address bus is unidirectional because it only carries memory addresses from the
processor to memory and other peripherals. Data bus is bidirectional because it
facilitates the transfer of data between the processor and memory or peripherals
in both directions.
3.
(a) Describe Addressing mode of microprocessor with proper example.
Ans.
MVI B 05
JMP address
LXI H 3000
In this addressing mode, the instruction mentions a register which stores some
data. The operation specified by the instruction is performed in the register
specified by it. The instruction can also specify two registers. The size of the
instructions in register addressing mode is 1 byte. The instruction’s opcode
includes both the register and the operation to be performed. Examples of
instructions that use register addressing mode are:
ADD B
INR B
MOVE B, D
PCHL
In this addressing mode, the instruction specifies some address which stores the
data. This memory location is mentioned in the instruction as an operand. The
size of an instruction in the direct addressing mode is 3 bytes. However,
input/output instructions in direct addressing mode are 2 bytes. Examples of
instructions that use direct addressing mode are:
IN 35
LHLD address
LDA 2050
STA 2050
LDAX
LXIH 9500
MOV A, M
RRC
RLC
CMA
(b) If the last two instructions are not written in any assembly language
program, what will happen?
MOV AH, 4CH
INT 21H
MAIN ENDP
Ans.
if the preceding instructions are missing or incorrect, it's challenging to determine
exactly what will happen without more context. The behavior of the program will
depend on the values in registers and memory at the time of execution and how
the program handles them.
(c) Write an assembly language program to convert the following input into
desired output.
Input: ABC Output: A B C
Ans.
.MODEL SMALL
.STACK 100H
.DATA
inputString DB "ABC$"
MAIN PROC
MOV DS, AX
; Initialize variables
NextChar:
CMP AL, '$' ; Check for the end of the input string
JE EndProgram
MOV outputString[DI], AL
INC DI
MOV outputString[DI], AL
INC DI
INC SI
JMP NextChar
EndProgram:
INT 21H
INT 21H
MAIN ENDP
END MAIN
4.
(a) Briefly Explain the Logical Address, Base Segment Address and Physical
Address.
Ans.
- Logical address is contained in the 16-bit IP, BP, SP, BX, SI or DI. It is also known
as the offset address or the effective address.
- The base segment address is contained in one of the 16bit contents of the
segment registers CS, DS, ES, SS.
- The physical address or the real address is formed by combining the offset and
base segment addresses. This address is 20bit and is primarily used for the
accessing
of the memory.
(b) What is the position of the Stack Pointer After the Pop Instruction?
Ans.
After the "Pop" instruction is executed in a typical computer architecture, the
Stack Pointer will be incremented by the size of the data being popped from the
stack. This operation removes the topmost item from the stack, adjusting the
Stack Pointer to point to the next item in the stack.
5.
(a) Write a program to add a data byte located at offset 0500H in 2000H
segment to another data 2 byte available at 0600H in the same segment and
store the result at 0700H in the same segment.
Ans.
MOV AX, 2000H; initialize DS with value
MOVDS, AX; 2000H
MOV AX, [500H]; Get first data byte from 0500H offset
ADD AX, [600H]; Add this to the second byte from 0600H
MOV [700H],AX; store AX in 0700H HLT;
Stop
During string operations, the SI (Source Index) and DI (Destination Index) registers
are used to hold memory addresses for the source and destination strings,
respectively. These registers are crucial for data movement and manipulation in
memory.
SI (Source Index): It holds the memory address of the source string from
which data is to be read during string operations like "movsb" (move byte
from source to destination) or "cmpsb" (compare byte from source with
destination). It is automatically incremented after each operation to point
to the next element in the source string.
DI (Destination Index): It holds the memory address of the destination
string where data is to be written during operations like "movsb" or "stosb"
(store a byte into the destination). Similar to SI, DI is automatically
incremented after each operation to point to the next location in the
destination string.
(c) What is the maximum memory addressable size by the 8086? Explain briefly
the string 3 addressing mode with the help of an example? What is the purpose
of index registers in 8086?
Ans.
The maximum memory addressable size by the 8086 is 1 MB.
Let's take a look at the different types of addressing modes, one at a time now.
1. Immediate
Figure 1. Immediate
2. Direct Addressing
Figure 2. Direct
3. Register Addressing
Figure 3. Register
(d) What do you mean by I/O mapped I/O and memory mapped I/O? Explain
with example.
Ans.
These two methods are called memory mapped IO and IO mapped IO.
Memory-mapped I/O:
Memory-mapped IO uses the same address space to address both memory and
I/O devices.
Example:
let us say, the chip select pin of an I/O port chip is activated when address =
FFF0H, IO/M* = 0, and RD* = 0.
IO mapped I/O:
IO mapped IO uses separate address spaces to address memory and IO devices.
Example:
let us say, the chip select pin of an I/O port chip is activated when 8-bit address =
F0H, IO/M* = 1, and RD* = 0.
6.
(a) Write an assembly language program to convert a binary number into
hexadecimal number.
Ans.
xor ebx,ebx
First:
rcl ebx,1
mov al,[ecx]
inc ecx
shr al,1
jnz First
Again:
rol ebx,4
(b) Write all possible assembly language instructions for the following things:
i.Converting an ASCII digit to a number.
ii. Converting a lowercase letter to an uppercase letter.
iii.Clearing a register.
iv.Testing a register zero.
Ans.
AND AL, 0xDF ; Using the AND operation with 0xDF (11011111 in binary) clears
the 6th bit (32 in decimal), converting a lowercase letter to uppercase.
XOR AX, AX ; Using XOR operation with a register and itself (or another register)
sets all bits to zero, effectively clearing the register.
i. The hex contents of SP when the program begins would be 100h, which is the
initial value set for the stack segment.
ii. The maximum hex number of words that the stack may contain is 100h (256
words), as specified by the size of the stack segment.
7.
(a) Write an assembly language program for 8086 microprocessors to add 1 to
100.
Ans.
.STACK
.DATA
VAL DB 1
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
MOV BX,1
MOV CX,100
MOV AX,0
TOP:
ADD AX,BX
INC BX
LOOP TOP
XOR DX,DX
MOV BX,100
DIV BX
AAM
ADD AX,3030H
PUSH DX
MOV DH,AL
MOV DL,AH
MOV AH,02H
INT 21H
MOV DL,DH
MOV AH,02H
INT 21H
POP AX
AAM
ADD AX,3030H
PUSH DX
MOV DH,AL
MOV DL,AH
MOV AH,02H
INT 21H
MOV DL,DH
MOV AH,02H
INT 21H
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
i. Place the top of the stack into AX without changing the stack contents:
POP AX ; Move the top of the stack (word below previous SP) into AX
(c) Write down the differences between address and addressing mode with
suitable examples.
Ans.
Example: In x86 assembly language, [BX] represents the memory address stored
in the BX register.
Addressing Mode: Addressing mode refers to the way in which the operand's
address is specified in an instruction. It defines how the processor calculates the
effective address of the operand.
Example: In x86 assembly language, "mov AX, [BX]" uses the "direct addressing
mode" where the operand is the value stored at the memory address pointed to
by the BX register.
8.
(a) Explain the execution of the following code with memory operation and
changing of values
in different register.
0100: E8 04 00
0103: B8 02 00
0106: C3
0107:
0107: BB 05 00
010A: C3
CALL m1 MOV RET ml
AX, 2
PROC
MOV
BX, 5
RET
Ans.
i.0100: E8 04 00 - CALL m1
This instruction is a relative call to the memory address "m1". It pushes the
current IP (Instruction Pointer) value (0103) onto the stack and jumps to the
address m1 (0107).
iii.010A: C3 - RET
The RET instruction will pop the return address (0103) from the stack and transfer
control back to that address. So, the program returns to 0103.
v.0106: C3 - RET
The RET instruction will pop the return address (0100) from the stack and transfer
control back to that address. So, the program returns to 0100.
At this point, the "m1" procedure has executed, and the AX register contains the
value 2, and the BX register contains the value 5.
Overall, the code sequence calls the "m1" procedure, which sets the BX register to
5 and returns, and then sets the AX register to 2 and returns. The final state of the
registers will be AX = 2 and BX = 5.
(b) Define hardware and software interrupt. Which pins of 8086 are responsible
for executing the 2 interrupt procedure?
Ans.
Hardware interrupt is an interrupt generated from an external device or
hardware.
Software interrupt is the interrupt that is generated by any internal system of the
computer.
Interrupt Flag (I) pins of 8086 are responsible for executing the 2 interrupt
procedure.
(c) Computer runs without any RAM is it true or false. Defend your answer with
suitable 3 examples.
Ans.
False. A computer cannot run without any RAM. Here are three examples to
support this:
Booting: When a computer starts up, the BIOS (Basic Input Output System)
is loaded into RAM. Without RAM, the BIOS could not execute, and the
computer would not be able to go through the boot process.
Operating System: The operating system is loaded into RAM during the
boot process. It manages hardware, software, and memory resources.
Without RAM, the computer would not have a place to load the OS, and
thus, it wouldn't be able to run.
Application Execution: When you run a program or application, it is loaded
into RAM to be executed by the CPU. Without RAM, the CPU would have
nowhere to fetch the program's instructions and data from, and the
program would not run.