OSDN Git Service

[COMMON] Fix unaligned SIMD variables.Fix crash built with "-msse2" at Win32.
[csp-qt/common_source_project-fm7.git] / source / src / vm / z80tvgame / memory.h
1 /*
2         Homebrew Z80 TV GAME SYSTEM Emulator 'eZ80TVGAME'
3
4         Author : Takeda.Toshiya
5         Date   : 2015.04.28-
6
7         [ memory ]
8 */
9
10 // http://w01.tp1.jp/~a571632211/z80tvgame/index.html
11
12 #ifndef _MEMORY_H_
13 #define _MEMORY_H_
14
15 #include "../vm.h"
16 #include "../../emu.h"
17 #include "../device.h"
18
19 namespace Z80TVGAME {
20
21 class MEMORY : public DEVICE
22 {
23 private:
24         // memory
25         uint8_t rom[0x8000];
26         uint8_t ram[0x6000];
27         uint8_t wdmy[0x1000];
28         uint8_t rdmy[0x1000];
29         uint8_t* wbank[16];
30         uint8_t* rbank[16];
31         
32         bool inserted;
33
34         __DECL_ALIGNED(32) _bit_trans_table_scrn_t pixel_trans_table;
35 public:
36         MEMORY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
37         {
38                 set_device_name(_T("Memory Bus"));
39         }
40         ~MEMORY() {}
41         
42         // common functions
43         void initialize();
44         void reset();
45         void write_data8(uint32_t addr, uint32_t data);
46         uint32_t read_data8(uint32_t addr);
47         bool process_state(FILEIO* state_fio, bool loading);
48         
49         // unique functions
50         void open_cart(const _TCHAR* file_path);
51         void close_cart();
52         bool is_cart_inserted()
53         {
54                 return inserted;
55         }
56         void draw_screen();
57 };
58
59 }
60 #endif
61