OSDN Git Service

8380d31a4d6525ebcbcd28376b05085d0483883f
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc9801 / membus.h
1 /*
2         NEC PC-9801 Emulator 'ePC-9801'
3         NEC PC-9801E/F/M Emulator 'ePC-9801E'
4         NEC PC-9801U Emulator 'ePC-9801U'
5         NEC PC-9801VF Emulator 'ePC-9801VF'
6         NEC PC-9801VM Emulator 'ePC-9801VM'
7         NEC PC-9801VX Emulator 'ePC-9801VX'
8         NEC PC-9801RA Emulator 'ePC-9801RA'
9         NEC PC-98XA Emulator 'ePC-98XA'
10         NEC PC-98XL Emulator 'ePC-98XL'
11         NEC PC-98RL Emulator 'ePC-98RL'
12         NEC PC-98DO Emulator 'ePC-98DO'
13
14         Author : Takeda.Toshiya
15         Date   : 2017.06.22-
16
17         [ memory bus ]
18 */
19
20 #ifndef _MEMBUS_H_
21 #define _MEMBUS_H_
22
23 #include "../memory.h"
24
25 class DISPLAY;
26
27 #if defined(SUPPORT_32BIT_ADDRESS)
28         #define RAM_SIZE        0x800000        // 8MB
29 #elif defined(SUPPORT_24BIT_ADDRESS)
30         #define RAM_SIZE        0x400000        // 4MB
31 #else
32         #define RAM_SIZE        0x100000        // 1MB
33 #endif
34
35 //class csp_state_utils;
36
37 class MEMBUS : public MEMORY
38 {
39 private:
40         DISPLAY *d_display;
41         
42 //      csp_state_utils *state_entry;
43         // RAM
44         uint8_t ram[RAM_SIZE];
45         
46         // BIOS/ITF
47 #if !defined(SUPPORT_HIRESO)
48         uint8_t bios[0x18000];
49 #else
50         uint8_t bios[0x10000];
51 #endif
52 #if defined(SUPPORT_BIOS_RAM)
53 #if !defined(SUPPORT_HIRESO)
54         uint8_t bios_ram[0x18000];
55 #else
56         uint8_t bios_ram[0x10000];
57 #endif
58 //      uint8_t bios_ram[sizeof(bios)];
59         bool bios_ram_selected;
60 #endif
61 #if defined(SUPPORT_ITF_ROM)
62         uint8_t itf[0x8000];
63         bool itf_selected;
64 #endif
65         void update_bios();
66         
67 #if !defined(SUPPORT_HIRESO)
68         // EXT BIOS
69 #if defined(_PC9801) || defined(_PC9801E)
70         uint8_t fd_bios_2hd[0x1000];
71         uint8_t fd_bios_2dd[0x1000];
72 #endif
73         uint8_t sound_bios[0x4000];
74 //      uint8_t sound_bios_ram[0x4000];
75         bool sound_bios_selected;
76 //      bool sound_bios_ram_selected;
77         void update_sound_bios();
78 #if defined(SUPPORT_SASI_IF)
79         uint8_t sasi_bios[0x1000];
80         uint8_t sasi_bios_ram[0x1000];
81         bool sasi_bios_selected;
82         bool sasi_bios_ram_selected;
83         void update_sasi_bios();
84 #endif
85 #if defined(SUPPORT_SCSI_IF)
86         uint8_t scsi_bios[0x1000];
87         uint8_t scsi_bios_ram[0x1000];
88         bool scsi_bios_selected;
89         bool scsi_bios_ram_selected;
90         void update_scsi_bios();
91 #endif
92 #if defined(SUPPORT_IDE_IF)
93         uint8_t ide_bios[0x4000];
94 //      uint8_t ide_bios_ram[0x4000];
95         bool ide_bios_selected;
96 //      bool ide_bios_ram_selected;
97         void update_ide_bios();
98 #endif
99         
100         // EMS
101 #if defined(SUPPORT_NEC_EMS)
102         uint8_t nec_ems[0x10000];
103         bool nec_ems_selected;
104         void update_nec_ems();
105 #endif
106 #endif
107         
108 #if defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)
109         uint8_t dma_access_ctrl;
110         uint32_t window_80000h;
111         uint32_t window_a0000h;
112 #endif
113         
114 public:
115         MEMBUS(VM_TEMPLATE* parent_vm, EMU* parent_emu) : MEMORY(parent_vm, parent_emu)
116         {
117                 set_device_name(_T("Memory Bus"));
118         }
119         ~MEMBUS() {}
120         
121         // common functions
122         void initialize();
123         void reset();
124         void write_io8(uint32_t addr, uint32_t data);
125         uint32_t read_io8(uint32_t addr);
126 #if defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)
127         uint32_t read_data8(uint32_t addr);
128         void write_data8(uint32_t addr, uint32_t data);
129         uint32_t read_dma_data8(uint32_t addr);
130         void write_dma_data8(uint32_t addr, uint32_t data);
131 #endif
132         bool process_state(FILEIO* state_fio, bool loading);
133         
134         // unique functions
135         void set_context_display(DISPLAY* device)
136         {
137                 d_display = device;
138         }
139 };
140
141 #endif