OSDN Git Service

[VM] Add vm_template.h . This class, VM_TEMPLATE:: must be mother of VM:: .See fm7...
[csp-qt/common_source_project-fm7.git] / source / src / vm / z80tvgame / memory.h
1 /*
2         Homebrew Z80 TV GAME SYSTEM Emulator 'eZ80TVGAME'
3
4         Author : Takeda.Toshiya
5         Date   : 2015.04.28-
6
7         [ memory ]
8 */
9
10 // http://w01.tp1.jp/~a571632211/z80tvgame/index.html
11
12 #ifndef _MEMORY_H_
13 #define _MEMORY_H_
14
15 #include "../vm.h"
16 #include "../../emu.h"
17 #include "../device.h"
18
19 class MEMORY : public DEVICE
20 {
21 private:
22         // memory
23         uint8_t rom[0x8000];
24         uint8_t ram[0x6000];
25         uint8_t wdmy[0x1000];
26         uint8_t rdmy[0x1000];
27         uint8_t* wbank[16];
28         uint8_t* rbank[16];
29         
30         bool inserted;
31         
32 public:
33         MEMORY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
34         {
35                 set_device_name(_T("Memory Bus"));
36         }
37         ~MEMORY() {}
38         
39         // common functions
40         void initialize();
41         void reset();
42         void write_data8(uint32_t addr, uint32_t data);
43         uint32_t read_data8(uint32_t addr);
44         void decl_state();
45         void save_state(FILEIO* state_fio);
46         bool load_state(FILEIO* state_fio);
47         
48         // unique functions
49         void open_cart(const _TCHAR* file_path);
50         void close_cart();
51         bool is_cart_inserted()
52         {
53                 return inserted;
54         }
55         void draw_screen();
56 };
57
58 #endif
59