Function SetUserRamTilesCount

From Uzebox Wiki
Jump to navigation Jump to search
Prototype

void SetUserRamTilesCount(u8 count);

Description

For video modes that use ram tiles, sets the starting point of free ram tiles the kernel will blit sprites to. This can protect ram tiles from sprite blitting for "ram tile tricks"

Parameters
  • count: the first ram tile that the kernel can use for sprite blitting, every ram tile under that will not be modified by the kernel.
Returns

Void

Video Modes

3

Since

V3

Notes

see examples on the forums, or ask a question. This subject is a bit more complex than some.

Example:

sprites[0].x = sprites[0].y = sprites[0].tileIndex = 30;//set up a sprite to draw, normally would start using ram tile 0, since offset, would use 0-3
ram_tiles[(0*64)+32] = 0xFF;//put a white dot on ram tile 0
vram[30/8] = 0;//point vram at the ram tile we just put a dot on, underneath the sprite
vram[100] = 0;//point another place in vram at the white dot graphics
SetUserRamTilesCount(1);//protect the white dot ram tile from kernel sprites
WaitVsync(1);//the user will not see the "sprite curtain" at vram[100], since the kernel copied ram tile 0(when the sprite overlapped it) to a new index and used that in place. It is restored automatically, the user simply needs to specify what ram tiles to protect then modify them with impunity.