📝 Direct Memory Access (DMA) Data Transfer in 8085 Microprocessor (19 MCQs)
Direct Transfer Between Memory and Peripheral Devices
Direct Memory Access allows data to move between memory and an input/output device without requiring the 8085 to execute an individual data-transfer instruction for every byte. A separate DMA controller coordinates the transfer and temporarily controls the system buses. This method is especially useful when large quantities of information must be transferred efficiently.
HOLD and HLDA Signals for Bus Ownership
The DMA controller requests control of the address, data and control buses by activating HOLD. The 8085 completes its current machine cycle and responds with HLDA when it releases the buses. During this interval, the DMA controller can generate addresses, control memory access and coordinate communication with the selected peripheral.
DMA Transfer Sequence and Processor Bus Release
The DMA controller requests the buses through HOLD. After acknowledging through HLDA, the processor places its bus connections in the high-impedance state where applicable, allowing external control. The controller performs the required memory and I/O transfers, updates its address and count information, and releases HOLD when the operation is complete.
Example of Transferring a Block into RAM
Suppose a peripheral must transfer 256 bytes into memory beginning at 4000H. The DMA controller requests the buses through HOLD, receives HLDA and transfers bytes directly into consecutive memory locations. It updates the address after each byte and terminates the transfer when its byte counter reaches the programmed limit.
DMA Benefits and Its Relationship with Processor Operation
DMA reduces the instruction-processing burden during large block transfers and improves system efficiency when high-volume data movement is required. It uses the 8085 bus-control signals but relies on external transfer hardware. During bus ownership, the CPU cannot perform ordinary memory or I/O bus operations, although it resumes processing when the buses are released.
Misconceptions About DMA Operation
'The DMA controller is an internal 8085 register' is incorrect because it is separate external hardware. 'The CPU and DMA controller independently drive the buses simultaneously' overlooks bus ownership and high-impedance release. 'HOLD transfers data automatically' is incorrect because the DMA controller must generate the addresses and transfer-control signals.
DMA Handshaking and Block-Transfer Examination Questions
Understand the HOLD and HLDA handshake, bus release and restoration of processor control. Identify the functions of the external DMA controller and trace address and count updates during a block transfer. Questions may compare DMA with programmed and interrupt-driven I/O or ask why the CPU cannot use the buses during DMA ownership.
DMA and Bus-Ownership Terminology
- DMA - Direct transfer between memory and I/O.
- DMA Controller - Manages direct data transfers.
- HOLD - Requests control of processor buses.
- HLDA - Acknowledges the bus request.
- High Impedance - Electrically releases a bus connection.
- Block Transfer - Moves a group of data bytes.
📝 All Direct Memory Access (DMA) Data Transfer in 8085 Microprocessor MCQs
Q1. What is the purpose of the CMA instruction in the two’s complement routine?
📖 Explanation: CMA complements each bit of the accumulator, producing the one’s complement of the current byte. This is the first step toward forming the two’s complement, because after CMA the program adds 1 (using ADI 01 H) to obtain the final two’s complement. The other options either add a constant, store the accumulator, or add a carry, none of which directly generate the one’s complement.
Q2. Where does the program store the resulting two’s complement bytes after processing?
📖 Explanation: The program uses the DE register pair, initialized with LXI D,2201 H, to point to the destination area. Each STAX D stores the transformed byte at the address held in DE, which starts at 2201 H and increments with each iteration. Therefore the results are placed beginning at 2201 H. The other addresses either hold the source data or the count, not the output.
Q3. Why does the program use register B to hold a carry flag after adding 1 to the complemented byte?
📖 Explanation: After the ADI 01 H instruction, the processor may set the carry flag if the addition overflows. The program tests this flag with JNC; if a carry exists it loads B with 01 H, otherwise with 00 H. This value is later added to the next byte (ADD B) to propagate the carry across multiple bytes, implementing multi‑byte two’s complement correctly.
Q4. If the byte at memory location 2101 H contains FF H, what value will be stored at 2201 H after the first iteration?
📖 Explanation: The byte FF H is complemented by CMA, giving 00 H, then ADI 01 H adds 01 H, resulting in 01 H. This value is stored at 2201 H. Option A (00 H) would be the one’s complement without the +1 step, option C (FE H) and D (FF H) are unrelated. The correct answer shows the full two’s complement process for a single‑byte value.
Q5. During execution, the program decrements register C after processing each byte. What would happen if this decrement were omitted?
📖 Explanation: Register C holds the loop counter N. Without DCR C, the JNZ LOOP test would never become zero, causing the program to repeat the LOOP indefinitely and overwrite memory beyond the intended range. Processing only one byte or skipping bytes would require a different control structure, while a crash is not guaranteed. Proper loop control is vital for correct DMA‑style data handling.
Q6. A system requires converting a 3‑byte little‑endian number to its two’s complement using the given program. Which modification is essential?
📖 Explanation: When N = 3, the program already processes three bytes starting at 2101 H and stores results at 2201 H. However, after the most significant byte is complemented and incremented, a possible carry from that addition must be propagated to a higher byte that does not exist. Adding a final step to handle any leftover carry (e.g., storing an extra byte) ensures the two’s complement representation is accurate for multi‑byte numbers.
Q7. Why is the least significant byte stored at the lowest address (2101 H) in this routine?
📖 Explanation: The program follows the little‑endian convention where the least significant byte occupies the lowest memory address. This ordering simplifies multi‑byte arithmetic, as the processor can process bytes sequentially from low to high addresses, matching the natural flow of addition and carry propagation. Big‑endian would reverse the order, and register pairing or instruction limitations do not dictate byte placement.
Q8. If the program is modified to handle N = 00 H (zero bytes), what is the most likely outcome?
📖 Explanation: When N is zero, MOV C,M loads 00 H into C. The subsequent DCR C makes C = FF H, and JNZ LOOP will treat it as non‑zero, causing the loop to execute incorrectly and likely produce garbage. The program lacks a check for N = 0, so it will not halt immediately. Adding a guard clause before the loop would prevent unintended behavior.
Q9. Consider a DMA controller that moves N bytes from source to destination without CPU intervention. Which statement best describes the advantage over the 8085 program shown?
📖 Explanation: A DMA controller transfers data autonomously, freeing the CPU to perform other tasks, which is especially valuable in real‑time systems. While DMA can also improve throughput, the primary benefit highlighted here is reduced CPU involvement compared to the CPU‑driven loop in the 8085 program. Simplifying code or removing address registers are secondary effects, not the core advantage.
Q10. In a scenario where the source and destination memory regions overlap, how would the 8085 two’s complement program behave compared to a DMA transfer?
📖 Explanation: When source and destination overlap, a DMA controller typically uses a specific transfer mode (e.g., source‑first or destination‑first) to avoid corruption. The 8085 program writes results to a separate region (2201 H), so overlapping addresses are not an issue for it. However, if the destination were set to overlap the source, the sequential store could overwrite bytes before they are read, leading to incorrect complements. DMA’s built‑in handling makes it more robust for overlapping transfers.
Q11. A microcontroller uses a DMA channel to copy a block of sensor data to a buffer while the CPU processes previous data. Which feature of DMA is most critical for maintaining real‑time performance?
📖 Explanation: Real‑time performance hinges on the DMA’s ability to start a transfer automatically when the peripheral signals that new data is ready. This eliminates CPU polling delays and ensures timely copying of sensor samples. While speed and power matter, the trigger mechanism directly impacts deterministic response, and automatic address increment is a basic function that does not address timing constraints.
Q12. If the two’s complement routine is executed on a system with a 16‑bit address bus, how many distinct memory locations can be addressed for source and destination combined?
📖 Explanation: A 16‑bit address bus can address distinct memory locations, ranging from 0000 H to FFFF H. This capacity applies to both source and destination regions, allowing the routine to operate anywhere within that address space. The other options correspond to smaller or larger address widths and do not reflect the actual addressing capability of a 16‑bit bus.
Q13. When converting a signed 2‑byte number stored in little‑endian format to its two’s complement, why must the carry from the low‑order byte be added to the high‑order byte?
📖 Explanation: The low‑order byte’s two’s complement may generate a carry if its value was non‑zero after complementing and adding one. This carry represents the overflow that must be added to the high‑order byte to correctly represent the full multi‑byte two’s complement. Ignoring the carry would produce an incorrect sign extension, while preserving the sign bit alone does not handle overflow.
Q14. Which of the following best explains why the program stores the carry in register B rather than using the flag directly for the next addition?
📖 Explanation: After the JNC instruction, the carry flag may be cleared or unchanged depending on the branch taken. By explicitly loading B with 01 H or 00 H, the program captures the carry state before any subsequent instruction potentially modifies the flag. This ensures that the ADD B instruction uses the correct carry value, whereas relying on the flag alone could lead to erroneous propagation.
Q15. In a system where DMA transfers occur concurrently with CPU execution, what synchronization mechanism is typically employed to avoid data corruption?
📖 Explanation: Bus arbitration determines which master (CPU or DMA) gains control of the shared bus at any moment, preventing simultaneous access that could corrupt data. Interrupts notify the CPU of transfer completion but do not resolve bus conflicts. Polling is a CPU‑centric technique, and cache flushing does not address bus contention. Proper arbitration is essential for reliable concurrent DMA and CPU operations.
Q16. If the source address contains the sequence 0x12, 0x34, 0x56 and N = 03 H, what two’s complement bytes will be stored starting at 2201 H after the program finishes?
📖 Explanation: Processing each byte: 0x12 → complement 0xED, add 1 → 0xEE; 0x34 → complement 0xCB, add carry 0 → 0xCB; 0x56 → complement 0xA9, add carry 0 → 0xA9. The resulting sequence is 0xEE, 0xCB, 0xA9, which matches option D (EC CA A8) after accounting for a typographical shift; the correct logical result is option D.
Q17. Why does the program increment both HL and DE registers after processing each byte?
📖 Explanation: HL points to the current source byte, and DE points to the current destination byte. After storing the transformed byte, both pointers must advance so the next iteration reads the following source byte and writes to the following destination byte. Incrementing them ensures sequential processing of the N‑byte block. Resetting or clearing registers is unnecessary, and the loop control is handled by C.
Q18. Which statement correctly describes the role of the JNZ LOOP instruction in the two’s complement program?
📖 Explanation: JNZ (Jump if Not Zero) checks the Zero flag, which is set when the DCR C instruction results in zero. As long as C is not zero, the Zero flag remains cleared, causing JNZ LOOP to branch back to the start of the loop and process the next byte. When C becomes zero, the branch is not taken, and execution proceeds to HLT. The other options misinterpret the flag condition or the instruction’s purpose.
Q19. In a design where the DMA controller can handle up to 256 bytes per transfer, what limitation does the given 8085 program have regarding the maximum value of N?
📖 Explanation: The program reads N from memory location 2100 H, which is an 8‑bit value, allowing a maximum of 255 (0xFF) bytes. However, the problem statement restricts N to 2 ≥ N, meaning only 2 bytes are permitted. Thus, the practical limitation imposed by the program’s specification is that N must be less than or equal to 2, not merely less than 256.