OSDN Git Service

[VM] MEMORY:: class within some VM will change Foo_MEMORY:: to reduce misundestanding...
[csp-qt/common_source_project-fm7.git] / source / src / vm / x1 / memory.h
1 /*
2         SHARP X1 Emulator 'eX1'
3         SHARP X1twin Emulator 'eX1twin'
4         SHARP X1turbo Emulator 'eX1turbo'
5         SHARP X1turboZ Emulator 'eX1turboZ'
6
7         Author : Takeda.Toshiya
8         Date   : 2009.03.14-
9
10         [ memory ]
11 */
12
13 #ifndef _X1_MEMORY_H_
14 #define _X1_MEMORY_H_
15
16 #include "../vm.h"
17 #include "../../emu.h"
18 #include "../device.h"
19
20 class X1_MEMORY : public DEVICE
21 {
22 private:
23 #ifdef _X1TURBO_FEATURE
24         DEVICE *d_pio;
25 #endif
26         
27         uint8_t* wbank[16];
28         uint8_t* rbank[16];
29         
30         uint8_t rom[0x8000];
31         uint8_t ram[0x10000];
32         uint8_t romsel;
33 #ifdef _X1TURBO_FEATURE
34         uint8_t extram[0x90000]; // 32kb*16bank
35         uint8_t bank;
36 #else
37         int m1_cycle;
38 #endif
39         void update_map();
40         
41 public:
42         X1_MEMORY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
43         {
44                 set_device_name(_T("Memory Bus"));
45         }
46         ~X1_MEMORY() {}
47         
48         // common functions
49         void initialize();
50         void reset();
51         void write_data8(uint32_t addr, uint32_t data);
52         uint32_t read_data8(uint32_t addr);
53 #ifndef _X1TURBO_FEATURE
54         uint32_t fetch_op(uint32_t addr, int *wait);
55 #endif
56         void write_io8(uint32_t addr, uint32_t data);
57         uint32_t read_io8(uint32_t addr);
58         bool process_state(FILEIO* state_fio, bool loading);
59         
60         // unique function
61 #ifdef _X1TURBO_FEATURE
62         void set_context_pio(DEVICE* device)
63         {
64                 d_pio = device;
65         }
66 #endif
67 };
68
69 #endif
70