SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
vram.h
Go to the documentation of this file.
1
143
144#ifndef _VRAM_H_
145#define _VRAM_H_
146
147
163typedef struct
164{
165 u16 startIndex;
166 u16 endIndex;
167 u16 *free;
168 u16 *vram;
169} VRAMRegion;
170
171
188void VRAM_createRegion(VRAMRegion *region, u16 startIndex, u16 size);
200void VRAM_releaseRegion(VRAMRegion *region);
208void VRAM_clearRegion(VRAMRegion *region);
209
240
255s16 VRAM_alloc(VRAMRegion *region, u16 size);
267void VRAM_free(VRAMRegion *region, u16 index);
268
269
270#endif // _VRAM_H_
VRAM region structure.
Definition vram.h:164
short s16
Definition types.h:84
unsigned short u16
Definition types.h:100
void VRAM_clearRegion(VRAMRegion *region)
Release all allocations from specified VRAM region.
Definition vram.c:41
void VRAM_createRegion(VRAMRegion *region, u16 startIndex, u16 size)
Initialize a new VRAM region structure.
Definition vram.c:23
u16 VRAM_getFree(VRAMRegion *region)
Return the number of free tile remaining in the specified VRAM region.
Definition vram.c:54
u16 VRAM_getLargestFreeBlock(VRAMRegion *region)
Return the largest free block size (in tile) in the specified VRAM region.
Definition vram.c:79
void VRAM_free(VRAMRegion *region, u16 index)
Release the previously allocated VRAM block at specified index in the given VRAM region.
Definition vram.c:203
s16 VRAM_alloc(VRAMRegion *region, u16 size)
Try to allocate the specified number of tile in the given VRAM region and return its index.
Definition vram.c:135
void VRAM_releaseRegion(VRAMRegion *region)
Release the VRAM region structure.
Definition vram.c:34
u16 VRAM_getAllocated(VRAMRegion *region)
Return the number of allocated tile in the specified VRAM region.
Definition vram.c:106