OSDN Git Service

[VM][WIP] Pre-process to apply new state framework.Still not buildable.
[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 class DISPLAY : public DEVICE
24 {
25 private:
26         MEMORY *d_mem;
27         
28         uint8_t vram[0x20000];
29         uint8_t extvram[0x10000];
30         
31         uint8_t vgarray[0x10];
32         uint8_t palette[0x10];
33         int vgarray_num;
34         
35         uint8_t bankreg[16];
36         int bankreg_num;
37         
38         uint8_t hires_mode;
39 //      int prev_width, prev_height;
40         uint8_t page;
41         uint8_t status;
42         uint8_t* regs;
43         
44         uint8_t screen[512][720];
45         uint8_t *font;
46         uint8_t *kanji;
47         scrntype_t palette_pc[32];
48         int cblink;
49         
50         void draw_alpha();
51         void draw_graph_160x200_16col();
52         void draw_graph_320x200_4col();
53         void draw_graph_320x200_16col();
54         void draw_graph_640x200_2col();
55         void draw_graph_640x200_4col();
56         void draw_graph_720x512_2col();
57         void draw_graph_360x512_4col();
58         
59 public:
60         DISPLAY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
61         {
62                 set_device_name(_T("Display"));
63         }
64         ~DISPLAY() {}
65         
66         // common functions
67         void initialize();
68         void reset();
69         void write_io8(uint32_t addr, uint32_t data);
70         uint32_t read_io8(uint32_t addr);
71         void write_signal(int id, uint32_t data, uint32_t mask);
72         void event_frame();
73         bool process_state(FILEIO* state_fio, bool loading);
74         
75         // unique functions
76         void set_context_mem(MEMORY* device)
77         {
78                 d_mem = device;
79         }
80         void set_regs_ptr(uint8_t* ptr)
81         {
82                 regs = ptr;
83         }
84         void set_font_ptr(uint8_t* ptr)
85         {
86                 font = ptr;
87         }
88         void set_kanji_ptr(uint8_t* ptr)
89         {
90                 kanji = ptr;
91         }
92         void draw_screen();
93 };
94
95 #endif
96