cjs wrote:
wayfarer wrote:
...its more about saving CPU cycles at this point and offloading 'some' of the work onto the 6522
why load or run a counter for copying data, if the 6522 has one...
Well, given that you have to stop the CPU and have it sit there doing nothing while DMA is occurring, I don't see why you'd bother having an external device copy memory unless it could do it in fewer cycles than the CPU. (Unless of course you're just trying to show how clever you are—I mean
really clever, like Dr. Jefyll-level clever—in which case go right ahead and everybody will be totally impressed!
That's serious, by the way; using a 6522 to run DMA might be totally useless, but I'd love to see the design of the circuit and software that does it.)
why would you think the CPU sit Idle, it just
shouldn't use memory.
if you have a CPU on a system that has a DMA or memory lockout, your CPU you do 'something else' if possible yeah?
it can do all sort of things on the registers if it doesnt touch memory without harm. i think the software would be tricky though
part of why I asked is to see why the 6522 isnt used more this way, it looks obvious, you save 3-4 operations doing what Im thinking (though Im not sure Im conveying it well )
Quote:
The standard 6502 copy loop using (zp),Y addressing is about 15 cycles/byte IIRC, a few cycles more on average if you're copying more than 255 bytes. So there's lots of room for savings there.
The 65816 MOVN and MOVP instructions are 7 cycles per byte, which is a huge improvement, but still nowhere near what a good DMA engine can do: 2 cycles per byte.
could you go over those cycles so I can point out where Im talking about using the 6522?
BigDumbDinosaur wrote:
cjs wrote:
The 65816 MOVN (sic) and MOVP (sic) instructions are 7 cycles per byte, which is a huge improvement, but still nowhere near what a good DMA engine can do: 2 cycles per byte.
Using MVN/MVP has the limitation that the 65C816 doesn't have the handshake mechanism typically implemented by a true DMA controller. External logic would be needed to implement that, which is hardly a showstopper, especially given the capabilities of programmable logic.
A more difficult problem is that as a copy progresses, both source and destination addresses emitted by the 816 change with each byte that is copied. In the most common type of DMA transfer, data is copied to or from an I/O port, whose address is fixed. That sort of transfer done with MVN/MVP obviously won’t fly.
It seems to me the best bet for implementing a homebrew DMA controller would be to use state machine logic in a CPLD. I've not given that any thought to date.yeah Im just sticking with the 6502 for this right now, the 65816 has a different set of problems...
having a fixed I/O simplifies what Im talking about doing with the 6522.
as for a "Custom Pretty Logic Doohickey", I am thinking of a 4-bit 'processor/latch' for some things, ISA bus, few other places
I am looking at maybe just using an 8bit latch, for 4-bits of chip select and 4-bits of extra memory addresses...
idk yet.
cjs wrote:
BigDumbDinosaur wrote:
Using MVN/MVP has the limitation that the 65C816 doesn't have the handshake mechanism typically implemented by a true DMA controller.
Interesting. Can you tell me more about that?
Quote:
A more difficult problem is that as a copy progresses, both source and destination addresses emitted by the 816 change with each byte that is copied. In the most common type of DMA transfer, data is copied to or from an I/O port, whose address is fixed.
Ah, I'd not thought about that: I was thinking of just doing moves between memory locations, REU-style. And of course on the systems I generally tend to have in mind, 1-2 MHz 6502s, typically I/O devices are too slow to bother with DMA unless (again as with the REU) your "I/O" device is RAM. But I guess that changes as you add faster I/O devices.
It is sounding like more and more, using a PIC18 or so is probably a lot better choice than the 6522 at this point. Its cheap, has DMA, has I/O lines, has ROM/RAM, has interrupts and can be programmed with very simple loops for stuff like this on its own. Also built in SPI etc for driving a screen...
the 6522 is a pretty cool chip, it has a lot and I think if it was better integrated to the 6502 itself, might have ended up more like a pic or avr. the 65134 just seems like it might be overkill here though. Ill look them over.
I still think the 6522 can offer some automation or assistance to data transfers using its counters and ports, and if my hunch is correct, save the 6502 some time or work.
https://media.tenor.com/RYvCCepol0gAAAAC/elmo-shrug.gif