libmsx
C library for MSX
Loading...
Searching...
No Matches

APIs for indirect access to banked memory by name. More...

+ Collaboration diagram for Reading and copying from resource in banked memory.:

Functions

void resource_copy_to_vmem (const char *path, vmemptr_t dst)
 Copy a resource in banked memory to VRAM.
 
void resource_bload_s (const char *path)
 Load a BSAVE formatted binary resource in banked memory into VRAM.
 
void resource_bload (const char *path, void *buf, size_t buf_size)
 Load a BSAVE formatted binary resource in banked memory into RAM.
 

Detailed Description

APIs for indirect access to banked memory by name.

Banked memory is treated as a ROM with one large address space, and as storage of named embedded resources.

Function Documentation

◆ resource_copy_to_vmem()

void resource_copy_to_vmem ( const char * path,
vmemptr_t dst )

Copy a resource in banked memory to VRAM.

Searches for an embedded resource in banked memory by name and copy it into the specified address in VRAM. If the resource is not found, do nothing.

This function is same as the following code:

c
const ResourceIndex * res = resource_find(path);
if (res) {
bmem_copy_to_vmem(res->offset, dst, res->size);
}
void bmem_copy_to_vmem(bmemptr_t src, vmemptr_t dst, uint32_t len)
Copy from banked memory to VRAM.
const ResourceIndex * resource_find(const char *path)
Find an embedded resource by name.
Index record of an embedded resource.
Definition resources.h:45
Parameters
pathpath/file name of the resource.
dstdestination address of VRAM.
See also
bmem_copy_to_vmem()

◆ resource_bload_s()

void resource_bload_s ( const char * path)

Load a BSAVE formatted binary resource in banked memory into VRAM.

Searches for embedded resources in banked memory by name and loads them into VRAM as binaries in BSAVE format.

Do nothing in the following cases

  • The resource is not found,
  • The resource is not a BSAVE formatted binary.

This function is same as the following code:

c
const ResourceIndex * res = resource_find(path);
if (res) {
bmem_bload_s(res->offset);
}
void bmem_bload_s(bmemptr_t src)
Load a BSAVE formatted binary in banked memory into VRAM.
Parameters
pathpath/file name of the resource.
See also
bmem_bload_s()

◆ resource_bload()

void resource_bload ( const char * path,
void * buf,
size_t buf_size )

Load a BSAVE formatted binary resource in banked memory into RAM.

Searches for embedded resources in banked memory by name and loads them into RAM as binaries in BSAVE format.

Do nothing in the following cases

  • The resource is not found,
  • The resource is not a BSAVE formatted binary.
  • Buffer size is too small.

This function is same as the following code:

c
const ResourceIndex * res = resource_find(path);
if (res) {
bmem_bload(res->offset, buf, buf_size);
}
void bmem_bload(bmemptr_t src, void *buf, size_t buf_size)
Load a BSAVE formatted binary in banked memory into RAM.
Parameters
pathpath/file name of the resource.
bufPointer to the RAM buffer.
buf_sizeBuffer size (i.e., capacity) in bytes.
See also
bmem_bload_s()