OSDN Git Service

716fac0d21f15672a13e6a4f91f0c52be4fcf0e9
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc98ha / memory.h
1 /*
2         NEC PC-98LT Emulator 'ePC-98LT'
3         NEC PC-98HA Emulator 'eHANDY98'
4
5         Author : Takeda.Toshiya
6         Date   : 2008.06.10 -
7
8         [ memory ]
9 */
10
11 #ifndef _PC98LT_MEMORY_H_
12 #define _PC98LT_MEMORY_H_
13
14 #include "../vm.h"
15 #include "../../emu.h"
16 #include "../device.h"
17
18 #define SIG_MEMORY_IR2  0
19
20 class PC98LT_MEMORY : public DEVICE
21 {
22 private:
23         uint8_t* rbank[64];     // 1MB / 16KB
24         uint8_t* wbank[64];
25         uint8_t wdmy[0x4000];
26         uint8_t rdmy[0x10000];
27         
28         uint8_t ram[0xa0000];           // RAM 640KB
29         uint8_t vram[0x8000];           // VRAM 32KB
30         
31         uint8_t ipl[0x10000];           // IPL 64KB
32         uint8_t kanji[0x40000];         // Kanji ROM 256KB
33 #ifdef _PC98HA
34         uint8_t learn[0x40000];         // Learn RAM 256KB
35         uint8_t dic[0xc0000];           // Dictionary ROM 768KB
36         uint8_t romdrv[0x100000];               // ROM Drive 1024KB
37         uint8_t ramdrv[0x160000];               // RAM Drive 1408KB
38         uint8_t ems[0x400000];          // EMS 4096KB
39         uint8_t memcard[0x400000];      // Memory Card 4096KB
40 #else
41         uint8_t learn[0x10000];         // Learn RAM 64KB
42         uint8_t dic[0x80000];           // Dictionary ROM 512KB
43         uint8_t romdrv[0x80000];                // ROM Drive 512KB
44 #endif
45         
46         uint32_t learn_crc32;
47 #ifdef _PC98HA
48         uint32_t ramdrv_crc32;
49         uint32_t memcard_crc32;
50 #endif
51         
52         void update_bank();
53         uint8_t learn_bank, dic_bank, kanji_bank, romdrv_bank;
54 #ifdef _PC98HA
55         uint8_t ramdrv_bank, ramdrv_sel;
56         uint8_t ems_bank[4];
57 #endif
58         
59 public:
60         PC98LT_MEMORY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
61         {
62                 set_device_name(_T("Memory Bus"));
63         }
64         ~PC98LT_MEMORY() {}
65         
66         // common functions
67         void initialize();
68         void release();
69         void reset();
70         void write_data8(uint32_t addr, uint32_t data);
71         uint32_t read_data8(uint32_t addr);
72         void write_io8(uint32_t addr, uint32_t data);
73         uint32_t read_io8(uint32_t addr);
74         bool process_state(FILEIO* state_fio, bool loading);
75         
76         // unique functions
77         uint8_t* get_vram()
78         {
79                 return vram;
80         }
81         void draw_screen();
82 };
83
84 #endif
85