OSDN Git Service

[VM][DEVICE] Use __FASTCALL with interfaces, read_*() ,write_*(), fetch_op() and...
[csp-qt/common_source_project-fm7.git] / source / src / vm / sc3000 / memory.h
1 /*
2         SEGA SC-3000 Emulator 'eSC-3000'
3
4         Author : Takeda.Toshiya
5         Date   : 2010.08.17-
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 namespace SC3000 {
20
21 class MEMORY : public DEVICE
22 {
23 private:
24         // memory
25         uint8_t cart[0x20000];
26         uint8_t ipl[0x2000];    // sf7000
27         uint8_t ram[0x10000];
28         
29         uint8_t wdmy[0x1000];
30         uint8_t rdmy[0x1000];
31         uint8_t* wbank[16];
32         uint8_t* rbank[16];
33         
34         bool inserted;
35         bool ram_selected;
36         uint8_t bank[3];
37         
38         void update_bank();
39         
40 public:
41         MEMORY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
42         {
43                 set_device_name(_T("Memory Bus"));
44         }
45         ~MEMORY() {}
46         
47         // common functions
48         void initialize();
49         void __FASTCALL write_data8(uint32_t addr, uint32_t data);
50         uint32_t __FASTCALL read_data8(uint32_t addr);
51         void __FASTCALL write_signal(int id, uint32_t data, uint32_t mask);
52         bool process_state(FILEIO* state_fio, bool loading);
53         
54         // unique functions
55         void open_cart(const _TCHAR* file_path);
56         void close_cart();
57         bool is_cart_inserted()
58         {
59                 return inserted;
60         }
61 };
62
63 }
64 #endif
65