libmsx
C library for MSX
Loading...
Searching...
No Matches
VRAM access interface

Read / Write VRAM. More...

+ Collaboration diagram for VRAM access interface:

Typedefs

typedef uint32_t vmemptr_t
 Type for VRAM address.
 

Functions

void vmem_set_read_address (vmemptr_t loc)
 MSX Set VRAM address for sequential reading of VRAM.
 
void vmem_set_write_address (vmemptr_t loc)
 MSX Set VRAM address for sequential writing of VRAM.
 
uint8_t vmem_get (void)
 MSX Read 1 byte from VRAM.
 
void vmem_set (uint8_t val)
 MSX Write 1 byte to VRAM.
 
void vmem_read (vmemptr_t src, void *dst, uint16_t len)
 MSX Read a series of bytes from VRAM.
 
void vmem_write (vmemptr_t dst, void *src, uint16_t len)
 MSX Write a series of bytes to VRAM.
 
void vmem_memset (vmemptr_t dst, uint8_t val, uint16_t len)
 MSX Fill a series of bytes in VRAM with the specified value.
 

Detailed Description

Read / Write VRAM.

Typedef Documentation

◆ vmemptr_t

typedef uint32_t vmemptr_t

Type for VRAM address.

Definition at line 42 of file vmem.h.

Function Documentation

◆ vmem_set_read_address()

void vmem_set_read_address ( vmemptr_t  loc)

MSX Set VRAM address for sequential reading of VRAM.

This function sets the VRAM access base address register (R#14) and/or the VRAM address counter to a value based on loc for sequential reading of VRAM in subsequent calls to vmem_get().

Parameters
locVRAM address.
See also
vmem_get()

◆ vmem_set_write_address()

void vmem_set_write_address ( vmemptr_t  loc)

MSX Set VRAM address for sequential writing of VRAM.

This function sets the VRAM access base address register (R#14) and/or the VRAM address counter to a value based on loc for sequential writing of VRAM in subsequent calls to vmem_set().

Parameters
locVRAM address.
See also
vmem_set()

◆ vmem_get()

uint8_t vmem_get ( void  )
inline

MSX Read 1 byte from VRAM.

Returns
a value read from VRAM.
Note
vmem_set_read_address() must be called at least once, before calling vmem_get(). Also, after the last call to vmem_set_read_address() and before calling vmem_get(), vmem_set_write_address() must not be called.
See also
vmem_set_read_address()
vmem_read()

Definition at line 83 of file vmem.h.

◆ vmem_set()

void vmem_set ( uint8_t  val)
inline

MSX Write 1 byte to VRAM.

Parameters
vala value to be written to VRAM.
Note
vmem_set_write_address() must be called at least once, before calling vmem_set(). Also, after the last call to vmem_set_write_address() and before calling vmem_set(), vmem_set_read_address() must not be called.
See also
vmem_set_write_address()
vmem_write()

Definition at line 100 of file vmem.h.

◆ vmem_read()

void vmem_read ( vmemptr_t  src,
void *  dst,
uint16_t  len 
)

MSX Read a series of bytes from VRAM.

This function copies len bytes from VRAM to RAM.

That is almost same as the below code:

for (uint8_t *p = dst; len--; ) {
*p++ = vmem_get();
}
void vmem_set_read_address(vmemptr_t loc)
MSX Set VRAM address for sequential reading of VRAM.
uint8_t vmem_get(void)
MSX Read 1 byte from VRAM.
Definition vmem.h:83
Parameters
srcsource base address of VRAM.
dstdestination base address of RAM.
lennumber of bytes to be read.

◆ vmem_write()

void vmem_write ( vmemptr_t  dst,
void *  src,
uint16_t  len 
)

MSX Write a series of bytes to VRAM.

This function copies len bytes from ROM/RAM to VRAM.

That is almost same as the below code:

for (uint8_t *p = src; len--; ) {
vmem_set(*p++);
}
void vmem_set_write_address(vmemptr_t loc)
MSX Set VRAM address for sequential writing of VRAM.
void vmem_set(uint8_t val)
MSX Write 1 byte to VRAM.
Definition vmem.h:100
Parameters
dstdestination base address of VRAM.
srcsource base address of ROM/RAM.
lennumber of bytes to be written.

◆ vmem_memset()

void vmem_memset ( vmemptr_t  dst,
uint8_t  val,
uint16_t  len 
)

MSX Fill a series of bytes in VRAM with the specified value.

That is almost same as the below code:

for (; len--; ) {
vmem_set(val);
}
Parameters
dstdestination base address of VRAM.
vala byte value to be written.
lennumber of bytes to be written.