OSDN Git Service

[General] Convert sourcecode's CRLF format: DOS(WINDOWS) to Unix, to apply patches...
[csp-qt/common_source_project-fm7.git] / source / src / vm / gamegear / memory.h
1 /*
2         SEGA GAME GEAR Emulator 'yaGAME GEAR'
3
4         Author : tanam
5         Date   : 2013.08.24-
6
7         [ memory ]
8 */
9
10 #ifndef _MEMORY_H_
11 #define _MEMORY_H_
12
13 #include "../vm.h"
14 #include "../../emu.h"
15 #include "../device.h"
16
17 #define SIG_MEMORY_SEL  0
18
19 class MEMORY : public DEVICE
20 {
21 private:
22         DEVICE *d_cpu;
23         // memory
24         uint8 *cart;
25     uint32 size;
26     uint8 pages;
27         uint8 ram[0x10000];     
28         uint8 rdmy[0x2000];
29         uint8 sram[0x8000];
30         uint8 *cpu_readmap[8];
31         uint8 *cpu_writemap[8];
32     uint8 fcr[4];
33     uint8 save;
34         
35         bool inserted;
36         void sms_mapper_w(uint32 addr, uint32 data);
37         
38 public:
39         MEMORY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
40         ~MEMORY() {}
41         
42         // common functions
43         void initialize();
44         void release();
45         void bios();
46         void write_data8(uint32 addr, uint32 data);
47         uint32 read_data8(uint32 addr);
48         void write_signal(int id, uint32 data, uint32 mask);
49         
50         // unique functions
51         void open_cart(_TCHAR* file_path);
52         void close_cart();
53         bool cart_inserted()
54         {
55                 return inserted;
56         }
57 };
58
59 #endif