~groovestomp/gsnes

gsnes/cart.h -rw-r--r-- 1.5 KiB
9de07668 — GrooveStomp Foreground rendering works 1 year, 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/******************************************************************************
  GrooveStomp's NES Emulator
  Copyright (c) 2019 Aaron Oman (GrooveStomp)

  File: cart.h
  Created: 2019-11-03
  Updated: 2019-11-27
  Author: Aaron Oman
  Notice: GNU AGPLv3 License

  Based off of: One Lone Coder NES Emulator Copyright (C) 2019 Javidx9
  This program comes with ABSOLUTELY NO WARRANTY.
  This is free software, and you are welcome to redistribute it under certain
  conditions; See LICENSE for details.
 ******************************************************************************/
//! \file cart.h
//! The cartridge contains game data as well as circuitry.
//! The circuitry is described by the Mapper interface.
//! The cartridge is able to intercept reads and writes by both the CPU and PPU.
//! \see mapper.h

#include <stdint.h>
#include <stdbool.h>

#ifndef CART_VERSION
#define CART_VERSION "0.1-gsnes"

struct cart;

enum mirror {
        MIRROR_HORIZONTAL,
        MIRROR_VERTICAL,
        MIRROR_ONESCREEN_LO,
        MIRROR_ONESCREEN_HI,
};

struct cart *
CartInit();

void
CartDeinit(struct cart *cart);

bool
CartCpuRead(struct cart *cart, uint16_t addr, uint8_t *data);

bool
CartCpuWrite(struct cart *cart, uint16_t addr, uint8_t data);

bool
CartPpuRead(struct cart *cart, uint16_t addr, uint8_t *data);

bool
CartPpuWrite(struct cart *cart, uint16_t addr, uint8_t data);

enum mirror
CartMirroring(struct cart *cart);

bool
CartIsImageValid(struct cart *cart);

void
CartReset(struct cart *cart);

#endif // CART_VERSION