OSDN Git Service

[VM][WIP] Use namespace to devices per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / jx / display.h
1 /*
2         IBM Japan Ltd PC/JX Emulator 'eJX'
3
4         Author : Takeda.Toshiya
5         Date   : 2011.05.09-
6
7         [ display ]
8 */
9
10 #ifndef _DISPLAY_H_
11 #define _DISPLAY_H_
12
13 #include "../vm.h"
14 #include "../../emu.h"
15 #include "../device.h"
16
17 #define SIG_DISPLAY_ENABLE      0
18 #define SIG_DISPLAY_VBLANK      1
19 #define SIG_DISPLAY_PIO         2
20
21 class MEMORY;
22
23 namespace JX {
24
25 class DISPLAY : public DEVICE
26 {
27 private:
28         MEMORY *d_mem;
29         
30         uint8_t vram[0x20000];
31         uint8_t extvram[0x10000];
32         
33         uint8_t vgarray[0x10];
34         uint8_t palette[0x10];
35         int vgarray_num;
36         
37         uint8_t bankreg[16];
38         int bankreg_num;
39         
40         uint8_t hires_mode;
41 //      int prev_width, prev_height;
42         uint8_t page;
43         uint8_t status;
44         uint8_t* regs;
45         
46         uint8_t screen[512][720];
47         uint8_t *font;
48         uint8_t *kanji;
49         scrntype_t palette_pc[32];
50         int cblink;
51         
52         void draw_alpha();
53         void draw_graph_160x200_16col();
54         void draw_graph_320x200_4col();
55         void draw_graph_320x200_16col();
56         void draw_graph_640x200_2col();
57         void draw_graph_640x200_4col();
58         void draw_graph_720x512_2col();
59         void draw_graph_360x512_4col();
60         
61 public:
62         DISPLAY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
63         {
64                 set_device_name(_T("Display"));
65         }
66         ~DISPLAY() {}
67         
68         // common functions
69         void initialize();
70         void reset();
71         void write_io8(uint32_t addr, uint32_t data);
72         uint32_t read_io8(uint32_t addr);
73         void write_signal(int id, uint32_t data, uint32_t mask);
74         void event_frame();
75         bool process_state(FILEIO* state_fio, bool loading);
76         
77         // unique functions
78         void set_context_mem(MEMORY* device)
79         {
80                 d_mem = device;
81         }
82         void set_regs_ptr(uint8_t* ptr)
83         {
84                 regs = ptr;
85         }
86         void set_font_ptr(uint8_t* ptr)
87         {
88                 font = ptr;
89         }
90         void set_kanji_ptr(uint8_t* ptr)
91         {
92                 kanji = ptr;
93         }
94         void draw_screen();
95 };
96
97 }
98 #endif
99