OSDN Git Service

[VM][State] Apply new state framework to some VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / colecovision / memory.h
1 /*
2         COLECO ColecoVision Emulator 'yaCOLECOVISION'
3
4         Author : tanam
5         Date   : 2016.08.14-
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         // memory
21         uint8_t cart[0x8000];
22         uint8_t ipl[0x2000];
23         uint8_t ram[0x10000];
24         
25         uint8_t wdmy[0x10000];
26         uint8_t rdmy[0x10000];
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 write_data8(uint32_t addr, uint32_t data);
42         uint32_t read_data8(uint32_t addr);
43         bool process_state(FILEIO* state_fio, bool loading);
44         
45         // unique functions
46         void open_cart(const _TCHAR* file_path);
47         void close_cart();
48         bool is_cart_inserted()
49         {
50                 return inserted;
51         }
52 };
53
54 #endif