The 8237 DMA chip moves bytes between I/O devices and memory without CPU copying. Program channel registers for address, count, and mode, then assert mask/unmask bits. For example, floppy controllers historically used DMA channel 2 to transfer 512-byte sectors to 0x7C00.
Channel setup outline
nasm
Loading…
Ports: 0x00-0x0F master, 0xC0-0xDE page registers for high address byte
Mask register: Disable channel during programming
Count register: Actual value is count minus one
ISA limitations: 24-bit addresses unless 16-bit DMA page registers used
Floppy and alignment
Historical DMA channel 2 for the floppy required word-aligned buffers in low memory. The page register holds bits 16-23 of the address on ISA machines. Unmask only after all bytes of the transfer count are written; the flip-flop resets between low and high byte writes to the count port. QEMU still models ISA DMA enough to see a transfer complete bit assert in the master status register.
Why for this exercise
You will program a DMA channel for a memory buffer and trigger a device transfer. This exercise requires writing address/count bytes in the correct order and unmasking the channel when ready.
Compute Intel 8237 ISA DMA programming bytes in C from stdin requests (channels 0-3, 8-bit master controller).
Input format:
Line 1: N, the number of commands.
Then one command per line:
"SET <ch> <addr_hex> <count>": buffer physical address and byte count