libmsx
C library for MSX
Loading...
Searching...
No Matches
A part of building blocks for inter-memory transfer, dedicated to VRAM access.

Building blocks for copying and transferring data between different types of memory devices. More...

+ Collaboration diagram for A part of building blocks for inter-memory transfer, dedicated to VRAM access.:

Files

file  vmem_rw.h
 Stream like access functions for VRAM.
 

Functions

bool vmem_is_opened (void)
 MSX Tests whether VRAM accessor is opened or not.
 
void vmem_open (vmemptr_t loc)
 MSX Open VRAM accessor.
 
void vmem_close (void)
 MSX Close VRAM accessor.
 
void vmem_dup (uint16_t offset, size_t len)
 MSX Duplicate a byte sequence of VRAM starting from the specified offset to current position and later.
 
vmemptr_t vmem_ptr (void)
 Get current position of VRAM accessor.
 
void vmem_skip (size_t len)
 Advance the current position of VRAM accessor.
 
void vmem_write_chunk (const uint8_t *src, uint16_t len)
 Write a chunk to VRAM.
 
void vmem_read_chunk (uint8_t *dst, uint16_t len)
 Read a chunk from VRAM.
 

Detailed Description

Building blocks for copying and transferring data between different types of memory devices.

#include <vmem_rw.h>

Function Documentation

◆ vmem_is_opened()

bool vmem_is_opened ( void  )

MSX Tests whether VRAM accessor is opened or not.

Returns
whether VRAM accessor is opened or not.

◆ vmem_open()

void vmem_open ( vmemptr_t  loc)

MSX Open VRAM accessor.

Parameters
locbase address.
Precondition
!vmem_is_opened()

◆ vmem_close()

void vmem_close ( void  )

MSX Close VRAM accessor.

Precondition
vmem_is_opened()

◆ vmem_dup()

void vmem_dup ( uint16_t  offset,
size_t  len 
)

MSX Duplicate a byte sequence of VRAM starting from the specified offset to current position and later.

A data in range of [p - offset, p - offset + len) of VRAM will be copied to [p, p + len), where p is current position. If both area overlaps, repetition is occur.

For example, if the byte in p-1 is X, then vmem_dup(1, 3) copies X to p, p+1, p+2 and p is increased by 3.

Parameters
offsetdistance from the current position.
lenlength in bytes.
Precondition
vmem_is_opened()

◆ vmem_ptr()

vmemptr_t vmem_ptr ( void  )

Get current position of VRAM accessor.

Returns
current position.
Precondition
vmem_is_opened()
Note
internal use only.

◆ vmem_skip()

void vmem_skip ( size_t  len)

Advance the current position of VRAM accessor.

Parameters
lennumber of bytes.
Precondition
vmem_is_opened()

◆ vmem_write_chunk()

void vmem_write_chunk ( const uint8_t *  src,
uint16_t  len 
)

Write a chunk to VRAM.

Parameters
srcsource base address.
lennumber of bytes to be copied.
Precondition
vmem_set_write_address() has been called.
vmem_set_read_address() has not been called after vmem_set_write_address().
Note
internal use only.

◆ vmem_read_chunk()

void vmem_read_chunk ( uint8_t *  dst,
uint16_t  len 
)

Read a chunk from VRAM.

Parameters
dstdestination base address.
lennumber of bytes to be copied.
Precondition
vmem_set_read_address() has been called.
vmem_set_write_address() has not been called after vmem_set_read_address().
Note
internal use only.