libmsx
C library for MSX
Loading...
Searching...
No Matches
memfile_types.h
Go to the documentation of this file.
1// -*- coding: utf-8-unix -*-
2/*
3 * Copyright (c) 2021-2024 Daishi Mori (mori0091)
4 *
5 * This software is released under the MIT License.\n
6 * See https://github.com/mori0091/libmsx/blob/main/LICENSE
7 *
8 * GitHub libmsx project\n
9 * https://github.com/mori0091/libmsx
10 */
15#ifndef MEMFILE_TYPES_H_
16#define MEMFILE_TYPES_H_
17
18#include <stdint.h>
19#include <stddef.h>
20
24struct MemPos {
25 uint8_t * ptr;
26 uint8_t segment;
27 uint8_t slot;
28};
29
33struct MemFile {
34 struct MemPos base;
35 struct MemPos curr;
36 struct MemPos end;
37 const struct MemFileMethods * methods;
38};
39
41 uint8_t (* read1)(struct MemFile * mf);
42 size_t (* read)(struct MemFile * mf, void * ptr, size_t size);
43 void (* seek)(struct MemPos * dst, const struct MemPos * src, long offset);
44};
45
46#endif // MEMFILE_TYPES_H_
uint8_t * ptr
address on the CPU address space.
struct MemPos end
last position (exclusive)
const struct MemFileMethods * methods
function pointers.
uint8_t slot
slot address.
uint8_t segment
ROM / RAM mapper segment number.
struct MemPos base
base position
struct MemPos curr
current position
Internal structure of MemFile type.
Internal structure of mempos_t type.
uint8_t(* read1)(struct MemFile *mf)
void(* seek)(struct MemPos *dst, const struct MemPos *src, long offset)
size_t(* read)(struct MemFile *mf, void *ptr, size_t size)