Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

port.c File Reference

#include "stdarg.h"
#include "stdio.h"
#include "ntddk.h"
#include "fsvga.h"
#include "fsvgalog.h"

Go to the source code of this file.

Functions

VOID GetHardwareScrollReg (PDEVICE_EXTENSION deviceExtension)
VOID SetGRAMWriteMode (PDEVICE_EXTENSION deviceExtension)
VOID SetGRAMCopyMode (PDEVICE_EXTENSION deviceExtension)
VOID SetGRAMInvertMode (PDEVICE_EXTENSION deviceExtension)
VOID set_opaque_bkgnd_proc (PDEVICE_EXTENSION deviceExtension, PUCHAR FrameBuffer, WORD Attributes)
VOID ColorSetGridMask (PDEVICE_EXTENSION deviceExtension, BYTE BitMask)
VOID ColorSetDirect (PDEVICE_EXTENSION deviceExtension, PUCHAR FrameBuffer, BYTE ColorFg, BYTE ColorBg)


Function Documentation

VOID ColorSetDirect PDEVICE_EXTENSION  deviceExtension,
PUCHAR  FrameBuffer,
BYTE  ColorFg,
BYTE  ColorBg
 

Definition at line 257 of file port.c.

References AccessGRAM_WR(), _DEVICE_EXTENSION::DeviceRegisters, DR_SET, DR_XOR, GRAPH_ADDR_MASK, GRAPHAddressPort, IND_DATA_ROTATE, IND_SET_RESET, and IND_SET_RESET_ENABLE.

Referenced by FsgWriteToScreenCommonLVB(), and set_opaque_bkgnd_proc().

00275 { 00276 // 00277 // Set up to write data without interacting with the latches. 00278 // 00279 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00280 MAKEWORD(IND_DATA_ROTATE, DR_SET)); 00281 00282 // 00283 // Put the background color in the Set/Reset register. 00284 // 00285 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00286 MAKEWORD(IND_SET_RESET, ColorBg)); 00287 00288 // 00289 // That color is used for all planes. 00290 // 00291 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00292 MAKEWORD(IND_SET_RESET_ENABLE, GRAPH_ADDR_MASK)); 00293 00294 // 00295 // This gets our background color into the latches. 00296 // 00297 AccessGRAM_WR(FrameBuffer, GRAPH_ADDR_MASK); 00298 00299 // 00300 // Change the Set/Reset register to be all zeroes. 00301 // 00302 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00303 MAKEWORD(IND_SET_RESET, 0)); 00304 00305 // 00306 // The Set/Reset enable register now flags where the foreground/background colors are the same. 00307 // 00308 ColorFg = ~(ColorFg ^ ColorBg); 00309 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00310 MAKEWORD(IND_SET_RESET_ENABLE, ColorFg)); 00311 00312 // 00313 // Color differences will be xor'd with the latches. 00314 // 00315 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00316 MAKEWORD(IND_DATA_ROTATE, DR_XOR)); 00317 00318 00319 }

VOID ColorSetGridMask PDEVICE_EXTENSION  deviceExtension,
BYTE  BitMask
 

Definition at line 225 of file port.c.

References _DEVICE_EXTENSION::DeviceRegisters, DR_SET, GRAPH_ADDR_MASK, GRAPHAddressPort, IND_BIT_MASK, IND_DATA_ROTATE, IND_SET_RESET, and IND_SET_RESET_ENABLE.

Referenced by FsgWriteToScreenCommonLVB().

00229 { 00230 00231 // 00232 // That color is used for all planes. 00233 // 00234 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00235 MAKEWORD(IND_SET_RESET_ENABLE, GRAPH_ADDR_MASK)); 00236 00237 // 00238 // Change the Set/Reset register to be all set. 00239 // 00240 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00241 MAKEWORD(IND_SET_RESET, 0x07)); 00242 00243 // 00244 // Use specified pixel positions. 00245 // 00246 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00247 MAKEWORD(IND_BIT_MASK, BitMask)); 00248 00249 // 00250 // Set up to write data without interacting with the latches. 00251 // 00252 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00253 MAKEWORD(IND_DATA_ROTATE, DR_SET)); 00254 }

VOID GetHardwareScrollReg PDEVICE_EXTENSION  deviceExtension  ) 
 

Definition at line 31 of file port.c.

References CRTCAddressPortColor, CRTCDataPortColor, _DEVICE_EXTENSION::DeviceRegisters, _DEVICE_EXTENSION::EmulateInfo, high, IND_LINE_COMPARE, IND_LINE_COMPARE8, IND_LINE_COMPARE9, IND_START_ADRS_H, IND_START_ADRS_L, _EMULATE_BUFFER_INFORMATION::LineCompare, low, and _EMULATE_BUFFER_INFORMATION::StartAddress.

Referenced by FsgVgaInitializeHWFlags().

00037 : 00038 00039 This routine gets the hardware scrolls register value. 00040 00041 Arguments: 00042 00043 Return Value: 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 }

VOID set_opaque_bkgnd_proc PDEVICE_EXTENSION  deviceExtension,
PUCHAR  FrameBuffer,
WORD  Attributes
 

Definition at line 186 of file port.c.

References BYTE, _EMULATE_BUFFER_INFORMATION::ColorBg, _EMULATE_BUFFER_INFORMATION::ColorFg, ColorSetDirect(), _DEVICE_EXTENSION::EmulateInfo, and LOBYTE.

Referenced by FsgWriteToScreen(), and FsgWriteToScreenCommonLVB().

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 }

VOID SetGRAMCopyMode PDEVICE_EXTENSION  deviceExtension  ) 
 

Definition at line 121 of file port.c.

References _DEVICE_EXTENSION::DeviceRegisters, DR_SET, GRAPHAddressPort, IND_COLOR_DONT_CARE, IND_DATA_ROTATE, IND_GRAPH_MODE, M_COLOR_READ, and M_LATCH_WRITE.

Referenced by MoveGRAM().

00127 : 00128 00129 This routine sets the copy mode of graphics register. 00130 00131 Arguments: 00132 00133 Return Value: 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 // Set up to write data without interacting with the latches. 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 }

VOID SetGRAMInvertMode PDEVICE_EXTENSION  deviceExtension  ) 
 

Definition at line 152 of file port.c.

References BIT_MASK_DEFAULT, _DEVICE_EXTENSION::DeviceRegisters, DR_XOR, GRAPHAddressPort, IND_BIT_MASK, IND_COLOR_DONT_CARE, IND_DATA_ROTATE, IND_GRAPH_MODE, IND_SET_RESET, M_AND_WRITE, and M_COLOR_READ.

Referenced by FsgInvertCursor(), and FsgReverseMousePointer().

00158 : 00159 00160 This routine sets the invert mode of graphics register. 00161 00162 Arguments: 00163 00164 Return Value: 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 }

VOID SetGRAMWriteMode PDEVICE_EXTENSION  deviceExtension  ) 
 

Definition at line 81 of file port.c.

References BIT_MASK_DEFAULT, _DEVICE_EXTENSION::DeviceRegisters, DR_SET, GRAPH_ADDR_MASK, GRAPHAddressPort, IND_BIT_MASK, IND_DATA_ROTATE, IND_GRAPH_MODE, IND_MAP_MASK, M_DATA_READ, M_PROC_WRITE, and SEQUAddressPort.

Referenced by FsgInvertCursor(), FsgReverseMousePointer(), FsgVgaInitializeHWFlags(), FsgWriteToScreenCommonLVB(), and MoveGRAM().

00087 : 00088 00089 This routine sets the write mode of graphics register. 00090 00091 Arguments: 00092 00093 Return Value: 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 // Set up to write data without interacting with the latches. 00103 // 00104 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00105 MAKEWORD(IND_DATA_ROTATE, DR_SET)); 00106 00107 // 00108 // Enable all the available EGA planes. 00109 // 00110 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[SEQUAddressPort], 00111 MAKEWORD(IND_MAP_MASK, GRAPH_ADDR_MASK)); 00112 // 00113 // Use all pixel positions. 00114 // 00115 WRITE_PORT_USHORT(deviceExtension->DeviceRegisters[GRAPHAddressPort], 00116 MAKEWORD(IND_BIT_MASK, BIT_MASK_DEFAULT)); 00117 00118 }


Generated on Sat May 15 19:45:17 2004 for test by doxygen 1.3.7