Code: Select all
void dma_vram_copy(uint source,ushort dest,ushort len)
{
register volatile ushort *pw;
register uint *pl;
/* Halt the Z80 for DMA */
pw = (ushort *) Z80_HALT;
*pw = 0x100;
/* Point to GFX register */
pw = (ushort *) GFXCNTL;
/* Setup DMA length */
len >>= 1;
*pw = 0x9300L + (len & 0xff);
*pw = 0x9400L + ((len >> 8) & 0xff);
/* Setup DMA address */
source >>= 1;
*pw = 0x9500L + (source & 0xff);
source >>= 8;
*pw = 0x9600L + (source & 0xff);
source >>= 8;
*pw = 0x9700L + (source & 0xff);
/* Enable DMA */
pl = (uint *) GFXCNTL;
*pl = GFX_DMA_ADDR((uint) dest);
/* Enable Z80 */
pw = (ushort *) Z80_HALT;
*pw = 0;
}
Code: Select all
pl = (uint *) GFXCNTL;
*pl = GFX_DMA_ADDR((uint) dest);
I haven't tested to see how this code actually compiles, but I think it's irrelevant anyway; it's still an error in the code even though it may compile into the correct operation. I think the only way to be absolutely sure that the operation uses memory would be to use inline ASM.
- Kef