Jo Engine 2026.11.1
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
vdp2_malloc.h File Reference

VDP2 memory allocation (cell, map, rotation, scroll, etc). More...

Go to the source code of this file.

Macros

#define JO_VDP2_KTABLE_SIZE
#define JO_VDP2_ROTATION_TABLE_SIZE
#define JO_VDP2_MAP_SIZE
#define JO_VDP2_CELL_TO_MAP_OFFSET(CELL_PTR)

Enumerations

enum  jo_vdp2_ram_usage {
  JO_VDP2_RAM_USER , JO_VDP2_RAM_MAP_NBG0 , JO_VDP2_RAM_MAP_NBG1 , JO_VDP2_RAM_MAP_NBG2 ,
  JO_VDP2_RAM_MAP_NBG3 , JO_VDP2_RAM_MAP_RBG0 , JO_VDP2_RAM_KTABLE , JO_VDP2_RAM_RTABLE ,
  JO_VDP2_RAM_CELL_NBG0 , JO_VDP2_RAM_CELL_NBG1 , JO_VDP2_RAM_CELL_NBG2 , JO_VDP2_RAM_CELL_NBG3 ,
  JO_VDP2_RAM_CELL_RBG0 , JO_VDP2_RAM_BACK_COLOR , JO_VDP2_RAM_LINE_SCROLL , JO_VDP2_RAM_BITMAP_NBG0 ,
  JO_VDP2_RAM_BITMAP_NBG1 , JO_VDP2_RAM_COLOR , JO_VDP2_LINE_COLOR_TABLE
}

Functions

void * jo_vdp2_malloc (const jo_vdp2_ram_usage usage, const unsigned int n)
 Dynamic VDP2 memory allocator.
static __jo_force_inline void * jo_vdp2_malloc_autosize (const jo_vdp2_ram_usage usage)
 Dynamic VDP2 memory allocator for known size usage (JO_VDP2_RAM_RTABLE, JO_VDP2_RAM_KTABLE, JO_VDP2_RAM_COLOR).
bool __jo_vdp2_a0_start_is_free (const unsigned int n)
 Whether jo_vdp2_malloc() would return the start of the bank A0 for n bytes (bitmap, line scroll, cells).
void jo_vdp2_free (const void *const p)
 function frees VDP2 memory space pointed to by p

Detailed Description

VDP2 memory allocation (cell, map, rotation, scroll, etc).

Author
Johannes Fetz
Bug
No known bugs.

Macro Definition Documentation

◆ JO_VDP2_CELL_TO_MAP_OFFSET

#define JO_VDP2_CELL_TO_MAP_OFFSET ( CELL_PTR)

◆ JO_VDP2_KTABLE_SIZE

#define JO_VDP2_KTABLE_SIZE

◆ JO_VDP2_MAP_SIZE

#define JO_VDP2_MAP_SIZE

◆ JO_VDP2_ROTATION_TABLE_SIZE

#define JO_VDP2_ROTATION_TABLE_SIZE

Enumeration Type Documentation

◆ jo_vdp2_ram_usage

Enumerator
JO_VDP2_RAM_USER 

For user.

JO_VDP2_RAM_MAP_NBG0 

MAP (rotation and normal scroll screen maps).

JO_VDP2_RAM_MAP_NBG1 
JO_VDP2_RAM_MAP_NBG2 
JO_VDP2_RAM_MAP_NBG3 
JO_VDP2_RAM_MAP_RBG0 
JO_VDP2_RAM_KTABLE 

KTABLE (rotation coefficient table).

JO_VDP2_RAM_RTABLE 

Rotation table (rotation parameters).

JO_VDP2_RAM_CELL_NBG0 

CELL (rotation and normal scroll screen cells).

JO_VDP2_RAM_CELL_NBG1 
JO_VDP2_RAM_CELL_NBG2 
JO_VDP2_RAM_CELL_NBG3 
JO_VDP2_RAM_CELL_RBG0 
JO_VDP2_RAM_BACK_COLOR 

Back color (back screen color).

JO_VDP2_RAM_LINE_SCROLL 

Line Scroll table (NBG0 and NBG1 line scroll).

JO_VDP2_RAM_BITMAP_NBG0 

CELL (NBG0 and NBG1 bitmaps).

JO_VDP2_RAM_BITMAP_NBG1 
JO_VDP2_RAM_COLOR 

Color RAM for Palette, etc.

JO_VDP2_LINE_COLOR_TABLE 

Line color table (line color screen).

Function Documentation

◆ __jo_vdp2_a0_start_is_free()

bool __jo_vdp2_a0_start_is_free ( const unsigned int n)

Whether jo_vdp2_malloc() would return the start of the bank A0 for n bytes (bitmap, line scroll, cells).

Parameters
nSize in bytes
Returns
true if the next allocation of n bytes there is at JO_VDP2_VRAM_A0

◆ jo_vdp2_free()

void jo_vdp2_free ( const void *const p)

function frees VDP2 memory space pointed to by p

Parameters
ppointer that must have been returned by a previous call to jo_vdp2_malloc()

◆ jo_vdp2_malloc()

void * jo_vdp2_malloc ( const jo_vdp2_ram_usage usage,
const unsigned int n )

Dynamic VDP2 memory allocator.

Parameters
usageVDP2 memory segment usage
nSegment size
Returns
a pointer to the allocated memory or NULL if failed

◆ jo_vdp2_malloc_autosize()

__jo_force_inline void * jo_vdp2_malloc_autosize ( const jo_vdp2_ram_usage usage)
static

Dynamic VDP2 memory allocator for known size usage (JO_VDP2_RAM_RTABLE, JO_VDP2_RAM_KTABLE, JO_VDP2_RAM_COLOR).

Parameters
usageVDP2 memory segment usage
Returns
a pointer to the allocated memory or NULL if failed