Mpi 11
Mpi 11
ALE is crucial for interfacing the microprocessor with external memory and I/O
devices.
It generates a signal to latch the address present on the address bus into
external latch ICs during the beginning of a machine cycle.
READY:
X1 and X
X1 and X2 pins are used to connect an external crystal oscillator, determining the
microprocessor's operating frequency.
The stability and accuracy of the oscillator directly influence the timing and
reliability of the microprocessor's operations.
During the first part of the machine cycle, the microprocessor outputs the lower 8
bits of the address (A0-A7) on the data bus.
These lower 8 bits are latched by external latch ICs when the ALE (Address Latch
Enable) signal goes high.
During the second part of the machine cycle, the microprocessor outputs the
upper 8 bits of the address (A8-A15) directly onto the address bus.
By latching the lower 8 bits first and then directly outputting the upper 8 bits, the
address bus is effectively demultiplexed.
Demultiplexing the Data Bus:
During the first part of the machine cycle (T1), when the address is being output
onto the address bus, the data bus is used to carry the lower 8 bits of the
address.
During the second part of the machine cycle (T2 or T3), when the actual data
transfer occurs, the microprocessor places the data onto the data bus.
External memory or I/O devices then read the data from the data bus during this
part of the cycle.
By separating the time when the address and data are present on the bus, the
data bus is effectively demultiplexed.
5. What is the ending address of a 2K-bytes memory whose starting address is 3000H?
To find the ending address of a memory block, you add the starting address to the
size of the memory block and subtract 1, since memory addresses typically start from
0.
Given:
Starting address = 3000H
Memory size = 2K bytes
1K byte = 1024 bytes
So, 2K bytes = 2 * 1024 = 2048 bytes
To find the ending address:
Ending address = Starting address + Memory size - 1
Ending address = 3000H + 2048 - 1
Ending address = 3000H + 2047
Ending address = 5047H
Therefore, the ending address of the 2K-bytes memory block starting at address 3000H
is 5047H.
Ex:
ADD B ; Add the content of register B to the accumulator
ADD M ; Add the content of memory location pointed by HL register pair to the
accumulator
2. ADI: This instruction is used to add an immediate 8-bit data to the accumulator.
Example:
Ex;
Example:
RLC RAL
The bit that is shifted out from the leftmost The carry flag is rotated into the rightmost
position is placed in both the carry flag (CY)
position (bit 0) of the accumulator, and the previous
and the rightmost position (bit 0) of the
accumulator. 0 is rotated into the carry flag.
Ex; Ex;
Initial accumulator content: 10101100 Initial accumulator content: 10101100 (CY = 1)
After RLC: 01011001 (CY = 1) After RAL: 01011001 (CY = bit 7)
RLC shifts the leftmost bit into both the while RAL rotates the accumulator leftwards with the
carry flag and the rightmost position of the
carry flag being shifted into the rightmost position
accumulator
16 . What will be the value in accumulator, for the given 8085 program below?
MVI C, 7FH
MVI B, 3EH
MOV A, B
RLC
RLC
ANI 7FH
HLT
Ans;
Ans : A 3EH (0011 1110)B
A (0111 1100)B
A (1111 1000)B
A (0111 1000) B
11. Explain the SIM and RIM instructions of the 8085 microprocessor.
Set Interrupt Mask (SIM) : In 8085 Instruction set, SIM stands for “Set Interrupt
Mask”. It is 1-Byte instruction and it is a multi-purpose instruction
The main uses of SIM instruction are –
Masking/unmasking of RST7.5, RST6.5, and RST5.5
Reset to 0 RST7.5 flip-flop.
Perform serial output of data.
Read Interrupt Mask (RIM) : In 8085 Instruction set, RIM stands for “Read
Interrupt Mask”. It is a 1-Byte multi-purpose instruction.
It is used for the following purposes –
To check whether RST7.5, RST6.5, and RST5.5 are masked or not.
To check whether interrupts are enabled or not.
To check whether RST7.5, RST6.5, or RST5.5 interrupts are pending or
not.
To perform serial input of data.
12. How many flags are available in an 8085 microprocessor? State the
importance of an auxiliary carry (AC) flag.
The Flag register is a Special Purpose Register.
Depending upon the value of the result after any arithmetic and logical
operation, the flag bits become set (1) or reset (0).
In 8085 microprocessor, the flag register consists of 8 bits and only 5 of them
are useful. The 5 flags are:
For example, MVI A 2BH (load 2BH in register A) MVI 39H (load 39H in register B) ADD
B (A = A + B) These set of instructions will set the auxiliary carry flag to 1, as on
adding 2B and 39, the addition of lower-order nibbles B and 9 will generate a carry.
13. Define the followings: Machine Cycle, T-state, JC, CMP, RET, SBB, STC.
1. Machine Cycle:
A machine cycle is the basic operation performed by a computer's central processing
unit (CPU). It consists of a series of steps required to fetch, decode, execute, and store
data or instructions. In microprocessors like the 8085, a machine cycle typically
consists of several clock cycles.
2. **T-state**:
T-state, short for Timing state, refers to the basic unit of time in a microprocessor's
operation. Each machine cycle consists of a specific number of T-states. The duration
of a T-state is determined by the system clock frequency. Different instructions may
require different numbers of T-states to execute.
3. **JC**:
In assembly language programming, JC typically stands for "Jump if Carry." It is a
conditional branch instruction that causes the program execution to jump to a specific
memory location if the carry flag (CY) is set.
4. **CMP**:
CMP stands for "Compare." It is an instruction used in assembly language
programming to compare two operands. It performs a subtraction operation between
the specified operands but does not store the result. Instead, it updates the flags based
on the result of the subtraction.
5. **RET**:
RET is a mnemonic for "Return." It is an assembly language instruction used to return
control from a subroutine to the main program. When executed, RET retrieves the return
address from the stack and jumps to that address, resuming execution from where the
subroutine was called.
6. **SBB**:
SBB stands for "Subtract with Borrow." It is an assembly language instruction used to
subtract one operand from another along with the borrow flag (borrowed from a
previous subtraction operation). It is particularly useful in multi-byte subtraction
operations.
7. **STC**:
STC stands for "Set Carry Flag." It is an assembly language instruction used to set the
carry flag (CY) in the flag register of the microprocessor.
14. Point out the valid and invalid instruction. Correct the invalid ones.
MVI AB LDA BD MOV 05 ANI 0BH LDAX B
1. *MVI AB*:
- Invalid instruction. The MVI instruction is used to move an immediate value into a
register or memory location. However, AB is not a valid register or memory location
specifier. Perhaps you meant to move an immediate value into the accumulator and the
B register (MVI A, B).
2. *LDA BD*:
- Invalid instruction. The LDA instruction is used to load the accumulator with the
contents of a memory location. However, BD is not a valid memory location specifier. If
you intended to load the accumulator with the contents of memory location 0xBD, the
correct instruction would be LDA 0xBD.
3. *MOV 05*:
- Invalid instruction. The MOV instruction is used to move data between registers or
between a register and a memory location. Here, 05 doesn't specify a valid source and
destination for the move operation. If you intended to move data from register B to
register C, the correct instruction would be MOV C, B.
4. *ANI 0BH*:
- Valid instruction. The ANI instruction performs a logical AND operation between the
accumulator and an immediate 8-bit data. It is correctly specified here to perform a
logical AND operation between the accumulator and the immediate data 0BH.
5. *LDAX B*:
- Valid instruction. The LDAX instruction is used to load the accumulator with the
contents of a memory location addressed by the BC register pair. So, LDAX B is a valid
instruction which loads the accumulator with the contents of the memory location
addressed by the BC register pair.
Correcting the invalid instructions:
- MVI A, B
- LDA 0xBD
- MOV C, B
18.Write an assembly language program to find the larger number
from given two numbers stored at 2501H = 98H, 2502H = 87H result
store at 2503H.
LXI H, 2501H ; Load HL register pair with the address of the first number
MOV A, M ; Move the value at memory location 2501H to the accumulator
INX H ; Increment HL to point to the next memory location
MOV B, M ; Move the value at memory location 2502H to register B
CMP B ; Compare the contents of the accumulator with the value in register
B
JNC LABEL ; Jump to LABEL if the Carry flag is not set (i.e., if the first
number is greater)
MOV C, A ; Move the larger number (from 2501H) to register C
JMP STORE ; Jump to STORE to store the result
LABEL:
MOV C, B ; Move the larger number (from 2502H) to register C
STORE:
MOV M, C ; Store the larger number from register C to memory location
2503H
HLT ; Halt the program
19. Explain One byte, Two byte, Three byte and write short note on different types of
instruction sets.
In the context of computer architecture and microprocessors, "one byte," "two bytes,"
and "three bytes" refer to the size of instructions.
1. **One Byte Instruction:**
These instructions are often simple and perform basic operations such as
moving data between registers, performing arithmetic operations, or
manipulating flags.
Two-byte instructions are slightly more complex and require two bytes of
memory to encode.
Three-byte instructions are even more complex and require three bytes of
memory to encode.
Examples of CISC architectures include x86 (Intel and AMD processors), DEC
VAX, and IBM z/Architecture.
RISC instruction sets aim for simplicity and efficiency by providing a smaller
set of simple instructions.
3. **Complex Instruction Set Computing with Reduced Instruction Set Computing Core
(CISC-RISC Hybrid):**
These architectures often have a relatively simple RISC core with additional
complex instructions for performance optimization or backward compatibility.