Skip to content
Advanced Microprocessor

8257 DMA Controller: Architecture & Bus Mastership

4 independent DMA channels, cycle stealing vs burst mode, HOLD/HLDA handshaking, address/count registers, and high-speed I/O.

Knova editors11 min readQuick checkSources

The 8257 Direct Memory Access (DMA) Controller

In standard programmed I/O and interrupt-driven transfers, every data byte moving between a high-speed peripheral (such as a hard disk drive, network interface, or optical drive) and memory must pass through the CPU registers (such as Accumulator AA or AXAX).

This software-driven path incurs severe overhead: the CPU must fetch the instruction, decode the opcode, read from the I/O port, compute the memory address, and write the byte to RAM. For mass storage devices transferring millions of bytes per second, this bottleneck limits system bandwidth.

Architecture and Channel Structure of the 8257

The Intel 8257 is a 4-channel programmable DMA controller housed in a 28-pin DIP package. It can manage four independent peripheral devices concurrently through Channels 0, 1, 2, and 3.

Each channel features two 16-bit internal registers:

  1. DMA Address Register (16-bit): Holds the starting memory address for the DMA transfer. It automatically increments after each byte is successfully transferred.
  2. Terminal Count Register (14-bit Count + 2-bit Type): The lower 14 bits (C13−C0C_{13}-C_0) store the programmed number of byte transfers minus one (N−1N - 1), allowing transfers of up to 214=16,384 bytes (16 KB)2^{14} = 16,384\text{ bytes } (16\text{ KB}) per sequence. The counter decrements after each byte transferred.
    • The upper two bits (C15,C14C_{15}, C_{14}) encode the DMA cycle type:
      C15C_{15}C14C_{14}DMA Transfer Cycle Type
      00DMA Verify Cycle (Generates addresses without asserting strobes)
      01DMA Write Cycle (Transfers data from Peripheral to Memory)
      10DMA Read Cycle (Transfers data from Memory to Peripheral)
      11Illegal / Reserved

8257 Signal Descriptions and Bus Arbitration

The 8257 operates in two alternating operational states: Slave Mode (when programmed by the CPU) and Master Mode (when controlling the buses during DMA transfers).

  • DRQ0−DRQ3DRQ_0-DRQ_3 (DMA Request Inputs): Asynchronous request lines asserted by peripherals requesting DMA service.
  • DACK0‾−DACK3‾\overline{DACK_0}-\overline{DACK_3} (DMA Acknowledge Outputs): Active-low lines from the 8257 notifying the peripheral that its request is being serviced.
  • HRQ (Hold Request Output): Connected to the CPU's HOLD pin. The 8257 pulls HRQ high to request the CPU to float its buses.
  • HLDA (Hold Acknowledge Input): Connected to the CPU's HLDA pin. When high, the CPU has tri-stated its buses, giving the 8257 full bus mastership.
  • AEN (Address Enable Output): Disables the CPU's bus buffers and peripheral decoders, preventing bus contention during DMA cycles.
  • ADSTB (Address Strobe Output): Pulses high to latch the higher-order memory address byte (A15−A8A_{15}-A_8) from data pins D7−D0D_7-D_0 into an external 74LS373 latch.
  • TC (Terminal Count Output): Asserts high when the terminal count register reaches 00, signaling the peripheral that the programmed block transfer is complete.
  • MARK (Output): Generates a pulse every 128 bytes of transfer to assist peripheral sector and block framing.

Data Transfer Modes: Cycle Stealing vs. Burst Mode

  1. Cycle Stealing Mode (Single Byte Transfer): The peripheral requests DMA for a single byte. The 8257 requests the bus, transfers one byte, and immediately releases the bus back to the CPU. This mode allows the CPU to continue processing code concurrently with slow I/O devices.
  2. Burst Transfer Mode (Block Transfer): The 8257 retains control of the buses continuously until the entire block of data is transferred (until the Terminal Count reaches zero). This provides maximum possible data throughput for ultra-high-speed devices.

Step-by-Step DMA Transfer Sequence

  1. The peripheral asserts its DMA Request line (DRQnDRQ_n).
  2. The 8257 evaluates channel priority and asserts its Hold Request (HRQHRQ) pin high to the CPU.
  3. The CPU finishes its current machine cycle, floats its address, data, and control lines into high impedance, and returns Hold Acknowledge (HLDAHLDA) high.
  4. The 8257 asserts Address Enable (AENAEN) high and activates DMA Acknowledge (DACKn‾\overline{DACK_n}) to the peripheral.
  5. The 8257 outputs the memory address: lower byte directly on A7−A0A_7-A_0, and upper byte on D7−D0D_7-D_0 with an ADSTBADSTB pulse into an external latch.
  6. For a DMA Write (Peripheral to Memory), the 8257 asserts both IOR‾\overline{IOR} and MEMW‾\overline{MEMW} simultaneously. Data flows directly from the peripheral into memory across the system data bus in a single clock cycle!
  7. The DMA address register increments, and the terminal count decrements.
  8. When the count reaches zero, the 8257 asserts TCTC high, drops HRQHRQ low, and relinquishes the bus back to the CPU.
Direct Memory Access ControllerRequest Phase

Intel 8257 DMA Transfer & Bus Arbitration Engine

DMA Channel:
Active Bus Master:8085 CPU
HOLD: 0HLDA: 0/DACK2: 1TC: 0
I/O Peripheral
Disk Controller
DRQ2 RequestASSERTED (HIGH)
Hardware device asserting request.
Arbitrator / Controller
Intel 8257 DMAC
Ch 2 Address Reg8000H
Contains 16-bit DAR & 14-bit TC.
Host Processor
8085 MPU
CPU Bus StateDRIVING BUS
Suspends execution when HLDA=1.
Target Storage
System RAM
Location 8000HReady
Receives byte directly via /MEMW.
Address Bus (A15–A0):2050H (CPU PC)
Data Bus (D7–D0):Normal CPU fetch

Stage 1: Peripheral Asserts DMA Request (DRQ)

The I/O peripheral (e.g. disk controller or high-speed ADC) is ready to transfer data. It asserts DRQ (DMA Request) on Channel 2 of the 8257. The 8085 CPU continues executing normal program instructions on the system bus.

Mode: Fly-by DMA Write (Peripheral → Memory)Stage 1 of 5

Internal Control and Status Registers

The 8257 contains two dedicated internal control and status registers accessed when A3−A0=1000BA_3-A_0 = 1000\text{B}:

1. Mode Set Register (Write-Only, Port Address 08H08\text{H})

D7D_7D6D_6D5D_5D4D_4D3D_3D2D_2D1D_1D0D_0
ALTCSEWRPEN3EN2EN1EN0
  • AL (Auto Load, Bit 7): 1=Enable Channel 2 Auto Load1 = \text{Enable Channel 2 Auto Load}. When Channel 2 reaches Terminal Count, it automatically reloads its initial address and count from Channel 3 registers (ideal for continuous CRT refresh).
  • TCS (TC Stop, Bit 6): 1=Disable channel upon Terminal Count1 = \text{Disable channel upon Terminal Count}. Prevents further transfers on that channel until re-enabled by CPU.
  • EW (Extended Write, Bit 5): 1=Extend MEMW‾ and IOW‾ pulses1 = \text{Extend } \overline{MEMW} \text{ and } \overline{IOW} \text{ pulses} by 1 clock state to accommodate slower memory chips.
  • RP (Rotating Priority, Bit 4):
    • 0=Fixed Priority Mode:0 = \textbf{Fixed Priority Mode:} Channel 0 (Highest)>CH1>CH2>CH3 (Lowest)\text{Channel 0 (Highest)} > \text{CH1} > \text{CH2} > \text{CH3 (Lowest)}.
    • 1=Rotating Priority Mode:1 = \textbf{Rotating Priority Mode:} The channel that was just serviced rotates to the lowest priority rank, preventing high-bandwidth devices on Channel 0 from starving other channels.
  • EN3-EN0 (Channel Enables, Bits 3-0): Individual channel enables (1=enable Channel n1 = \text{enable Channel } n, 0=disable0 = \text{disable}).

2. Status Register (Read-Only, Port Address 08H08\text{H})

D7D_7D6D_6D5D_5D4D_4D3D_3D2D_2D1D_1D0D_0
000UPTC3TC2TC1TC0
  • UP (Update Flag, Bit 4): Set to 11 during Channel 2 Auto-Load update.
  • TC3-TC0 (Terminal Count Status, Bits 3-0): Set to 11 when the corresponding channel reaches Terminal Count. Cleared automatically upon reading the status register.

3. Architectural Comparison: Intel 8257 vs. Intel 8237

FeatureIntel 8257Intel 8237 (High Performance)
Data Transfer RateUp to 1.6 MB/s\text{Up to } 1.6\text{ MB/s}Up to 2.5 MB/s\text{Up to } 2.5\text{ MB/s}
Memory-to-MemoryNot supported (I/O to Mem only)Supported using Channel 0 and 1
Transfer ModesSingle byte / BurstSingle, Block, Demand, Cascade
Active Edge PolarityFixed active high DRQProgrammable DREQ/DACK polarities
Auto-InitializationChannel 2 only (via CH3)All 4 channels supported independently
Try it
DMA Bus Control Mechanism: During a DMA memory write transaction, which control lines are asserted by the 8257 controller?

Sources

  1. 1.Intel 8255 PPI Documentation · reference · Intel (opens in a new tab)

Was this chapter useful?

Editors read every answer.

Star this chapter

Each star goes once to every reader who improved this chapter.

Finished reading?

Mark it to keep your place in the course.