OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz5500 / memory.h
1 /*
2         SHARP MZ-5500 Emulator 'EmuZ-5500'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.04.10 -
6
7         [ memory ]
8 */
9
10 #ifndef _MZ5500_MEMORY_H_
11 #define _MZ5500_MEMORY_H_
12
13 #include "../vm.h"
14 #include "../../emu.h"
15 #include "../device.h"
16
17 #define SIG_MEMORY_BANK 0
18
19 namespace MZ5500 {
20
21 class MEMORY : public DEVICE
22 {
23 private:
24         DEVICE* d_cpu;
25         
26         uint8_t* rbank[64];     // 1MB / 16KB
27         uint8_t* wbank[64];
28         uint8_t wdmy[0x4000];
29         uint8_t rdmy[0x4000];
30 #ifdef _MZ6550
31         uint8_t ipl[0x8000];    // IPL 32KB
32 #else
33         uint8_t ipl[0x4000];    // IPL 16KB
34 #endif
35 #if defined(_MZ6500) || defined(_MZ6550)
36         uint8_t ram[0x90000];   // Main RAM 640KB
37 #else
38         uint8_t ram[0x80000];   // Main RAM 512KB
39 #endif
40         uint8_t vram[0x80000];  // VRAM 192KB + 1024B + padding
41         uint8_t kanji[0x40000]; // Kanji ROM 256KB
42         uint8_t dic[0x40000];   // Dictionary ROM 256KB
43 #ifdef _MZ6550
44         uint8_t dic2[0x100000]; // New Dictionary ROM 1MB
45 #endif
46 #if defined(_MZ6500) || defined(_MZ6550)
47         uint8_t mz1r32[0x100000];       // MZ-1R32 512KB * 2
48 #endif
49         uint8_t bank1, bank2;
50         uint32_t haddr;         // DMAC high-order address latch
51         
52         void update_bank();
53         
54 public:
55         MEMORY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
56         {
57                 set_device_name(_T("Memory Bus"));
58         }
59         ~MEMORY() {}
60         
61         // common functions
62         void initialize();
63         void reset();
64         void write_data8(uint32_t addr, uint32_t data);
65         uint32_t read_data8(uint32_t addr);
66         void write_dma_data8(uint32_t addr, uint32_t data);
67         uint32_t read_dma_data8(uint32_t addr);
68         void write_signal(int id, uint32_t data, uint32_t mask);
69         void write_io8(uint32_t addr, uint32_t data);
70         uint32_t read_io8(uint32_t addr);
71         bool process_state(FILEIO* state_fio, bool loading);
72         
73         // unique functions
74         void set_context_cpu(DEVICE* device)
75         {
76                 d_cpu = device;
77         }
78         uint8_t* get_vram()
79         {
80                 return vram;
81         }
82 };
83
84 }
85 #endif
86