00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#include "stdarg.h"
00024
#include "stdio.h"
00025
#include "ntddk.h"
00026
#include "fsvga.h"
00027
#include "fsvgalog.h"
00028
00029
00030
VOID
00031 GetHardwareScrollReg(
00032
PDEVICE_EXTENSION deviceExtension
00033 )
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 {
00048 UCHAR
low;
00049 UCHAR
high;
00050 UCHAR mid;
00051
00052 WRITE_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCAddressPortColor],
00053
IND_START_ADRS_L);
00054
low = READ_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCDataPortColor]);
00055
00056 WRITE_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCAddressPortColor],
00057
IND_START_ADRS_H);
00058
high = READ_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCDataPortColor]);
00059
00060 deviceExtension->
EmulateInfo.
StartAddress = MAKEWORD(
low,
high);
00061
00062 WRITE_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCAddressPortColor],
00063
IND_LINE_COMPARE);
00064
low = READ_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCDataPortColor]);
00065
00066 WRITE_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCAddressPortColor],
00067
IND_LINE_COMPARE8);
00068 mid = READ_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCDataPortColor]);
00069 mid = (mid >> 4) & 1;
00070
00071 WRITE_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCAddressPortColor],
00072
IND_LINE_COMPARE9);
00073
high = READ_PORT_UCHAR(deviceExtension->
DeviceRegisters[
CRTCDataPortColor]);
00074
high = (
high >> 5) & 2;
00075
00076
high |= mid;
00077 deviceExtension->
EmulateInfo.
LineCompare = MAKEWORD(
low,
high);
00078 }
00079
00080
VOID
00081 SetGRAMWriteMode(
00082
PDEVICE_EXTENSION deviceExtension
00083 )
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 {
00098 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00099 MAKEWORD(
IND_GRAPH_MODE,
M_PROC_WRITE+
M_DATA_READ));
00100
00101
00102
00103
00104 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00105 MAKEWORD(
IND_DATA_ROTATE,
DR_SET));
00106
00107
00108
00109
00110 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
SEQUAddressPort],
00111 MAKEWORD(
IND_MAP_MASK,
GRAPH_ADDR_MASK));
00112
00113
00114
00115 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00116 MAKEWORD(
IND_BIT_MASK,
BIT_MASK_DEFAULT));
00117
00118 }
00119
00120
VOID
00121 SetGRAMCopyMode(
00122
PDEVICE_EXTENSION deviceExtension
00123 )
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 {
00138 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00139 MAKEWORD(
IND_GRAPH_MODE,
M_LATCH_WRITE+
M_COLOR_READ));
00140
00141
00142
00143
00144 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00145 MAKEWORD(
IND_DATA_ROTATE,
DR_SET));
00146
00147 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00148 MAKEWORD(
IND_COLOR_DONT_CARE, 0));
00149 }
00150
00151
VOID
00152 SetGRAMInvertMode(
00153
PDEVICE_EXTENSION deviceExtension
00154 )
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 {
00169 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00170 MAKEWORD(
IND_GRAPH_MODE,
M_AND_WRITE+
M_COLOR_READ));
00171
00172 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00173 MAKEWORD(
IND_DATA_ROTATE,
DR_XOR));
00174
00175 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00176 MAKEWORD(
IND_BIT_MASK,
BIT_MASK_DEFAULT));
00177
00178 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00179 MAKEWORD(
IND_COLOR_DONT_CARE, 0));
00180
00181 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00182 MAKEWORD(
IND_SET_RESET, 0xff));
00183 }
00184
00185
VOID
00186 set_opaque_bkgnd_proc(
00187
PDEVICE_EXTENSION deviceExtension,
00188 PUCHAR FrameBuffer,
00189 WORD Attributes
00190 )
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 {
00204
BYTE ColorFg =
LOBYTE(Attributes) & 0x0f;
00205
BYTE ColorBg = (
LOBYTE(Attributes) & 0xf0) >> 4;
00206
00207
if (Attributes & COMMON_LVB_REVERSE_VIDEO)
00208 {
00209 Attributes = ColorBg;
00210 ColorBg = ColorFg;
00211 ColorFg = (
BYTE)Attributes;
00212 }
00213
00214
if (deviceExtension->
EmulateInfo.
ColorFg == ColorFg &&
00215 deviceExtension->
EmulateInfo.
ColorBg == ColorBg)
00216
return;
00217
00218 deviceExtension->
EmulateInfo.
ColorFg = ColorFg;
00219 deviceExtension->
EmulateInfo.
ColorBg = ColorBg;
00220
00221
ColorSetDirect(deviceExtension, FrameBuffer, ColorFg, ColorBg);
00222 }
00223
00224
VOID
00225 ColorSetGridMask(
00226
PDEVICE_EXTENSION deviceExtension,
00227 BYTE BitMask
00228 )
00229 {
00230
00231
00232
00233
00234 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00235 MAKEWORD(
IND_SET_RESET_ENABLE,
GRAPH_ADDR_MASK));
00236
00237
00238
00239
00240 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00241 MAKEWORD(
IND_SET_RESET, 0x07));
00242
00243
00244
00245
00246 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00247 MAKEWORD(
IND_BIT_MASK, BitMask));
00248
00249
00250
00251
00252 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00253 MAKEWORD(
IND_DATA_ROTATE,
DR_SET));
00254 }
00255
00256
VOID
00257 ColorSetDirect(
00258
PDEVICE_EXTENSION deviceExtension,
00259 PUCHAR FrameBuffer,
00260 BYTE ColorFg,
00261 BYTE ColorBg
00262 )
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275 {
00276
00277
00278
00279 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00280 MAKEWORD(
IND_DATA_ROTATE,
DR_SET));
00281
00282
00283
00284
00285 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00286 MAKEWORD(
IND_SET_RESET, ColorBg));
00287
00288
00289
00290
00291 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00292 MAKEWORD(
IND_SET_RESET_ENABLE,
GRAPH_ADDR_MASK));
00293
00294
00295
00296
00297
AccessGRAM_WR(FrameBuffer,
GRAPH_ADDR_MASK);
00298
00299
00300
00301
00302 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00303 MAKEWORD(
IND_SET_RESET, 0));
00304
00305
00306
00307
00308 ColorFg = ~(ColorFg ^ ColorBg);
00309 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00310 MAKEWORD(
IND_SET_RESET_ENABLE, ColorFg));
00311
00312
00313
00314
00315 WRITE_PORT_USHORT(deviceExtension->
DeviceRegisters[
GRAPHAddressPort],
00316 MAKEWORD(
IND_DATA_ROTATE,
DR_XOR));
00317
00318
00319 }