Is it possible to "read back" tiles you've loaded into the VDP using SGDK?
If not, what MMIO ports and commands will get me access to the tiles already loaded into the Genesis VDP?
Reading back tiles from VDP
Moderator: Stef
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Reading back tiles from VDP
SGDK do not have any methods to read back data in VRAM / CRAM or VSRAM but you can use the followings macros to do it :
GFX_READ_VRAM_ADDR(adr)
GFX_READ_CRAM_ADDR(adr)
GFX_READ_VSRAM_ADDR(adr)
For instance :
GFX_READ_VRAM_ADDR(adr)
GFX_READ_CRAM_ADDR(adr)
GFX_READ_VSRAM_ADDR(adr)
For instance :
Code: Select all
void VDP_readTileData(u16 plan, u16 ind, u16 num, u32* dest)
{
vu32 *plctrl;
vu32 *pldata;
u32 addr;
u32 *d;
VDP_setAutoInc(2);
/* point to vdp port */
plctrl = (u32 *) GFX_CTRL_PORT;
pldata = (u32 *) GFX_DATA_PORT;
addr = plan + (ind * 2);
*plctrl = GFX_READ_VRAM_ADDR(addr);
d = dest;
*d++ = *pldata;
*d++ = *pldata;
*d++ = *pldata;
*d++ = *pldata;
*d++ = *pldata;
*d++ = *pldata;
*d++ = *pldata;
*d = *pldata;
}