dma and 6502

For discussing the 65xx hardware itself or electronics projects.
Post Reply
User avatar
ptorric
Posts: 85
Joined: 13 Feb 2005
Contact:

dma and 6502

Post by ptorric »

how can i find info about dma techniques with 6502?
thanx all!
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

This will sound silly, but datasheets are your best bet. If the 6502 you're using doesn't have any kind of DMA facility on-chip, then you can simulate it by:

1) Holding phase-2 low (IF AND ONLY IF your 6502 is a static design; if it's a dynamic design, this will not work) will stop the processor dead in its tracks. Then, you can use external bus transceivers to tri-state the address, data, and some control bus signals once the CPU is suitably halted.


2) If you're using an older (dynamic logic) 6502, then you can also hold RDY in a negated state, to halt the processor on the next READ cycle (this applies also to opcode fetch). The disadvantage is that this won't work on WRITE cycles, due to how the older 6502s worked. This wasn't much of an issue in practice, however -- the Commodore 64's DMA engine worked by simply negating RDY, waiting 6 clock cycles to allow any write cycles pending to complete, then disabling bus transceivers.

You'll find modern 6502 implementations to be more accomodating to DMA, especially Western Design Center's chips. Their chips are not only DMA friendly, but also static designs.
User avatar
Ruud
Posts: 259
Joined: 12 Dec 2003
Location: Heerlen, NL
Contact:

Post by Ruud »

kc5tja wrote:
This ) Holding phase-2 low ...
Shouldn't that be HIGH? No datasheets at hand right now but I'm quite sure.

Code: Select all

    ___
   / __|__
  / /  |_/     Groetjes, Ruud 
  \ \__|_\
   \___|       URL: www.baltissen.org

kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

No, it must be held low.

The 6502's bus tenure is broken into two phases: phase 1 (clock low) and phase 2 (clock high).

Phase 1 is when the CPU combinatorially computes the next bus state. Phase 2 is then it samples the bus state for the next cycle.

Therefore, phase 1 is, essentially, a wasted half-cycle from a data transfer point of view. This is why Commodore, Atari, Apple, et. al., all interleave video and CPU accesses to RAM, with video occuring during phase 1, and CPU during phase 2.

Thus, to delay the CPU for an indefinite amount of time (again, this is all assuming static logic), one can hold the CPU's clock low -- thus elongating phase 1 of the bus cycle.
User avatar
ptorric
Posts: 85
Joined: 13 Feb 2005
Contact:

Post by ptorric »

kc5tja wrote:
This will sound silly, but datasheets are your best bet. If the 6502 you're using doesn't have any kind of DMA facility on-chip, then you can simulate it by:
...anyway you give me a good hint!
thank you!
User avatar
Ruud
Posts: 259
Joined: 12 Dec 2003
Location: Heerlen, NL
Contact:

Post by Ruud »

kc5tja wrote:
No, it must be held low. ...
I just downloaded a PDF from WDC and now there is no maximum time for PHI0 being (L) anymore. Its seems they improved the 6502 again.

Code: Select all

    ___
   / __|__
  / /  |_/     Groetjes, Ruud 
  \ \__|_\
   \___|       URL: www.baltissen.org

kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post by kc5tja »

As far as I know, the CMOS version of the 6502 (and W65C02 in particular) has always been a static logic design, so it's always been more flexible with its clocking.

The NMOS variants were definitely dynamic logic though, as I remember several chips having minimum frequencies and duty cycle requirements (including chips from Commodore). It never made sense to me why minimum clock frequencies were imposed until I learned about the differences between static and dynamic logic.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

The Rockwell, CMD, etc. 65c02's had a maximum phase-2-low time, but could hold phase 2 high indefinitely. WDC made it so you could hold it in either state as long as you want, and put the "S" at the end of the part number to mean "static". The NMOS ones had maximum times for both, so there was no way to run the clock below something like 100kHz regardless of duty cycle.
Post Reply