1 /* Mednafen - Multi-system Emulator
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18 #include "../shared.h"
19 #include "cart.h"
20 #include "map_rom.h"
21
22 class MD_Cart_Type_RMX3 : public MD_Cart_Type
23 {
24 public:
25
26 MD_Cart_Type_RMX3(const md_game_info *ginfo, const uint8 *ROM, const uint32 ROM_size);
27 virtual ~MD_Cart_Type_RMX3() override;
28
29 virtual void Write8(uint32 A, uint8 V) override;
30 virtual void Write16(uint32 A, uint16 V) override;
31 virtual uint8 Read8(uint32 A) override;
32 virtual uint16 Read16(uint32 A) override;
33 virtual int StateAction(StateMem *sm, int load, int data_only, const char *section_name) override;
34
35 // In bytes
36 virtual uint32 GetNVMemorySize(void) override;
37 virtual void ReadNVMemory(uint8 *buffer) override;
38 virtual void WriteNVMemory(const uint8 *buffer) override;
39
40 private:
41
42 const uint8 *rom;
43 uint32 rom_size;
44
45 };
46
47
MD_Cart_Type_RMX3(const md_game_info * ginfo,const uint8 * ROM,const uint32 ROM_size)48 MD_Cart_Type_RMX3::MD_Cart_Type_RMX3(const md_game_info *ginfo, const uint8 *ROM, const uint32 ROM_size)
49 {
50 this->rom = ROM;
51 this->rom_size = ROM_size;
52 }
53
~MD_Cart_Type_RMX3()54 MD_Cart_Type_RMX3::~MD_Cart_Type_RMX3()
55 {
56
57 }
58
59
Write8(uint32 A,uint8 V)60 void MD_Cart_Type_RMX3::Write8(uint32 A, uint8 V)
61 {
62
63 }
64
Write16(uint32 A,uint16 V)65 void MD_Cart_Type_RMX3::Write16(uint32 A, uint16 V)
66 {
67
68 }
69
Read8(uint32 A)70 uint8 MD_Cart_Type_RMX3::Read8(uint32 A)
71 {
72 if(A < 0x400000)
73 {
74 if(A >= rom_size)
75 {
76 MD_DBG(MD_DBG_WARNING, "[MAP_RMX3] Unknown read8 from 0x%08x\n", A);
77 return(0);
78 }
79 return(READ_BYTE_MSB(rom, A));
80 }
81
82 if(A == 0xa13000)
83 return(0x0C);
84 if(A == 0x400004)
85 return(0x88);
86
87 MD_DBG(MD_DBG_WARNING, "[MAP_RMX3] Unknown read8 from 0x%08x\n", A);
88 return(m68k_read_bus_8(A));
89 }
90
Read16(uint32 A)91 uint16 MD_Cart_Type_RMX3::Read16(uint32 A)
92 {
93 if(A < 0x400000)
94 {
95 if(A >= rom_size)
96 {
97 MD_DBG(MD_DBG_WARNING, "[MAP_RMX3] Unknown read16 from 0x%08x\n", A);
98 return(0);
99 }
100 return(READ_WORD_MSB(rom, A));
101 }
102
103 if(A == 0xa13000)
104 return(0x0C);
105 if(A == 0x400004)
106 return(0x88);
107
108 MD_DBG(MD_DBG_WARNING, "[MAP_RMX3] Unknown read16 from 0x%08x\n", A);
109 return(m68k_read_bus_16(A));
110 }
111
StateAction(StateMem * sm,int load,int data_only,const char * section_name)112 int MD_Cart_Type_RMX3::StateAction(StateMem *sm, int load, int data_only, const char *section_name)
113 {
114 return(1);
115 }
116
GetNVMemorySize(void)117 uint32 MD_Cart_Type_RMX3::GetNVMemorySize(void)
118 {
119 return(0);
120 }
121
ReadNVMemory(uint8 * buffer)122 void MD_Cart_Type_RMX3::ReadNVMemory(uint8 *buffer)
123 {
124
125 }
126
WriteNVMemory(const uint8 * buffer)127 void MD_Cart_Type_RMX3::WriteNVMemory(const uint8 *buffer)
128 {
129
130 }
131
MD_Make_Cart_Type_RMX3(const md_game_info * ginfo,const uint8 * ROM,const uint32 ROM_size,const uint32 iparam,const char * sparam)132 MD_Cart_Type *MD_Make_Cart_Type_RMX3(const md_game_info *ginfo, const uint8 *ROM, const uint32 ROM_size, const uint32 iparam, const char *sparam)
133 {
134 return(new MD_Cart_Type_RMX3(ginfo, ROM, ROM_size));
135 }
136