COMA
COMA
The programming model of the 8085 microprocessor consists of registers, flags, and the
memory organisation. The main registers include:
● Accumulator (A): 8-bit register used for arithmetic and logic operations.
● General Purpose Registers (B, C, D, E, H, L): 6 registers, each 8 bits, used for
temporary storage.
● Program Counter (PC): 16-bit register that holds the address of the next instruction to
be executed.
● Stack Pointer (SP): 16-bit register that points to the top of the stack in memory.
● Instruction Register (IR): Holds the current instruction being executed.
● Flags Register: Contains 5 status flags (Sign, Zero, Auxiliary Carry, Parity, Carry) that
indicate the status of the accumulator after operations.
● CMP M: Compares the content of the accumulator with the content of memory
(pointed by HL pair). It affects the flags based on the result.
● RAL (Rotate Accumulator Left): Rotates the bits of the accumulator to the left. The
MSB moves to the carry flag and the LSB comes from the carry flag.
● CMA (Complement Accumulator): Complements (inverts) all the bits of the
accumulator.
To generate a delay of 0.5 seconds with a clock frequency of 6 MHz (which gives a cycle
time of 1/6 MHz = 166.67 ns) and an internal clock frequency of 3 MHz (which gives a cycle
time of 1/3 MHz = 333.33 ns):
1. The total number of cycles in 0.5 seconds = 0.5s / 333.33ns = 1500 cycles.
2. Load a 16-bit register pair with the value corresponding to 1500 cycles and use a
loop to decrement it until it reaches zero.
4. Logical and Circular Shift Microoperations
● Logical Shift: Moves bits to the left or right, filling the vacant bit positions with zeros.
Example: Logical left shift of 1010 results in 0100.
● Circular Shift: Moves bits around in a circular fashion. Example: Circular left shift of
1010 results in 0101.
7. Definitions
assembly
Verify
Open In Editor
Edit
Copy code
● Fetch Stage: The instruction is fetched from memory using the Program Counter.
● Decode Stage: The fetched instruction is decoded to determine the operation.
● Execution Stage: The operation is executed, which could involve reading/writing to
registers or memory.
1. MVI (Move Immediate): Loads an immediate value into a register. Example: MVI A,
05H loads the accumulator with the value 05H.
2. CMP (Compare): Compares the accumulator with another register or memory.
Example: CMP B compares the content of A with B.
3. XRA (Exclusive OR Accumulator): Performs a bitwise XOR operation between the
accumulator and another register or memory. Example: XRA C XORs A with C.
4. SUB (Subtract): Subtracts the content of a register or memory from the accumulator.
Example: SUB D subtracts D from A.
5. STA (Store Accumulator): Stores the content of the accumulator into a specified
memory address. Example: STA 2000H stores A into memory location 2000H.
● Direct Addressing Mode: The address of the operand is given explicitly in the
instruction. Example: LDA 2000H loads the accumulator with the content at memory
address 2000H.
● Indirect Addressing Mode: The address of the operand is specified indirectly through
a register pair. Example: MOV A, M where HL points to the memory location.
● Primary Memory:
● RAM: Read and Write memory used for temporary storage.
● ROM: Read-only memory used for permanent storage of programs and data.
● Secondary Memory: External storage devices like hard drives, USB drives, etc.
● Cache Memory: High-speed memory used to store frequently accessed data.
16. Circular Shift and Arithmetic Shift Microoperations
● Circular Shift:
● Circular Left Shift: Bits are shifted left, and the MSB is wrapped around to the
LSB position.
● Example: 1010 → 0101
● Circular Right Shift: Bits are shifted right, and the LSB is wrapped around to
the MSB position.
● Example: 1010 → 0101
● Arithmetic Shift:
● Arithmetic Left Shift: Similar to logical left shift, but it preserves the sign bit for
signed numbers.
● Example: 1101 (−3) → 1010 (−6)
● Arithmetic Right Shift: Preserves the sign bit while shifting right.
● Example: 1100 (−4) → 1110 (−2)
The timing diagram for the MOV B, C instruction involves several clock cycles where the
control signals are activated to read the content of register C and write it to register B. The
diagram would typically show:
A common bus system can be designed using multiplexers to select between different data
sources (registers) to send data onto a single bus line. The bus can carry data from multiple
sources, and the multiplexer selects which source to send based on control signals.
4. M1: This pin indicates that the microprocessor is in the first machine cycle of an
instruction. It is used to identify the fetch cycle.
5. INTA (Interrupt Acknowledge): This pin is used to acknowledge an interrupt request.
When an interrupt is acknowledged, the microprocessor will execute the
corresponding interrupt service routine.
The flag register in the 8085 microprocessor consists of 5 flags that indicate the status of the
accumulator after an arithmetic or logical operation. The flags are:
Memory Diagram
Verify
Open In Editor
Edit
Copy code
1+-----------------+
2| Memory |
3| |
4| Address Bus |
5| |
6| Data Bus |
7+-----------------+
8 |
9 |
10 +---+---+
11 | MAR |
12 +---------+
13 |
14 |
15 +---+---+
16 | MDR |
17 +---------+
In this diagram, the MAR holds the address of the memory location to be accessed, and the
MDR holds the data being read from or written to that address.
1. Programming Model: Understanding the registers and flags is crucial for effective
programming.
2. Instructions: Familiarity with instructions like MVI, CMP, and others is essential for
assembly language programming.
3. Addressing Modes: Knowing direct and indirect addressing helps in efficient memory
access.
4. Interrupts: Understanding the types of interrupts aids in designing responsive
systems.
5. Memory Architecture: Knowledge of MAR and MDR is important for understanding
how data is accessed in memory.
If you have any specific questions or need further details on any of the topics, feel free to
ask!
The MVI B, 05H instruction is an immediate data transfer instruction that moves the value
05H into register B. The timing diagram for this instruction involves several clock cycles:
Verify
Open In Editor
Edit
Copy code
1T1: |---|---|---|---|---|---|---|---|---|---|
2 Address Bus --> Opcode Fetch
3 Data Bus <--- Opcode (MVI B, 05H)
4
5T2: |---|---|---|---|---|---|---|---|---|---|
6 Address Bus --> Immediate Data Fetch
7 Data Bus <--- 05H
8
9T3: |---|---|---|---|---|---|---|---|---|---|
10 Execute Instruction
An instruction is a binary-coded operation that the microprocessor can execute. The fetch
and execute cycle involves:
1. Fetch:
● The Program Counter (PC) points to the address of the instruction.
● The instruction is read from memory and loaded into the Instruction Register
(IR).
● The PC is incremented to point to the next instruction.
2. Execute:
● The control unit decodes the instruction.
● The necessary operations are performed, which may involve arithmetic
operations, data transfer, or control operations.
● Stack: A Last In First Out (LIFO) data structure used for storing temporary data. It
grows downwards in memory.
● Subroutine: A set of instructions that can be called from the main program. It allows
code reuse and modular programming.
PUSH: Saves the content of a register onto the stack and decrements the stack pointer (SP).
POP: Retrieves the content from the stack into a register and increments the stack pointer.
● RIM (Read Interrupt Mask): Used to read the status of the interrupt system. It
retrieves the status of maskable and non-maskable interrupts.
● SIM (Set Interrupt Mask): Used to control the interrupt system. It sets the mask for
interrupts and the status of the interrupt system.
For interfacing a 2KB EPROM and a 4KB RAM, we can use a decoder to select the memory:
Open In Editor
Edit
Copy code
1+--------+---------+---------+
2| Address| EPROM | RAM |
3+--------+---------+---------+
4| 0000H | 2KB | |
5| 0800H | | 4KB |
6+--------+---------+---------+
The instruction used to control interrupts is SIM (Set Interrupt Mask) and RIM (Read
Interrupt Mask).
SIM:
Registers in the 8085 microprocessor are used for temporary storage of data and
instructions. They are faster than memory and allow for quick data manipulation. Registers
differ from memory in:
Cache memory is a small-sized type of volatile computer memory that provides high-speed
data access to the CPU and stores frequently used computer programs, applications, and
data. It acts as a buffer between the CPU and the main memory (RAM).
● Speed: Cache memory is faster than main memory, enabling quicker data retrieval.
● Levels: Cache memory is usually divided into levels:
● L1 Cache: Located on the CPU chip, very fast but small (typically 32KB to
256KB).
● L2 Cache: Can be on the CPU or on a separate chip, larger than L1 (typically
256KB to several MB).
● L3 Cache: Shared between cores, larger but slower than L1 and L2.
● Types:
● Instruction Cache: Stores instructions for the CPU.
● Data Cache: Stores data that the CPU frequently accesses.
Working: When the CPU needs to access data, it first checks the cache. If the data is found
(cache hit), it is used directly. If not (cache miss), it fetches the data from the main memory
and stores it in the cache for future access.
1. LXI Instruction:
● Operation: Load register pair with immediate data.
● Example: LXI H, 1234H loads the HL register pair with the address 1234H.
● Effect: H = 12H, L = 34H.
2. LHLD:
● Operation: Load H and L registers from memory.
● Example: LHLD 2000H loads the content of memory locations 2000H and
2001H into L and H respectively.
● Effect: L = [2000H], H = [2001H].
3. STAX:
● Operation: Store accumulator content into memory pointed by register pair.
● Example: STAX B stores the content of the accumulator into the memory
location pointed by the BC register pair.
● Effect: Memory[BC] = A.
4. CMA (Complement Accumulator):
● Operation: Complements the content of the accumulator.
● Example: If A = 5AH, after CMA, A = A5H (bitwise NOT).
● Effect: Flips all bits in the accumulator.
5. RRC (Rotate Accumulator Right):
● Operation: Rotates the bits of the accumulator right.
● Example: If A = 1010 1100, after RRC, A = 0101 0110.
● Effect: The LSB is moved to the MSB position.
De-multiplexing is the process of separating the address and data lines that are multiplexed
together. In the 8085 microprocessor, the address/data bus (AD0-AD7) is multiplexed,
meaning that the same lines are used for both address and data.
De-multiplexing Process:
Diagram:
Verify
Open In Editor
Edit
Copy code
1 +-----------------+
2 | 8085 Micro |
3 | Processor |
4 +-----------------+
5 | |
6 | |
7 +----+ +----+
8 | AD0-AD7 |
9 +----+ +----+
10 | |
11 +----+-------+----+
12 | De-multiplexer |
13 +-----------------+
14 | |
15 Address Data
The de-multiplexer separates the address and data lines, allowing the processor to
effectively communicate with memory.
Here is an example program in assembly language to divide two 8-bit numbers stored in
memory locations 7015H and 7016H, storing the result at 5016H.
assembly
Verify
Open In Editor
Edit
Copy code
1; Divide two 8-bit numbers stored at 7015H (numerator) and 7016H (denominator)
2; Store the quotient at 5016H
3
4ORG 7015H ; Origin address for data
5DB 50H ; Numerator
6DB 05H ; Denominator
7
8ORG 5016H ;
More
Certainly! Continuing with the program for dividing two 8-bit data and the remaining
questions:
Verify
Open In Editor
Edit
Copy code
1; Divide two 8-bit numbers stored at 7015H (numerator) and 7016H (denominator)
2; Store the quotient at 5016H
3
4ORG 7015H ; Origin address for data
5DB 50H ; Numerator (50H)
6DB 05H ; Denominator (05H)
7
8ORG 5016H ; Output address for quotient
9DB 00H ; Initializing output address
10
11; Start of the program
12START:
13 MVI A, M ; Load numerator (50H) into accumulator
14 INX H ; Point HL to the denominator (next memory location)
15 MOV B, M ; Move denominator (05H) into register B
16 CPI 00H ; Compare with zero to check for division by zero
17 JZ DIV_BY_ZERO ; If zero, jump to division by zero handler
18
19 ; Initialize quotient and remainder
20 MVI C, 00H ; Clear C (quotient)
21
22DIV_LOOP:
23 CMP B ; Compare A (numerator) with B (denominator)
24 JC END_DIV ; If A < B, jump to end of division
25 SUB B ; A = A - B (subtract denominator from numerator)
26 INX D ; Increment quotient (C)
27 JMP DIV_LOOP ; Repeat the loop
28
29END_DIV:
30 ; Store the quotient in memory
31 SHLD 5016H ; Store quotient at 5016H
32
33DIV_BY_ZERO:
34 ; Handle division by zero (optional)
35 MVI A, 00H ; Set accumulator to zero or some error code
36 SHLD 5016H ; Store error code at 5016H
37 HLT ; Halt the program
Verify
Open In Editor
Edit
Copy code
1T1: |---|---|---|---|---|---|---|---|---|
2 Address Bus --> I/O Address Fetch
3 Data Bus <--- I/O Data
4
5T2: |---|---|---|---|---|---|---|---|---|
6 Address Bus --> I/O Read Operation
EI and DI Instructions:
To interface two memories, RAM and EPROM, both with a size of 8KB, we can allocate
address ranges as follows:
● EPROM:
● Starting Address: 0000H
● Ending Address: 1FFFH (8KB)
● RAM:
● Starting Address: 2000H
● Ending Address: 3FFFH (8KB)
Verify
Open In Editor
Edit
Copy code
1+-------------------+
2| Address Range |
3+-------------------+
4| 0000H - 1FFFH | EPROM (8KB)
5| 2000H - 3FFFH | RAM (8KB)
6+-------------------
38. Draw and Explain Any Three Blocks of Architecture of
8085 (continued)
Verify
Open In Editor
Edit
Copy code
1+-------------------+
2| 8085 |
3| |
4| +-----+ +-------+ |
5| | ALU | | Control| |
6| | | | Unit | |
7| +-----+ +-------+ |
8| |
9| +-----+ +-------+ |
10| | Regs| | I/O | |
11| | | | Control | |
12| +-----+ +-------+ |
13| |
14+-------------------+
1. Based on Size:
● Small Scale Integration (SSI): Contains a few transistors (e.g., early
microprocessors).
● Medium Scale Integration (MSI): Contains hundreds of transistors (e.g.,
8085).
● Large Scale Integration (LSI): Contains thousands of transistors (e.g., 8086,
8088).
● Very Large Scale Integration (VLSI): Contains millions of transistors (e.g.,
modern microprocessors).
2. Based on Application:
● General Purpose Microprocessors: Used in personal computers and
workstations (e.g., Intel Core series).
● Embedded Microprocessors: Designed for specific applications (e.g.,
microcontrollers in appliances).
● Digital Signal Processors (DSP): Optimized for processing signals (e.g., audio
and video processing).
3. Based on Speed:
● Low-Speed Microprocessors: Operate at lower clock frequencies (e.g., 4-8
MHz).
● Medium-Speed Microprocessors: Operate in the range of 10-100 MHz.
● High-Speed Microprocessors: Operate above 100 MHz (e.g., GHz range in
modern CPUs).
The AD7-AD0 bus in the 8085 microprocessor is a multiplexed bus, meaning it carries both
address and data information. During the operation of the microprocessor, the bus is used to
transmit addresses during the first half of a machine cycle and data during the second half.
a. Define:
d. Define:
e. What is an Assembler? An assembler is a tool that converts assembly language code into
machine language code. It translates mnemonics into their corresponding binary opcodes.
g. What information is given by the address line? The address line provides the location of
data in memory that the CPU wants to access. It specifies which memory location to read
from or write to.
h. Data bus is always bidirectional: True The data bus is bidirectional because it allows data
to flow in both directions: from the CPU to memory (write) and from memory to the CPU
(read).
● Efficiency: Assembly language allows for fine-tuned control over hardware, resulting
in faster and more efficient code.
● Direct Hardware Access: It provides direct access to hardware and memory
addresses.
● Less Overhead: Assembly language typically has less overhead compared to
high-level languages, leading to smaller executable sizes.
o. How much memory can be accessed by the 8085 microprocessor? The 8085
microprocessor can access up to 64 KB of memory. This is because it has a 16-bit address
bus, allowing it to address (2^{16}) or 65,536 memory locations (from 0000H to FFFFH).
p. ALU stands for: Arithmetic Logic Unit. It is the component of the CPU that performs
arithmetic and logical operations.
q. What is the purpose of the Control Unit of a Microprocessor? The Control Unit (CU)
orchestrates the operations of the microprocessor. It fetches instructions from memory,
decodes them, and generates control signals to direct the operation of the ALU, registers,
and other components. The CU ensures that all parts of the microprocessor work together to
execute instructions in the correct sequence.
s. Justify: “The direction of the address bus is unidirectional”: The address bus is
unidirectional because it only carries address information from the CPU to memory or
peripheral devices. The CPU sends out addresses to specify which memory location or I/O
device it wants to access, but it does not receive address information back through the
address bus.
● Data Handling: A 4-bit microprocessor can process 4 bits of data at a time, while an
8-bit microprocessor can handle 8 bits at once.
● Addressing Capability: The 4-bit microprocessor typically has a smaller addressable
memory space compared to an 8-bit microprocessor, which can address more
memory locations due to its wider data bus.
● Performance: Generally, an 8-bit microprocessor can perform more complex
operations and handle larger data sets than a 4-bit microprocessor.
v. What is the use of Registers in a microprocessor? Registers are small, fast storage
locations within the CPU used to hold data temporarily during processing. They are used for:
aa. Write any one three-byte instruction of 8085: An example of a three-byte instruction in
More
Certainly! Continuing with the answers from the previous section:
aa. Write any one three-byte instruction of 8085: An example of a three-byte instruction in
the 8085 microprocessor is:
● LXI H, 1234H: This instruction loads the 16-bit immediate data (1234H) into the HL
register pair. The instruction itself occupies three bytes: one byte for the opcode (LXI)
and two bytes for the immediate data (1234H).
ab. Can we interface 64 MB memory with 8085? (Y/N): N: The 8085 microprocessor cannot
interface with 64 MB of memory because it has a 16-bit address bus, allowing it to access
only 64 KB (2^16 = 65,536 bytes) of memory.
ac. ________ pin indicates that another device is requesting the use of the address and data
bus of 8085: The pin is called INTA (Interrupt Acknowledge). However, the pin that indicates
that another device is requesting the use of the bus is typically referred to as ALE (Address
Latch Enable) or HOLD in the context of bus control.
ad. What is the high-speed memory between the main memory and the CPU called?: The
high-speed memory between the main memory and the CPU is called Cache Memory. It
stores frequently accessed data and instructions to speed up processing.
ae. Flash Memory is non-volatile memory? (Y/N) Justify your answer: Y: Flash memory is
non-volatile, meaning it retains stored data even when the power is turned off. This
characteristic makes it suitable for storage devices like USB drives and SSDs.
af. In 8085, which of the following instructions is used to check if interrupts are pending or
not?: The instruction used to check if interrupts are pending in the 8085 microprocessor is
RIM (Read Interrupt Mask). It retrieves the status of the interrupt system.
ah. For the 8085 microprocessor, if register B has 65H and the accumulator has 97H, what
will be the content of the accumulator after executing the instruction SUB B?:
● The SUB B instruction subtracts the value in register B from the accumulator.
● Accumulator = 97H (151 in decimal)
● Register B = 65H (101 in decimal)
● Result = 97H - 65H = 32H (50 in decimal)
● Therefore, the content of the accumulator after executing SUB B will be 32H.
ai. ASCII code stands for: American Standard Code for Information Interchange. It is a
character encoding standard used for representing text in computers and other devices.
● Opcode: The part of a machine language instruction that specifies the operation to be
performed by the CPU (e.g., ADD, SUB, MOV).
● Operand: The part of a machine language instruction that specifies the data to be
operated on or the address of the data. It can be a constant value, a register, or a
memory address.
ak. Explain the usage of the STAX instruction: The STAX instruction in the 8085
microprocessor is used to store the contents of the accumulator into memory. It stores the
value in the accumulator into the memory location pointed to by the HL register pair. There
are two variations:
● STAX H: Stores the accumulator's contents at the memory address in the HL register
pair.
● STAX D: Stores the accumulator's contents at the memory address in the DE register
pair.
al. How many transistors are used in the 8085 microprocessor?: The 8085 microprocessor
uses approximately 6,000 transistors.
an. Flag register is of _______ bit: The flag register in the 8085 microprocessor is 8 bits. It
contains status flags that indicate the outcome of arithmetic and logical operations, including
the Zero flag, Carry flag, Sign flag, Parity flag, and Auxiliary Carry flag.
If you have any more questions or need further explanations on any topic, feel free to ask!
More
Certainly! Here are additional explanations and answers related to the topics covered in your
previous questions, as well as some new information that might be useful:
The status flags in the flag register of the 8085 microprocessor indicate the status of the
processor after arithmetic and logical operations. Here are the main flags and their functions:
● Zero Flag (Z): Set if the result of an operation is zero; otherwise, it is reset.
● Sign Flag (S): Set if the result of an operation is negative (i.e., the most significant bit
is 1); otherwise, it is reset.
● Carry Flag (C): Set if there is a carry out from the most significant bit during an
addition or a borrow during subtraction; otherwise, it is reset.
● Parity Flag (P): Set if the number of 1s in the result is even; otherwise, it is reset.
● Auxiliary Carry Flag (AC): Used in BCD (Binary-Coded Decimal) operations; set if
there is a carry from the lower nibble (4 bits) to the upper nibble.
44. What is the purpose of the Program Counter (PC)?
The Program Counter (PC) is a special register in the CPU that holds the address of the next
instruction to be executed. After fetching an instruction, the PC is incremented to point to the
following instruction in memory, ensuring the CPU executes instructions sequentially unless
a branch or jump instruction alters the flow.
The stack is a special area of memory used for temporary storage of data. It operates in a
Last In, First Out (LIFO) manner. The stack is used for:
The Instruction Register (IR) holds the current instruction that is being executed. After the
instruction is fetched from memory, it is placed in the IR, where it is decoded to determine
the operation to be performed.
48. Explain the concept of Interrupts.
Interrupts are signals that temporarily halt the CPU's current operations to allow it to respond
to a specific event or condition. There are two main types of interrupts:
DMA is a feature that allows certain hardware subsystems to access main system memory
independently of the CPU. It enables high-speed data transfers between peripherals and
memory without burdening the CPU, improving overall system performance.
● Microprocessor:
● Primarily designed for general-purpose computing tasks.
● Requires external components (memory, I/O interfaces) to function.
● Typically has a higher processing power and speed.
● Microcontroller:
● Designed for specific control-oriented applications (e.g., embedded systems).
● Integrates CPU, memory (RAM/ROM), and peripheral interfaces on a single
chip.
● More energy-efficient and suitable for low-power applications.
Clock speed, measured in Hertz (Hz), indicates how many cycles per second a
microprocessor can execute. Higher clock speeds generally mean a faster processor,
allowing it to perform more instructions in a given time frame. However, other factors, such
as architecture and efficiency, also significantly influence overall performance.
52. What is a Bus Cycle?
A bus cycle refers to the time taken to complete a data transfer operation on the bus. It
includes the time for address setup, data transfer, and acknowledgment. The bus cycle time
can affect the overall performance of the system.
1. Arithmetic Operations:
○ The ALU performs basic arithmetic operations such as addition, subtraction,
multiplication, and division.
○ It also handles increment and decrement operations, which are essential for
looping and counting processes in programs.
○ Example: When executing the instruction ADD B, the ALU adds the contents
of register B to the accumulator and stores the result in the accumulator.
2. Logical Operations:
○ The ALU performs logical operations such as AND, OR, XOR, and NOT.
○ These operations are used for bit manipulation, decision-making, and control
flow in programs.
○ Example: The instruction AND B performs a bitwise AND operation between
the contents of register B and the accumulator, storing the result in the
accumulator.
3. Bit Manipulation:
○ The ALU handles bit manipulation operations such as shifting (left and right)
and rotating bits.
○ These operations are crucial for tasks like data encoding, encryption, and
optimizing arithmetic calculations.
○ Example: The instruction RLC (Rotate Left through Carry) rotates the bits in
the accumulator to the left, with the carry bit being included in the rotation.
4. Status Flags:
○ The ALU updates status flags based on the results of arithmetic and logical
operations. These flags indicate conditions such as zero, carry, sign, parity,
and auxiliary carry.
○ The status flags are used by the processor to make decisions and control the
flow of execution in programs.
○ Example: After an addition operation, the zero flag is set if the result is zero,
and the carry flag is set if there is a carry out of the most significant bit.
5. Intermediate Results:
○ The ALU temporarily holds intermediate results during complex calculations
and logical operations.
○ These intermediate results are used in subsequent operations to achieve the
final outcome.
○ Example: In a multi-step calculation, the ALU stores intermediate sums or
products before combining them to produce the final result.
The ALU is essential for the functioning of a microprocessor, as it performs the core
computations required for executing instructions and processing data. Its ability to handle
both arithmetic and logical operations makes it a versatile and powerful component in any
computing system.
PIN DIAGRAM-