24#include "../../console/video.h"
28#define WRAP_OFFSET(x) ((VgaCrtcRegisters[SVGA_CRTC_EXT_DISPLAY_REG] & SVGA_CRTC_EXT_ADDR_WRAP) \
29 ? ((x) & 0xFFFFF) : LOWORD(x))
34#define USE_REACTOS_COLORS
37#if defined(USE_REACTOS_COLORS)
42 RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0xAA),
RGB(0x00, 0xAA, 0x00),
RGB(0x00, 0xAA, 0xAA),
43 RGB(0xAA, 0x00, 0x00),
RGB(0xAA, 0x00, 0xAA),
RGB(0xAA, 0x55, 0x00),
RGB(0xAA, 0xAA, 0xAA),
44 RGB(0x55, 0x55, 0x55),
RGB(0x55, 0x55, 0xFF),
RGB(0x55, 0xFF, 0x55),
RGB(0x55, 0xFF, 0xFF),
45 RGB(0xFF, 0x55, 0x55),
RGB(0xFF, 0x55, 0xFF),
RGB(0xFF, 0xFF, 0x55),
RGB(0xFF, 0xFF, 0xFF),
46 RGB(0x00, 0x00, 0x00),
RGB(0x10, 0x10, 0x10),
RGB(0x20, 0x20, 0x20),
RGB(0x35, 0x35, 0x35),
47 RGB(0x45, 0x45, 0x45),
RGB(0x55, 0x55, 0x55),
RGB(0x65, 0x65, 0x65),
RGB(0x75, 0x75, 0x75),
48 RGB(0x8A, 0x8A, 0x8A),
RGB(0x9A, 0x9A, 0x9A),
RGB(0xAA, 0xAA, 0xAA),
RGB(0xBA, 0xBA, 0xBA),
49 RGB(0xCA, 0xCA, 0xCA),
RGB(0xDF, 0xDF, 0xDF),
RGB(0xEF, 0xEF, 0xEF),
RGB(0xFF, 0xFF, 0xFF),
50 RGB(0x00, 0x00, 0xFF),
RGB(0x41, 0x00, 0xFF),
RGB(0x82, 0x00, 0xFF),
RGB(0xBE, 0x00, 0xFF),
51 RGB(0xFF, 0x00, 0xFF),
RGB(0xFF, 0x00, 0xBE),
RGB(0xFF, 0x00, 0x82),
RGB(0xFF, 0x00, 0x41),
52 RGB(0xFF, 0x00, 0x00),
RGB(0xFF, 0x41, 0x00),
RGB(0xFF, 0x82, 0x00),
RGB(0xFF, 0xBE, 0x00),
53 RGB(0xFF, 0xFF, 0x00),
RGB(0xBE, 0xFF, 0x00),
RGB(0x82, 0xFF, 0x00),
RGB(0x41, 0xFF, 0x00),
54 RGB(0x00, 0xFF, 0x00),
RGB(0x00, 0xFF, 0x41),
RGB(0x00, 0xFF, 0x82),
RGB(0x00, 0xFF, 0xBE),
55 RGB(0x00, 0xFF, 0xFF),
RGB(0x00, 0xBE, 0xFF),
RGB(0x00, 0x82, 0xFF),
RGB(0x00, 0x41, 0xFF),
56 RGB(0x82, 0x82, 0xFF),
RGB(0x9E, 0x82, 0xFF),
RGB(0xBE, 0x82, 0xFF),
RGB(0xDF, 0x82, 0xFF),
57 RGB(0xFF, 0x82, 0xFF),
RGB(0xFF, 0x82, 0xDF),
RGB(0xFF, 0x82, 0xBE),
RGB(0xFF, 0x82, 0x9E),
58 RGB(0xFF, 0x82, 0x82),
RGB(0xFF, 0x9E, 0x82),
RGB(0xFF, 0xBE, 0x82),
RGB(0xFF, 0xDF, 0x82),
59 RGB(0xFF, 0xFF, 0x82),
RGB(0xDF, 0xFF, 0x82),
RGB(0xBE, 0xFF, 0x82),
RGB(0x9E, 0xFF, 0x82),
60 RGB(0x82, 0xFF, 0x82),
RGB(0x82, 0xFF, 0x9E),
RGB(0x82, 0xFF, 0xBE),
RGB(0x82, 0xFF, 0xDF),
61 RGB(0x82, 0xFF, 0xFF),
RGB(0x82, 0xDF, 0xFF),
RGB(0x82, 0xBE, 0xFF),
RGB(0x82, 0x9E, 0xFF),
62 RGB(0xBA, 0xBA, 0xFF),
RGB(0xCA, 0xBA, 0xFF),
RGB(0xDF, 0xBA, 0xFF),
RGB(0xEF, 0xBA, 0xFF),
63 RGB(0xFF, 0xBA, 0xFF),
RGB(0xFF, 0xBA, 0xEF),
RGB(0xFF, 0xBA, 0xDF),
RGB(0xFF, 0xBA, 0xCA),
64 RGB(0xFF, 0xBA, 0xBA),
RGB(0xFF, 0xCA, 0xBA),
RGB(0xFF, 0xDF, 0xBA),
RGB(0xFF, 0xEF, 0xBA),
65 RGB(0xFF, 0xFF, 0xBA),
RGB(0xEF, 0xFF, 0xBA),
RGB(0xDF, 0xFF, 0xBA),
RGB(0xCA, 0xFF, 0xBA),
66 RGB(0xBA, 0xFF, 0xBA),
RGB(0xBA, 0xFF, 0xCA),
RGB(0xBA, 0xFF, 0xDF),
RGB(0xBA, 0xFF, 0xEF),
67 RGB(0xBA, 0xFF, 0xFF),
RGB(0xBA, 0xEF, 0xFF),
RGB(0xBA, 0xDF, 0xFF),
RGB(0xBA, 0xCA, 0xFF),
68 RGB(0x00, 0x00, 0x71),
RGB(0x1C, 0x00, 0x71),
RGB(0x39, 0x00, 0x71),
RGB(0x55, 0x00, 0x71),
69 RGB(0x71, 0x00, 0x71),
RGB(0x71, 0x00, 0x55),
RGB(0x71, 0x00, 0x39),
RGB(0x71, 0x00, 0x1C),
70 RGB(0x71, 0x00, 0x00),
RGB(0x71, 0x1C, 0x00),
RGB(0x71, 0x39, 0x00),
RGB(0x71, 0x55, 0x00),
71 RGB(0x71, 0x71, 0x00),
RGB(0x55, 0x71, 0x00),
RGB(0x39, 0x71, 0x00),
RGB(0x1C, 0x71, 0x00),
72 RGB(0x00, 0x71, 0x00),
RGB(0x00, 0x71, 0x1C),
RGB(0x00, 0x71, 0x39),
RGB(0x00, 0x71, 0x55),
73 RGB(0x00, 0x71, 0x71),
RGB(0x00, 0x55, 0x71),
RGB(0x00, 0x39, 0x71),
RGB(0x00, 0x1C, 0x71),
74 RGB(0x39, 0x39, 0x71),
RGB(0x45, 0x39, 0x71),
RGB(0x55, 0x39, 0x71),
RGB(0x61, 0x39, 0x71),
75 RGB(0x71, 0x39, 0x71),
RGB(0x71, 0x39, 0x61),
RGB(0x71, 0x39, 0x55),
RGB(0x71, 0x39, 0x45),
76 RGB(0x71, 0x39, 0x39),
RGB(0x71, 0x45, 0x39),
RGB(0x71, 0x55, 0x39),
RGB(0x71, 0x61, 0x39),
77 RGB(0x71, 0x71, 0x39),
RGB(0x61, 0x71, 0x39),
RGB(0x55, 0x71, 0x39),
RGB(0x45, 0x71, 0x39),
78 RGB(0x39, 0x71, 0x39),
RGB(0x39, 0x71, 0x45),
RGB(0x39, 0x71, 0x55),
RGB(0x39, 0x71, 0x61),
79 RGB(0x39, 0x71, 0x71),
RGB(0x39, 0x61, 0x71),
RGB(0x39, 0x55, 0x71),
RGB(0x39, 0x45, 0x71),
80 RGB(0x51, 0x51, 0x71),
RGB(0x59, 0x51, 0x71),
RGB(0x61, 0x51, 0x71),
RGB(0x69, 0x51, 0x71),
81 RGB(0x71, 0x51, 0x71),
RGB(0x71, 0x51, 0x69),
RGB(0x71, 0x51, 0x61),
RGB(0x71, 0x51, 0x59),
82 RGB(0x71, 0x51, 0x51),
RGB(0x71, 0x59, 0x51),
RGB(0x71, 0x61, 0x51),
RGB(0x71, 0x69, 0x51),
83 RGB(0x71, 0x71, 0x51),
RGB(0x69, 0x71, 0x51),
RGB(0x61, 0x71, 0x51),
RGB(0x59, 0x71, 0x51),
84 RGB(0x51, 0x71, 0x51),
RGB(0x51, 0x71, 0x59),
RGB(0x51, 0x71, 0x61),
RGB(0x51, 0x71, 0x69),
85 RGB(0x51, 0x71, 0x71),
RGB(0x51, 0x69, 0x71),
RGB(0x51, 0x61, 0x71),
RGB(0x51, 0x59, 0x71),
86 RGB(0x00, 0x00, 0x41),
RGB(0x10, 0x00, 0x41),
RGB(0x20, 0x00, 0x41),
RGB(0x31, 0x00, 0x41),
87 RGB(0x41, 0x00, 0x41),
RGB(0x41, 0x00, 0x31),
RGB(0x41, 0x00, 0x20),
RGB(0x41, 0x00, 0x10),
88 RGB(0x41, 0x00, 0x00),
RGB(0x41, 0x10, 0x00),
RGB(0x41, 0x20, 0x00),
RGB(0x41, 0x31, 0x00),
89 RGB(0x41, 0x41, 0x00),
RGB(0x31, 0x41, 0x00),
RGB(0x20, 0x41, 0x00),
RGB(0x10, 0x41, 0x00),
90 RGB(0x00, 0x41, 0x00),
RGB(0x00, 0x41, 0x10),
RGB(0x00, 0x41, 0x20),
RGB(0x00, 0x41, 0x31),
91 RGB(0x00, 0x41, 0x41),
RGB(0x00, 0x31, 0x41),
RGB(0x00, 0x20, 0x41),
RGB(0x00, 0x10, 0x41),
92 RGB(0x20, 0x20, 0x41),
RGB(0x28, 0x20, 0x41),
RGB(0x31, 0x20, 0x41),
RGB(0x39, 0x20, 0x41),
93 RGB(0x41, 0x20, 0x41),
RGB(0x41, 0x20, 0x39),
RGB(0x41, 0x20, 0x31),
RGB(0x41, 0x20, 0x28),
94 RGB(0x41, 0x20, 0x20),
RGB(0x41, 0x28, 0x20),
RGB(0x41, 0x31, 0x20),
RGB(0x41, 0x39, 0x20),
95 RGB(0x41, 0x41, 0x20),
RGB(0x39, 0x41, 0x20),
RGB(0x31, 0x41, 0x20),
RGB(0x28, 0x41, 0x20),
96 RGB(0x20, 0x41, 0x20),
RGB(0x20, 0x41, 0x28),
RGB(0x20, 0x41, 0x31),
RGB(0x20, 0x41, 0x39),
97 RGB(0x20, 0x41, 0x41),
RGB(0x20, 0x39, 0x41),
RGB(0x20, 0x31, 0x41),
RGB(0x20, 0x28, 0x41),
98 RGB(0x2D, 0x2D, 0x41),
RGB(0x31, 0x2D, 0x41),
RGB(0x35, 0x2D, 0x41),
RGB(0x3D, 0x2D, 0x41),
99 RGB(0x41, 0x2D, 0x41),
RGB(0x41, 0x2D, 0x3D),
RGB(0x41, 0x2D, 0x35),
RGB(0x41, 0x2D, 0x31),
100 RGB(0x41, 0x2D, 0x2D),
RGB(0x41, 0x31, 0x2D),
RGB(0x41, 0x35, 0x2D),
RGB(0x41, 0x3D, 0x2D),
101 RGB(0x41, 0x41, 0x2D),
RGB(0x3D, 0x41, 0x2D),
RGB(0x35, 0x41, 0x2D),
RGB(0x31, 0x41, 0x2D),
102 RGB(0x2D, 0x41, 0x2D),
RGB(0x2D, 0x41, 0x31),
RGB(0x2D, 0x41, 0x35),
RGB(0x2D, 0x41, 0x3D),
103 RGB(0x2D, 0x41, 0x41),
RGB(0x2D, 0x3D, 0x41),
RGB(0x2D, 0x35, 0x41),
RGB(0x2D, 0x31, 0x41),
104 RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
105 RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00)
108#elif defined(USE_DOSBOX_COLORS)
113 RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0xAA),
RGB(0x00, 0xAA, 0x00),
RGB(0x00, 0xAA, 0xAA),
114 RGB(0xAA, 0x00, 0x00),
RGB(0xAA, 0x00, 0xAA),
RGB(0xAA, 0x55, 0x00),
RGB(0xAA, 0xAA, 0xAA),
115 RGB(0x55, 0x55, 0x55),
RGB(0x55, 0x55, 0xFF),
RGB(0x55, 0xFF, 0x55),
RGB(0x55, 0xFF, 0xFF),
116 RGB(0xFF, 0x55, 0x55),
RGB(0xFF, 0x55, 0xFF),
RGB(0xFF, 0xFF, 0x55),
RGB(0xFF, 0xFF, 0xFF),
117 RGB(0x00, 0x00, 0x00),
RGB(0x14, 0x14, 0x14),
RGB(0x20, 0x20, 0x20),
RGB(0x2C, 0x2C, 0x2C),
118 RGB(0x38, 0x38, 0x38),
RGB(0x45, 0x45, 0x45),
RGB(0x51, 0x51, 0x51),
RGB(0x61, 0x61, 0x61),
119 RGB(0x71, 0x71, 0x71),
RGB(0x82, 0x82, 0x82),
RGB(0x92, 0x92, 0x92),
RGB(0xA2, 0xA2, 0xA2),
120 RGB(0xB6, 0xB6, 0xB6),
RGB(0xCB, 0xCB, 0xCB),
RGB(0xE3, 0xE3, 0xE3),
RGB(0xFF, 0xFF, 0xFF),
121 RGB(0x00, 0x00, 0xFF),
RGB(0x41, 0x00, 0xFF),
RGB(0x7D, 0x00, 0xFF),
RGB(0xBE, 0x00, 0xFF),
122 RGB(0xFF, 0x00, 0xFF),
RGB(0xFF, 0x00, 0xBE),
RGB(0xFF, 0x00, 0x7D),
RGB(0xFF, 0x00, 0x41),
123 RGB(0xFF, 0x00, 0x00),
RGB(0xFF, 0x41, 0x00),
RGB(0xFF, 0x7D, 0x00),
RGB(0xFF, 0xBE, 0x00),
124 RGB(0xFF, 0xFF, 0x00),
RGB(0xBE, 0xFF, 0x00),
RGB(0x7D, 0xFF, 0x00),
RGB(0x41, 0xFF, 0x00),
125 RGB(0x00, 0xFF, 0x00),
RGB(0x00, 0xFF, 0x41),
RGB(0x00, 0xFF, 0x7D),
RGB(0x00, 0xFF, 0xBE),
126 RGB(0x00, 0xFF, 0xFF),
RGB(0x00, 0xBE, 0xFF),
RGB(0x00, 0x7D, 0xFF),
RGB(0x00, 0x41, 0xFF),
127 RGB(0x7D, 0x7D, 0xFF),
RGB(0x9E, 0x7D, 0xFF),
RGB(0xBE, 0x7D, 0xFF),
RGB(0xDF, 0x7D, 0xFF),
128 RGB(0xFF, 0x7D, 0xFF),
RGB(0xFF, 0x7D, 0xDF),
RGB(0xFF, 0x7D, 0xBE),
RGB(0xFF, 0x7D, 0x9E),
130 RGB(0xFF, 0x7D, 0x7D),
RGB(0xFF, 0x9E, 0x7D),
RGB(0xFF, 0xBE, 0x7D),
RGB(0xFF, 0xDF, 0x7D),
131 RGB(0xFF, 0xFF, 0x7D),
RGB(0xDF, 0xFF, 0x7D),
RGB(0xBE, 0xFF, 0x7D),
RGB(0x9E, 0xFF, 0x7D),
132 RGB(0x7D, 0xFF, 0x7D),
RGB(0x7D, 0xFF, 0x9E),
RGB(0x7D, 0xFF, 0xBE),
RGB(0x7D, 0xFF, 0xDF),
133 RGB(0x7D, 0xFF, 0xFF),
RGB(0x7D, 0xDF, 0xFF),
RGB(0x7D, 0xBE, 0xFF),
RGB(0x7D, 0x9E, 0xFF),
134 RGB(0xB6, 0xB6, 0xFF),
RGB(0xC7, 0xB6, 0xFF),
RGB(0xDB, 0xB6, 0xFF),
RGB(0xEB, 0xB6, 0xFF),
135 RGB(0xFF, 0xB6, 0xFF),
RGB(0xFF, 0xB6, 0xEB),
RGB(0xFF, 0xB6, 0xDB),
RGB(0xFF, 0xB6, 0xC7),
136 RGB(0xFF, 0xB6, 0xB6),
RGB(0xFF, 0xC7, 0xB6),
RGB(0xFF, 0xDB, 0xB6),
RGB(0xFF, 0xEB, 0xB6),
137 RGB(0xFF, 0xFF, 0xB6),
RGB(0xEB, 0xFF, 0xB6),
RGB(0xDB, 0xFF, 0xB6),
RGB(0xC7, 0xFF, 0xB6),
138 RGB(0xB6, 0xFF, 0xB6),
RGB(0xB6, 0xFF, 0xC7),
RGB(0xB6, 0xFF, 0xDB),
RGB(0xB6, 0xFF, 0xEB),
139 RGB(0xB6, 0xFF, 0xFF),
RGB(0xB6, 0xEB, 0xFF),
RGB(0xB6, 0xDB, 0xFF),
RGB(0xB6, 0xC7, 0xFF),
140 RGB(0x00, 0x00, 0x71),
RGB(0x1C, 0x00, 0x71),
RGB(0x38, 0x00, 0x71),
RGB(0x55, 0x00, 0x71),
141 RGB(0x71, 0x00, 0x71),
RGB(0x71, 0x00, 0x55),
RGB(0x71, 0x00, 0x38),
RGB(0x71, 0x00, 0x1C),
142 RGB(0x71, 0x00, 0x00),
RGB(0x71, 0x1C, 0x00),
RGB(0x71, 0x38, 0x00),
RGB(0x71, 0x55, 0x00),
143 RGB(0x71, 0x71, 0x00),
RGB(0x55, 0x71, 0x00),
RGB(0x38, 0x71, 0x00),
RGB(0x1C, 0x71, 0x00),
144 RGB(0x00, 0x71, 0x00),
RGB(0x00, 0x71, 0x1C),
RGB(0x00, 0x71, 0x38),
RGB(0x00, 0x71, 0x55),
145 RGB(0x00, 0x71, 0x71),
RGB(0x00, 0x55, 0x71),
RGB(0x00, 0x38, 0x71),
RGB(0x00, 0x1C, 0x71),
147 RGB(0x38, 0x38, 0x71),
RGB(0x45, 0x38, 0x71),
RGB(0x55, 0x38, 0x71),
RGB(0x61, 0x38, 0x71),
148 RGB(0x71, 0x38, 0x71),
RGB(0x71, 0x38, 0x61),
RGB(0x71, 0x38, 0x55),
RGB(0x71, 0x38, 0x45),
149 RGB(0x71, 0x38, 0x38),
RGB(0x71, 0x45, 0x38),
RGB(0x71, 0x55, 0x38),
RGB(0x71, 0x61, 0x38),
150 RGB(0x71, 0x71, 0x38),
RGB(0x61, 0x71, 0x38),
RGB(0x55, 0x71, 0x38),
RGB(0x45, 0x71, 0x38),
151 RGB(0x38, 0x71, 0x38),
RGB(0x38, 0x71, 0x45),
RGB(0x38, 0x71, 0x55),
RGB(0x38, 0x71, 0x61),
152 RGB(0x38, 0x71, 0x71),
RGB(0x38, 0x61, 0x71),
RGB(0x38, 0x55, 0x71),
RGB(0x38, 0x45, 0x71),
153 RGB(0x51, 0x51, 0x71),
RGB(0x59, 0x51, 0x71),
RGB(0x61, 0x51, 0x71),
RGB(0x69, 0x51, 0x71),
154 RGB(0x71, 0x51, 0x71),
RGB(0x71, 0x51, 0x69),
RGB(0x71, 0x51, 0x61),
RGB(0x71, 0x51, 0x59),
155 RGB(0x71, 0x51, 0x51),
RGB(0x71, 0x59, 0x51),
RGB(0x71, 0x61, 0x51),
RGB(0x71, 0x69, 0x51),
156 RGB(0x71, 0x71, 0x51),
RGB(0x69, 0x71, 0x51),
RGB(0x61, 0x71, 0x51),
RGB(0x59, 0x71, 0x51),
157 RGB(0x51, 0x71, 0x51),
RGB(0x51, 0x71, 0x59),
RGB(0x51, 0x71, 0x61),
RGB(0x51, 0x71, 0x69),
158 RGB(0x51, 0x71, 0x71),
RGB(0x51, 0x69, 0x71),
RGB(0x51, 0x61, 0x71),
RGB(0x51, 0x59, 0x71),
159 RGB(0x00, 0x00, 0x41),
RGB(0x10, 0x00, 0x41),
RGB(0x20, 0x00, 0x41),
RGB(0x30, 0x00, 0x41),
160 RGB(0x41, 0x00, 0x41),
RGB(0x41, 0x00, 0x30),
RGB(0x41, 0x00, 0x20),
RGB(0x41, 0x00, 0x10),
161 RGB(0x41, 0x00, 0x00),
RGB(0x41, 0x10, 0x00),
RGB(0x41, 0x20, 0x00),
RGB(0x41, 0x30, 0x00),
162 RGB(0x41, 0x41, 0x00),
RGB(0x30, 0x41, 0x00),
RGB(0x20, 0x41, 0x00),
RGB(0x10, 0x41, 0x00),
164 RGB(0x00, 0x41, 0x00),
RGB(0x00, 0x41, 0x10),
RGB(0x00, 0x41, 0x20),
RGB(0x00, 0x41, 0x30),
165 RGB(0x00, 0x41, 0x41),
RGB(0x00, 0x30, 0x41),
RGB(0x00, 0x20, 0x41),
RGB(0x00, 0x10, 0x41),
166 RGB(0x20, 0x20, 0x41),
RGB(0x28, 0x20, 0x41),
RGB(0x30, 0x20, 0x41),
RGB(0x38, 0x20, 0x41),
167 RGB(0x41, 0x20, 0x41),
RGB(0x41, 0x20, 0x38),
RGB(0x41, 0x20, 0x30),
RGB(0x41, 0x20, 0x28),
168 RGB(0x41, 0x20, 0x20),
RGB(0x41, 0x28, 0x20),
RGB(0x41, 0x30, 0x20),
RGB(0x41, 0x38, 0x20),
169 RGB(0x41, 0x41, 0x20),
RGB(0x38, 0x41, 0x20),
RGB(0x30, 0x41, 0x20),
RGB(0x28, 0x41, 0x20),
170 RGB(0x20, 0x41, 0x20),
RGB(0x20, 0x41, 0x28),
RGB(0x20, 0x41, 0x30),
RGB(0x20, 0x41, 0x38),
171 RGB(0x20, 0x41, 0x41),
RGB(0x20, 0x38, 0x41),
RGB(0x20, 0x30, 0x41),
RGB(0x20, 0x28, 0x41),
172 RGB(0x2C, 0x2C, 0x41),
RGB(0x30, 0x2C, 0x41),
RGB(0x34, 0x2C, 0x41),
RGB(0x3C, 0x2C, 0x41),
173 RGB(0x41, 0x2C, 0x41),
RGB(0x41, 0x2C, 0x3C),
RGB(0x41, 0x2C, 0x34),
RGB(0x41, 0x2C, 0x30),
174 RGB(0x41, 0x2C, 0x2C),
RGB(0x41, 0x30, 0x2C),
RGB(0x41, 0x34, 0x2C),
RGB(0x41, 0x3C, 0x2C),
175 RGB(0x41, 0x41, 0x2C),
RGB(0x3C, 0x41, 0x2C),
RGB(0x34, 0x41, 0x2C),
RGB(0x30, 0x41, 0x2C),
176 RGB(0x2C, 0x41, 0x2C),
RGB(0x2C, 0x41, 0x30),
RGB(0x2C, 0x41, 0x34),
RGB(0x2C, 0x41, 0x3C),
177 RGB(0x2C, 0x41, 0x41),
RGB(0x2C, 0x3C, 0x41),
RGB(0x2C, 0x34, 0x41),
RGB(0x2C, 0x30, 0x41),
178 RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
179 RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00),
RGB(0x00, 0x00, 0x00)
304#include "../../console/video.c"
391 Data = (
Data & (1 << Plane)) ? 0xFF : 0x00;
434 BYTE Numerator, Denominator;
482 Numerator &= ~(1 << 7);
485 if (!(Denominator & (1 << 7))) Denominator &= ~(1 << 6);
488 if (Denominator & 1) Denominator &= ~1;
489 else Denominator >>= 1;
519 for (
i = 0;
i < NumOfEntries;
i++)
566 TextPalette->palPalEntry[
i].peFlags = 0;
581 if (Palette)
RtlFreeHeap(RtlGetProcessHeap(), 0, Palette);
582 if (TextPalette)
RtlFreeHeap(RtlGetProcessHeap(), 0, TextPalette);
770 InterlaceHighBit >>= 1;
787 if (
i == LineCompare)
817 X =
j + ((PixelShift >> 1) & 0x03);
821 X =
j + ((PixelShift < 8) ? PixelShift : -1);
871 DPRINT1(
"8-bit interleaved mode is not implemented!\n");
879 DWORD BankNumber = (
X / 4) % 2;
885 LowPlaneData = (LowPlaneData >> (6 - ((
X % 4) * 2))) & 0x03;
886 HighPlaneData = (HighPlaneData >> (6 - ((
X % 4) * 2))) & 0x03;
889 PixelData = LowPlaneData | (HighPlaneData << 2);
910 if (PlaneData & BitMask) PixelData |= 1 <<
k;
913 if (PlaneData & (BitMask >> 1)) PixelData |= 1 << (
k + 4);
925 if (PlaneData & (1 << (7 - (
X % 8)))) PixelData |= 1 <<
k;
1098 TextSize, ScanlineSize, Location);
1127 ULONG HblankStart, HblankEnd;
1128 ULONG HblankDuration;
1130 ULONG VerticalRetraceEnd;
1143 VerticalRetraceStart <<= 1;
1144 VerticalRetraceEnd <<= 1;
1148 VerticalRetraceStart *= MaximumScanLine;
1149 VerticalRetraceEnd *= MaximumScanLine;
1156 if (HblankEnd < HblankStart) HblankEnd |= 0x20;
1157 HblankDuration = ((HblankEnd - HblankStart) * Dots
1158 * CyclesPerMicrosecond + (
Clock >> 1)) /
Clock;
1248 DPRINT1(
"VgaReadPort: Unknown port 0x%X\n",
Port);
1448 DPRINT1(
"Monochrome emulation\n");
1606 DPRINT1(
"VgaWritePort: Unknown port 0x%X, Data 0x%02X\n",
Port,
Data);
1643 DPRINT(
"Updating screen rectangle (%d, %d, %d, %d)\n",
1664 ULONG HSyncsPerSecond, HSyncs;
1671 if (HSyncs == 0) HSyncs = 1;
1683 VerticalRetraceStart <<= 1;
1684 VerticalTotal <<= 1;
1688 VerticalRetraceStart *= MaximumScanLine;
1689 VerticalTotal *= MaximumScanLine;
1843#if defined(__GNUC__)
1871 while ((
i + 3) <
Size)
1882 switch (
Size -
i - 3)
1907 while (
i < (
Size - 1))
1932 const ULONG BitExpandInvertTable[] =
1934 0xFFFFFFFF, 0xFFFFFF00, 0xFFFF00FF, 0xFFFF0000,
1935 0xFF00FFFF, 0xFF00FF00, 0xFF0000FF, 0xFF000000,
1936 0x00FFFFFF, 0x00FFFF00, 0x00FF00FF, 0x00FF0000,
1937 0x0000FFFF, 0x0000FF00, 0x000000FF, 0x00000000
1958 ULONG PlaneData = 0;
1967 PlaneData ^= ColorCompareBytes;
1970 PlaneData |= ColorIgnoreBytes;
1973 BufPtr[
i] = (PlaneData & (PlaneData >> 8) & (PlaneData >> 16) & (PlaneData >> 24)) & 0xFF;
2063#if defined(__GNUC__)
static const ENTRY Entries[]
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
BIOS_MEMORY_MAP MemoryMap[32]
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
#define HARDWARE_TIMER_ENABLED
static const WCHAR Cleanup[]
VOID EmulatorTerminate(VOID)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG Offset
base of all file and directory entries
PHARDWARE_TIMER CreateHardwareTimer(ULONG Flags, ULONGLONG Delay, PHARDWARE_TIMER_PROC Callback)
VOID DestroyHardwareTimer(PHARDWARE_TIMER Timer)
ULONGLONG CurrentCycleCount
VOID VgaConsoleDestroyTextScreen(VOID)
BOOL VgaConsoleCreateGraphicsScreen(IN PCOORD Resolution, IN HANDLE PaletteHandle)
VOID VgaConsoleCleanup(VOID)
VOID VgaConsoleDestroyGraphicsScreen(VOID)
VOID VgaConsoleUpdateTextCursor(BOOL CursorVisible, BYTE CursorStart, BYTE CursorEnd, BYTE TextSize, DWORD ScanlineSize, WORD Location)
BOOL VgaConsoleCreateTextScreen(IN PCOORD Resolution, IN HANDLE PaletteHandle)
VOID VgaConsoleRepaintScreen(PSMALL_RECT Rect)
static BOOLEAN DoubleHeight
static HANDLE ConsoleMutex
static PVOID GraphicsFramebuffer = NULL;
static BOOLEAN DoubleWidth
BOOLEAN VgaConsoleInitialize(HANDLE TextHandle)
VOID UnregisterIoPort(USHORT Port)
VOID RegisterIoPort(USHORT Port, EMULATOR_INB_PROC InHandler, EMULATOR_OUTB_PROC OutHandler)
BOOL MemRemoveFastMemoryHook(PVOID Address, ULONG Size)
BOOL MemInstallFastMemoryHook(PVOID Address, ULONG Size, PMEMORY_READ_HANDLER ReadHandler, PMEMORY_WRITE_HANDLER WriteHandler)
static HPALETTE TextPaletteHandle
static VOID VgaResetPalette(VOID)
static BYTE VgaDacRegisters[VGA_PALETTE_SIZE]
static DWORD ScanlineSizeLatch
static const COLORREF ConsoleColors[16]
static BOOLEAN VgaAcPalDisable
static CONST DWORD MemoryBase[]
static DWORD ScanlineCounter
static CONST DWORD MemorySize[]
static HPALETTE PaletteHandle
static BYTE VgaDacLatchCounter
static VOID VgaMarkForUpdate(SHORT Row, SHORT Column)
static ULONGLONG HorizontalRetraceCycle
static VOID VgaWriteCrtc(BYTE Data)
BOOLEAN FASTCALL VgaWriteMemory(ULONG Address, PVOID Buffer, ULONG Size)
VOID FASTCALL VgaReadMemory(ULONG Address, PVOID Buffer, ULONG Size)
static PHARDWARE_TIMER HSyncTimer
static VOID VgaWriteAc(BYTE Data)
static COORD CurrResolution
enum _SCREEN_MODE SCREEN_MODE
static BYTE WINAPI VgaReadPort(USHORT Port)
static DWORD VgaTranslateAddress(DWORD Address)
static DWORD VgaGetVideoBaseAddress(VOID)
static BYTE VgaAcRegisters[VGA_AC_MAX_REG]
static BYTE VgaCrtcRegisters[SVGA_CRTC_MAX_REG]
static BYTE VgaDacLatch[3]
static ULONG VgaGetClockFrequency(VOID)
static VOID VgaWriteSequencer(BYTE Data)
static BYTE VgaLatchRegisters[VGA_NUM_BANKS]
static CONST COLORREF VgaDefaultPalette[VGA_MAX_COLORS]
static VOID VgaLeaveCurrentMode(VOID)
static VOID VgaChangeMode(VOID)
VOID VgaRefreshDisplay(VOID)
static BOOLEAN VgaInitializePalette(VOID)
static BOOL VgaEnterNewMode(SCREEN_MODE NewScreenMode, PCOORD Resolution)
static PCHAR_CELL TextFramebuffer
static SCREEN_MODE ScreenMode
static BOOLEAN NeedsUpdate
static PBYTE GraphicsFramebuffer
static BOOLEAN PaletteChanged
static VOID FASTCALL VgaHorizontalRetrace(ULONGLONG ElapsedTime)
static BYTE VgaGcRegisters[SVGA_GC_MAX_REG]
static VOID VgaUpdateFramebuffer(VOID)
static VOID VgaUpdateTextCursor(VOID)
static SMALL_RECT UpdateRectangle
static BYTE VgaFeatureRegister
static BYTE VgaTranslateByteForWriting(BYTE Data, BYTE Plane)
static BYTE VgaMemory[VGA_NUM_BANKS *SVGA_BANK_SIZE]
enum _SCREEN_MODE * PSCREEN_MODE
static VOID VgaVerticalRetrace(VOID)
static BYTE SvgaHiddenRegister
static BOOLEAN ModeChanged
static DWORD VgaGetAddressSize(VOID)
BOOLEAN VgaInitialize(HANDLE TextHandle)
static UINT SvgaHdrCounter
static BYTE VgaMiscRegister
static VOID VgaResetSequencer(VOID)
static VOID VgaRestoreDefaultPalette(PPALETTEENTRY Entries, USHORT NumOfEntries)
static BOOLEAN CursorChanged
static BYTE VgaSeqRegisters[SVGA_SEQ_MAX_REG]
COORD VgaGetDisplayResolution(VOID)
static VOID WINAPI VgaWritePort(USHORT Port, BYTE Data)
static PVOID ActiveFramebuffer
ConsoleFramebuffer.
static BOOLEAN VgaDacReadWrite
static VOID VgaWriteGc(BYTE Data)
static VOID VgaWriteDac(BYTE Data)
static BOOLEAN VgaAcLatch
VOID VgaWriteTextModeFont(UINT FontNumber, CONST UCHAR *FontData, UINT Height)
static DWORD StartAddressLatch
VOID VgaClearMemory(VOID)
#define VGA_CRTC_DATA_MONO
#define VGA_CRTC_OVERFLOW_VDE8
#define VGA_MISC_RAM_ENABLED
#define VGA_GC_MODE_SHIFTREG
#define VGA_CRTC_MAXSCANLINE_DOUBLE
#define VGA_COLOR_TO_DAC(x)
#define VGA_INSTAT1_READ_COLOR
#define VGA_SEQ_CLOCK_98DM
#define VGA_CRTC_OVERFLOW_VDE9
#define VGA_CRTC_OVERFLOW_LC8
#define VGA_DAC_READ_INDEX
#define SVGA_GC_EXT_MODE_WND_B
#define SVGA_CRTC_EXT_ADDR_BIT16
#define VGA_GC_INDEX_MASK
#define SVGA_CRTC_EXT_OFFSET_BIT8
#define VGA_AC_CONTROL_8BIT
#define SVGA_GC_MAX_UNLOCKED_REG
#define VGA_STAT_VRETRACE
#define VGA_DAC_WRITE_INDEX
#define VGA_CRTC_OVERFLOW_VRS9
#define VGA_INTERLACE_HIGH_BIT
#define VGA_FEATURE_WRITE_COLOR
#define VGA_CRTC_INDEX_COLOR
#define VGA_CRTC_UNDERLINE_DWORD
@ SVGA_SEQ_VCLK1_DENOMINATOR_REG
@ SVGA_SEQ_VCLK0_DENOMINATOR_REG
@ SVGA_SEQ_VCLK2_NUMERATOR_REG
@ SVGA_SEQ_VCLK3_NUMERATOR_REG
@ SVGA_SEQ_VCLK3_DENOMINATOR_REG
@ SVGA_SEQ_VCLK2_DENOMINATOR_REG
@ SVGA_SEQ_VCLK0_NUMERATOR_REG
@ SVGA_SEQ_VCLK1_NUMERATOR_REG
#define VGA_CRTC_OVERFLOW_VRS8
#define VGA_CRTC_MODE_CONTROL_BYTE
#define VGA_DAC_TO_COLOR(x)
#define SVGA_SEQ_MAX_UNLOCKED_REG
#define VGA_MAX_FONT_HEIGHT
#define VGA_INSTAT1_READ_MONO
#define VGA_GC_MISC_NOALPHA
#define SVGA_CRTC_EXT_ADDR_BIT19
#define SVGA_SEQ_UNLOCK_MASK
#define VGA_CRTC_INDEX_MONO
#define VGA_CRTC_OVERFLOW_VT9
#define VGA_CRTC_MAXSCANLINE_LC9
#define SVGA_GC_EXT_MODE_GRAN
#define VGA_CRTC_DATA_COLOR
#define VGA_GC_MODE_SHIFT256
@ VGA_CRTC_VERT_TOTAL_REG
@ VGA_CRTC_START_ADDR_LOW_REG
@ VGA_CRTC_MAX_SCAN_LINE_REG
@ VGA_CRTC_START_HORZ_BLANKING_REG
@ VGA_CRTC_PRESET_ROW_SCAN_REG
@ VGA_CRTC_END_VERT_RETRACE_REG
@ VGA_CRTC_LINE_COMPARE_REG
@ VGA_CRTC_START_VERT_RETRACE_REG
@ VGA_CRTC_CURSOR_START_REG
@ VGA_CRTC_START_ADDR_HIGH_REG
@ VGA_CRTC_VERT_DISP_END_REG
@ VGA_CRTC_END_HORZ_BLANKING_REG
@ VGA_CRTC_CURSOR_LOC_HIGH_REG
@ VGA_CRTC_CURSOR_LOC_LOW_REG
@ VGA_CRTC_HORZ_TOTAL_REG
@ VGA_CRTC_END_HORZ_DISP_REG
@ VGA_CRTC_CURSOR_END_REG
@ SVGA_CRTC_EXT_DISPLAY_REG
@ VGA_CRTC_MODE_CONTROL_REG
@ VGA_AC_HORZ_PANNING_REG
#define VGA_FONT_CHARACTERS
@ VGA_GC_ENABLE_RESET_REG
@ VGA_GC_READ_MAP_SEL_REG
@ VGA_GC_COLOR_IGNORE_REG
@ VGA_GC_COLOR_COMPARE_REG
#define SVGA_SEQ_MCLK_VCLK
#define VGA_FEATURE_WRITE_MONO
#define VGA_CRTC_OVERFLOW_VT8
#define VGA_AC_CONTROL_PPM
#define SVGA_SEQ_EXT_MODE_HIGH_RES
struct _CHAR_CELL * PCHAR_CELL
#define SVGA_SEQ_UNLOCKED
#define VGA_SEQ_INDEX_MASK
#define VGA_AC_CONTROL_P54S
#define SVGA_CRTC_EXT_ADDR_BITS1718
#define VGA_CRTC_INDEX_MASK
#define SVGA_CRTC_MAX_UNLOCKED_REG
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
_In_ HFONT _Out_ PUINT Height
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
DWORD WINAPI GetLastError(void)
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
UINT WINAPI SetPaletteEntries(_In_ HPALETTE hpal, _In_ UINT iStart, _In_ UINT cEntries, _In_reads_(cEntries) CONST PALETTEENTRY *pPalEntries)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO