OSDN Git Service

[VM][I286] Save cpustate without StateBuffer().
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz80k / memory.h
1 /*
2         SHARP MZ-80K/C Emulator 'EmuZ-80K'
3         SHARP MZ-1200 Emulator 'EmuZ-1200'
4
5         Author : Takeda.Toshiya
6         Date   : 2010.08.18-
7
8         SHARP MZ-80A Emulator 'EmuZ-80A'
9         Modify : Hideki Suga
10         Date   : 2014.12.10 -
11
12         [ memory ]
13 */
14
15 #ifndef _MZ80A_MEMORY_H_
16 #define _MZ80A_MEMORY_H_
17
18 #include "../vm.h"
19 #include "../../emu.h"
20 #include "../device.h"
21
22 #define SIG_MEMORY_VGATE        0
23 #if defined(SUPPORT_MZ80AIF)
24 #define SIG_MEMORY_FDC_IRQ      1
25 #define SIG_MEMORY_FDC_DRQ      2
26 #endif
27
28 class MZ80A_MEMORY : public DEVICE
29 {
30 private:
31         DEVICE *d_ctc, *d_pio;
32         
33         uint8_t* rbank[64];
34         uint8_t* wbank[64];
35         uint8_t wdmy[0x400];
36         uint8_t rdmy[0x400];
37         
38         uint8_t ram[0xd000];    // RAM 48KB + swap 4KB
39 #if defined(_MZ1200) || defined(_MZ80A)
40         uint8_t vram[0x800];    // VRAM 2KB
41 #else
42         uint8_t vram[0x400];    // VRAM 1KB
43 #endif
44         uint8_t ipl[0x1000];    // IPL 4KB
45 #if defined(_MZ1200) || defined(_MZ80A)
46         uint8_t ext[0x800];     // EXT 2KB
47 #endif
48         
49         bool tempo, blink;
50 #if defined(_MZ1200) || defined(_MZ80A)
51         bool hblank;
52         bool memory_swap;
53         void update_memory_swap();
54 #endif
55         
56 #if defined(SUPPORT_MZ80AIF)
57         uint8_t fdif[0x800];    // FD IF ROM 2KB
58         bool fdc_irq, fdc_drq;
59         void update_fdif_rom_bank();
60 #elif defined(SUPPORT_MZ80FIO)
61         uint8_t fdif[0x400];    // FD IF ROM 1KB
62 #endif
63         
64         uint8_t screen[200][320];
65         uint8_t font[0x800];
66 #if defined(_MZ1200)
67         uint8_t pcg[0x1000];    // PCG-1200
68 #else
69         uint8_t pcg[0x800];     // PCG-8000
70 #endif
71         scrntype_t palette_pc[2];
72         bool vgate;
73 #if defined(_MZ1200) || defined(_MZ80A)
74         bool reverse;
75 #endif
76 #if defined(_MZ80A)
77         uint32_t e200;          // scroll
78 #endif
79         uint8_t pcg_data;
80         uint8_t pcg_addr;
81         uint8_t pcg_ctrl;
82         
83 public:
84         MZ80A_MEMORY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
85         {
86                 set_device_name(_T("Memory Bus"));
87         }
88         ~MZ80A_MEMORY() {}
89         
90         // common functions
91         void initialize();
92         void reset();
93         void event_vline(int v, int clock);
94         void event_callback(int event_id, int err);
95         void write_data8(uint32_t addr, uint32_t data);
96         uint32_t read_data8(uint32_t addr);
97         void write_signal(int id, uint32_t data, uint32_t mask);
98 #if defined(_MZ80K)
99         void update_config();
100 #endif
101         bool process_state(FILEIO* state_fio, bool loading);
102         
103         // unique functions
104         void set_context_ctc(DEVICE* device)
105         {
106                 d_ctc = device;
107         }
108         void set_context_pio(DEVICE* device)
109         {
110                 d_pio = device;
111         }
112         void draw_screen();
113 };
114
115 #endif
116