~groovestomp/gsnes

ref: 85e494661af3862ec2f0c9d77df6ce9bdfcde828 gsnes/mapper000.h -rw-r--r-- 2.8 KiB
85e49466 — GrooveStomp Working input and fixed a bug in ADC() 1 year, 6 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/******************************************************************************
  GrooveStomp's NES Emulator
  Copyright (c) 2019 Aaron Oman (GrooveStomp)

  File: mapper000.h
  Created: 2019-11-04
  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 mapper000.h
#include <stdint.h>
#include <stdbool.h>

struct mapper000;

void *
Mapper000_Init(uint8_t prgBanks, uint8_t chrBanks);

void
Mapper000_Deinit(void *mapper);

void
Mapper000_Reset(void *mapper);

//! \brief Map cpu read address to expanded address
//!
//! If PRGRPM is 16KB:
//!   Cpu Address Bus           PRG ROM
//!   ---------------           ---------
//!   0x8000 -> 0xBFFF: Map     0x0000 -> 0x3FFF
//!   0xC000 -> 0xFFFF: Mirror  0x0000 -> 0x3FFF
//!
//! If PRGRPM is 32KB:
//!   Cpu Address Bus           PRG ROM
//!   ---------------           ---------
//!   0x8000 -> 0xBFFF: Map     0x0000 -> 0x7FFF
//!
//! \see Mapper000_MapCpuWrite
//!
//! \param[in,out] mapper
//! \param[in] addr Address to be mapped
//! \param[out] mappedAddr Mapped address
//! \return true if address has been mapped
bool
Mapper000_MapCpuRead(void *mapper, uint16_t addr, uint32_t *mappedAddr);

//! \brief Map cpu write address to expanded address
//!
//! If PRGRPM is 16KB:
//!   Cpu Address Bus           PRG ROM
//!   ---------------           ---------
//!   0x8000 -> 0xBFFF: Map     0x0000 -> 0x3FFF
//!   0xC000 -> 0xFFFF: Mirror  0x0000 -> 0x3FFF
//!
//! If PRGRPM is 32KB:
//!   Cpu Address Bus           PRG ROM
//!   ---------------           ---------
//!   0x8000 -> 0xBFFF: Map     0x0000 -> 0x7FFF
//!
//! \see Mapper000_MapCpuRead
//!
//! \param[in,out] mapper
//! \param[in] addr Address to be mapped
//! \param[out] mappedAddr Mapped address
//! \return true if address has been mapped
bool
Mapper000_MapCpuWrite(void *mapper, uint16_t addr, uint32_t *mappedAddr);

//! \brief Map ppu read address to expanded address
//!
//! \see Mapper000_MapPpuWrite
//!
//! \param[in,out] mapper
//! \param[in] addr Address to be mapped
//! \param[out] mappedAddr Mapped address
//! \return true if address has been mapped
bool
Mapper000_MapPpuRead(void *mapper, uint16_t addr, uint32_t *mappedAddr);

//! \brief Map ppu write address to expanded address
//!
//! \see Mapper000_MapPpuRead
//!
//! \param[in,out] mapper
//! \param[in] addr Address to be mapped
//! \param[out] mappedAddr Mapped address
//! \return true if address has been mapped
bool
Mapper000_MapPpuWrite(void *mapper, uint16_t addr, uint32_t *mappedAddr);