OSDN Git Service

[VM][General] Merge upstream 2016-03-01. (Pahse 1).
[csp-qt/common_source_project-fm7.git] / source / src / vm / n5200 / memory.h
1 /*
2         NEC N5200 Emulator 'eN5200'
3
4         Author : Takeda.Toshiya
5         Date   : 2009.06.03-
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 class MEMORY : public DEVICE
18 {
19 private:
20         uint8_t* rbank[8192];   // 16MB / 2KB
21         uint8_t* wbank[8192];
22         uint8_t wdmy[0x800];
23         uint8_t rdmy[0x800];
24         
25         uint8_t ram[0xc0000];           // RAM 768KB
26         uint8_t exram[0x100000];                // Ext RAM 1MB
27         uint8_t vram[0x60000];          // VRAM 384KB ???
28         uint8_t tvram[0x7800];          // TVRAM 32KB ???
29         uint8_t backup[0x8200];         // Battery BackUp 32KB ???
30         uint8_t ipl[0x10000];           // IPL 64KB
31         
32         bool protect;
33         
34 public:
35         MEMORY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
36         ~MEMORY() {}
37         
38         // common functions
39         void initialize();
40         void release();
41         void reset();
42         void write_data8(uint32_t addr, uint32_t data);
43         uint32_t read_data8(uint32_t addr);
44         void write_io8(uint32_t addr, uint32_t data);
45         uint32_t read_io8(uint32_t addr);
46         
47         // unique functions
48         uint8_t* get_vram()
49         {
50                 return vram;
51         }
52         uint8_t* get_tvram()
53         {
54                 return tvram;
55         }
56 };
57
58 #endif
59