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

Stream interface for ROM / RAM / MegaROM. More...

#include <bmem.h>
#include <stdbool.h>
#include <stdint.h>
#include "./internal/memfile_types.h"
+ Include dependency graph for memfile.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MEM_SEEK_SET   (0)
 A constant to specify that the offset is relative to the start of the stream.
 
#define MEM_SEEK_CUR   (1)
 A constant to specify that the offset is relative to the current position indicator.
 
#define MEM_SEEK_END   (2)
 A constant to specify that the offset is relative to the end of the stream.
 

Typedefs

typedef struct MemPos mempos_t
 Stream position indicator.
 
typedef struct MemFile MemFile
 Stream pointer.
 

Functions

void mfopen_mem (MemFile *mf, uint8_t *p, size_t size)
 Open memory image in ROM/RAM as stream.
 
void mfopen_bmem (MemFile *mf, bmemptr_t p, uint32_t size)
 Open memory image in banked memory (MegaROM) as stream.
 
void mfslice (MemFile *dst, const MemFile *src, long size)
 Open a new stream with the specified size range from the current position.
 
bool mfeof (MemFile *mf)
 Return true if reached to the end of stream.
 
uint8_t mfread_u8 (MemFile *mf)
 Read the next byte from stream pointed by mf.
 
size_t mfread (MemFile *mf, void *ptr, size_t size)
 Read some bytes from stream pointed by mf.
 
uint16_t mfread_u16 (MemFile *mf)
 Read the next 16-bit of little-endian value from stream pointed by mf.
 
uint32_t mfread_u32 (MemFile *mf)
 Read the next 32-bit of little-endian value from stream pointed by mf.
 
void mfseek (MemFile *mf, long offset, int whence)
 Set the stream position indicator for the stream pointed by mf.
 
void mfgetpos (MemFile *mf, mempos_t *pos)
 Get the stream position indicator of the stream pointed by mf.
 
void mfsetpos (MemFile *mf, const mempos_t *pos)
 Set the stream position indicator of the stream pointed by mf.
 
void mfsetpos2 (MemFile *mf, const mempos_t *base, long offset)
 Set the stream position indicator of the stream pointed by mf.
 

Detailed Description

Stream interface for ROM / RAM / MegaROM.

Definition in file memfile.h.