Это видео недоступно.
Сожалеем об этом.
DMA - Direct Memory Access on the ZX Spectrum Next
HTML-код
- Опубликовано: 17 авг 2024
- This is the third video in a short series looking at some of the more advanced parts of the Spectrum Next. If you've not seen the others, go watch them after this one. In this video we're looking at how to program the DMA controller in the Spectrum Next.
This'll be technical, it'll include code on how to do this using Z88DK and C for the Spectrum Next. It's a pretty advanced technique, but it's quite understandable and can add some nice speed boosts to code if used appropriately.
DMA or Direct Memory Access is a way to allow devices access to system RAM without the CPU being involved.
The DMA controller in the Next is a programmable device and has a few registers that need writing to. This is well documented on the Spectrum Next wiki wiki.specnext.....
There are seven registers called WR0 to WR6. Writing to them is like when we configured the sprite system in my other video. Each register is accessed through the same IO port and the pattern of the first three bits tells the DMA controller which register you're writing to.
The only thing to know is this is purely a DMA, it can copy continuous runs of bytes. It's not a blitter so it is unable to copy a rectanglular block of RAM.
Also for small copies, the setup and configuration may actually be slower than doing it by hand with memcpy. It's definitely something to use with large amounts of data though. A music playing routine running in a vblank interrupt would use this to feed the audio hardware with sound data.
Chapters:
00:00 Start!
00:45 What is DMA?
01:41 ZX Next DMA
02:01 The DMA Registers
02:32 Register WR0
03:10 Code example DMA Screen Copy
04:23 Register WR1
05:03 Registers WR2 and WR3
05:20 Register WR4
05:44 Register WR6
06:13 A note on writing to registers
06:45 Repeating DMA transfers
08:00 Closing Notes
Credits:
Casio Calculators - J. C. Barros from Portugal, CC BY 2.0, via Wikimedia Commons
Random images - Midjourney
Music - Epidemic Sounds
Great video, as usual. Thanks!!
Dma on the Amiga was awesome, programming the copper which in turn could program any of the chipset including the blitter iirc.
Great video, using the Next DMA to load a Layer 2 image was a great idea, I'm going to program that myself now. Thinking about it the DMA prescalar settings could be used to scroll layer 2 (writing to ports 0x16 or 0x17), or the tile map while the CPU got on with other things.
I used the DMA to add Defender sound samples into Jetpac for The Spectrum Show episode 117 it was a really fun project and I enjoyed doing it but I wish this video have been available before I started.
Have you ever explored CPM on the spectrum?
The 128 should even be able to run CPM 3. Those are great for getting into assembly coding on the z80. They give you just enough functionality to get going, like print strings and characters or get input from the console, or reading and writing files. But the os also doesn't get in your way, and is easy to handle
Cobol isn’t dead, microfocus have their compiler targeting android.