9

I've heard the term 'DMA' being used a lot in reference to older consoles. My very basic understanding is that it's a way for the console to access memory directly. But directly as apposed to what? isn't RAM always accessed directly?

11
  • 3
    This is off-topic because it’s not specifically about retro-computing, but briefly put, DMA (direct memory access) allows peripherals to access memory directly. See Wikipedia for details. Oct 24, 2019 at 13:46
  • 1
    @JackKasbrack DMA is the BASE for any modern system. As stephen says, there is nothing specific retro about - at least not more as with the terms RAM, CPU or Keyboard.
    – Raffzahn
    Oct 24, 2019 at 13:51
  • 7
    I guess the term was thrown around much more in retro terms because back then its implementation was worth shouting about — e.g. the Atari ST using DMA for its floppy disk is a big step forwards from most of the previous home computers which required the CPU to go into a busy poll loop, to the exclusion of all other work. Nowadays it's unimaginable that media access would block all OS activity.
    – Tommy
    Oct 24, 2019 at 14:45
  • 2
    @Smock nope, not a chance
    – Badasahog
    Oct 24, 2019 at 14:54
  • 4
    After some thought, I've decided I feel this question is on-topic for RCSE because you need to know the answer to know that DMA is not just a retrocomputing thing. I've made a meta post for detailed discussion of this, and voted to re-open.
    – cjs
    Oct 25, 2019 at 6:54

3 Answers 3

10

"The console" (or other computer) is made up of various parts, including the processor, the memory, and peripherals such as video display controllers, I/O chips to read from a keyboard or joystick, disk controllers, and so on.

When using "programmed I/O," the CPU reads data from or writes data to a peripheral and, if the data need to be stored in memory, the CPU does that as well. So the CPU might read a byte from the disk controller, store that byte into a buffer in memory, and repeat that to read an entire sector from disk.

DMA allows the CPU to be paused and/or disconnected from the memory bus so that peripherals can directly read data from or write data to the memory without the involvement of the CPU. Thus, instead of the example given above, a disk controller could write its bytes directly to memory while the CPU waits, which is faster because rather than "read byte then write byte" by the CPU there's just "write byte" by the peripheral.

3
  • Nice and simple +1 but I just need to add ... while copying by CPU there must be also some instructions used to copy so the CPU is accessing also program memory to read the instructions while copying lowering the speed much much more ... here nice example of the difference: Breakeven number of bytes for programmable DMA
    – Spektre
    Oct 27, 2019 at 8:07
  • while the CPU waits – Or while the CPU is running cycles that don't need the memory bus!
    – forest
    Mar 7, 2021 at 9:10
  • @Spektre Actually, it depends on the form of DMA. It was not unusual for microcomputer video systems (such as the Apple II and the Commodore 64) to read video display data directly from the main system RAM, which was continuous and automatic, requiring no programming or setup except to do things like changing the display mode.
    – cjs
    Mar 7, 2021 at 9:37
4

(Too long for a comment)

DMA is not in any way console or retro computing related. It is actual technology and today used more than ever. Each of your disk reads and writes, each transfer to your graphics or network card will usually involve DMA.

DMA describes the access of components, other than the CPU, on (a CPU's) memory. In general it's the ability to run a multi master bus system. Further information can be found at the corresponding Wiki page and next to endless other resources on the web.

0
1

DMA is a technique where you can move memory around without involving the main CPU. This was a huge win for old gaming hardware as an awful lot of time can be spent simply shuffling graphics data around the screen memory. Offloading this task to custom silicon meant the CPU had more time to do much more interesting and computationally expensive things. The actual copying itself can be done much more quickly too, meaning smoother scrolling etc.

1
  • depends on the implementation, many dma implementations, the cpu had to stall and wait for the dma to complete, it wasnt free, in those implementations it was more of an efficiency thing, the cpu instructions could move one or a few things at a time, where dma could be used to move chunks at bus speeds. only sometimes it freed up the cpu to do stuff in parallel
    – old_timer
    Feb 13, 2020 at 12:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .