OSDN Git Service

[General] Convert sourcecode's CRLF format: DOS(WINDOWS) to Unix, to apply patches...
[csp-qt/common_source_project-fm7.git] / source / src / vm / pasopia7 / memory.h
1 /*
2         TOSHIBA PASOPIA 7 Emulator 'EmuPIA7'
3
4         Author : Takeda.Toshiya
5         Date   : 2006.09.20 -
6
7         [ memory ]
8 */
9
10 #ifndef _MEMORY_H_
11 #define _MEMORY_H_
12
13 #include "../vm.h"
14 #include "../../emu.h"
15 #include "../device.h"
16
17 #define SIG_MEMORY_I8255_1_A    0
18 #define SIG_MEMORY_I8255_1_B    1
19 #define SIG_MEMORY_I8255_1_C    2
20
21 class MEMORY : public DEVICE
22 {
23 private:
24         DEVICE *d_iobus, *d_pio0, *d_pio2;
25         
26         uint8 bios[0x4000];
27         uint8 basic[0x8000];
28         uint8 ram[0x10000];
29         uint8 vram[0x10000];    // blue, red, green + text, attribute
30         uint8 pal[0x10];
31         uint8 wdmy[0x1000];
32         uint8 rdmy[0x1000];
33         uint8* wbank[16];
34         uint8* rbank[16];
35         
36         uint8 mem_map, plane, attr_data, attr_latch;
37         bool vram_sel, pal_sel, attr_wrap;
38         
39         void update_memory_map();
40         
41 public:
42         MEMORY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
43         ~MEMORY() {}
44         
45         // common functions
46         void initialize();
47         void reset();
48         void write_data8(uint32 addr, uint32 data);
49         uint32 read_data8(uint32 addr);
50         void write_io8(uint32 addr, uint32 data);
51         void write_signal(int id, uint32 data, uint32 mask);
52         void save_state(FILEIO* state_fio);
53         bool load_state(FILEIO* state_fio);
54         
55         // unique functions
56         void set_context_iobus(DEVICE* device)
57         {
58                 d_iobus = device;
59         }
60         void set_context_pio0(DEVICE* device)
61         {
62                 d_pio0 = device;
63         }
64         void set_context_pio2(DEVICE* device)
65         {
66                 d_pio2 = device;
67         }
68         uint8* get_ram()
69         {
70                 return ram;
71         }
72         uint8* get_vram()
73         {
74                 return vram;
75         }
76         uint8* get_pal()
77         {
78                 return pal;
79         }
80 };
81
82 #endif
83