OSDN Git Service

[VM][General] Merge upstream 2015-08-25.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc100 / crtc.h
1 /*
2         NEC PC-100 Emulator 'ePC-100'
3
4         Author : Takeda.Toshiya
5         Date   : 2008.07.14 -
6
7         [ crtc ]
8 */
9
10 #ifndef _CRTC_H_
11 #define _CRTC_H_
12
13 #include "../vm.h"
14 #include "../../emu.h"
15 #include "../device.h"
16
17 #define SIG_CRTC_BITMASK_LOW    0
18 #define SIG_CRTC_BITMASK_HIGH   1
19 #define SIG_CRTC_VRAM_PLANE     2
20
21 class CRTC : public DEVICE
22 {
23 private:
24         DEVICE *d_pic;
25         
26         scrntype palette_pc[16];
27         uint16 palette[16];
28         uint8 sel, regs[8];
29         uint16 vs, cmd;
30         
31         uint8 vram[0x80000];    // VRAM 128KB * 4planes
32         uint32 shift, maskl, maskh, busl, bush;
33         uint32 write_plane, read_plane;
34         
35         void update_palette(int num);
36         
37 public:
38         CRTC(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
39         ~CRTC() {}
40         
41         // common functions
42         void initialize();
43         void event_vline(int v, int clock);
44         void write_io8(uint32 addr, uint32 data);
45         uint32 read_io8(uint32 addr);
46         void write_memory_mapped_io8(uint32 addr, uint32 data);
47         uint32 read_memory_mapped_io8(uint32 addr);
48         void write_memory_mapped_io16(uint32 addr, uint32 data);
49         uint32 read_memory_mapped_io16(uint32 addr);
50         void write_signal(int id, uint32 data, uint32 mask);
51         void save_state(FILEIO* state_fio);
52         bool load_state(FILEIO* state_fio);
53         
54         // unique functions
55         void set_context_pic(DEVICE* device)
56         {
57                 d_pic = device;
58         }
59         void draw_screen();
60 };
61
62 #endif
63