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 #define COMMON_LVB_MASK (COMMON_LVB_GRID_HORIZONTAL | \
00030
COMMON_LVB_GRID_LVERTICAL | \
00031
COMMON_LVB_GRID_RVERTICAL | \
00032
COMMON_LVB_REVERSE_VIDEO | \
00033
COMMON_LVB_UNDERSCORE )
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define CalcGRAMScanLine(WindowY,FontSizeY) \
00048
(WindowY * FontSizeY)
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 #define CalcGRAMOffs(WindowSize,DeviceExtension) \
00062
(DeviceExtension->EmulateInfo.StartAddress + \
00063
CalcGRAMSize(WindowSize,DeviceExtension) \
00064
)
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #define GetBytePerLine(DeviceExtension) \
00077
((DeviceExtension->Configuration.HardwareScroll & OFFSET_128_TO_NEXT_SLICE) ? \
00078
(1024 / 8) : \
00079
(640 / 8) \
00080
)
00081
00082
00083
00084 ULONG
00085 CalcGRAMSize(
00086 IN COORD WindowSize,
00087 IN
PDEVICE_EXTENSION DeviceExtension
00088 )
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 {
00109
return WindowSize.X +
00110
CalcGRAMScanLine(WindowSize.Y, DeviceExtension->ScreenAndFont.FontSize.Y) *
00111 DeviceExtension->EmulateInfo.BytePerLine;
00112 }
00113
00114
00115 PUCHAR
00116 CalcGRAMAddress(
00117 IN COORD WindowSize,
00118 IN
PDEVICE_EXTENSION DeviceExtension
00119 )
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 {
00139 PUCHAR BufPtr = (PUCHAR)DeviceExtension->CurrentMode.VideoMemory.FrameBufferBase;
00140
00141 BufPtr +=
CalcGRAMOffs(WindowSize, DeviceExtension);
00142
if ((
DWORD)(BufPtr -
00143 (PUCHAR)DeviceExtension->CurrentMode.VideoMemory.FrameBufferBase)
00144 >= DeviceExtension->EmulateInfo.LimitGRAM)
00145
return (BufPtr - DeviceExtension->EmulateInfo.LimitGRAM);
00146
else
00147
return BufPtr;
00148 }
00149
00150
00151
BOOL
00152 IsGRAMRowOver(
00153 PUCHAR BufPtr,
00154 BOOL fDbcs,
00155
PDEVICE_EXTENSION DeviceExtension
00156 )
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176 {
00177
if (fDbcs)
00178 {
00179
if ((
DWORD)(BufPtr + 1 +
00180 DeviceExtension->
EmulateInfo.
DeltaNextFontRow -
00181 (PUCHAR)DeviceExtension->
CurrentMode.VideoMemory.FrameBufferBase)
00182 >= DeviceExtension->
EmulateInfo.
LimitGRAM)
00183
return TRUE;
00184
else
00185
return FALSE;
00186 }
00187
else
00188 {
00189
if ((
DWORD)(BufPtr +
00190 DeviceExtension->
EmulateInfo.
DeltaNextFontRow -
00191 (PUCHAR)DeviceExtension->
CurrentMode.VideoMemory.FrameBufferBase)
00192 >= DeviceExtension->
EmulateInfo.
LimitGRAM)
00193
return TRUE;
00194
else
00195
return FALSE;
00196 }
00197 }
00198
00199 PUCHAR
00200 NextGRAMRow(
00201 PUCHAR BufPtr,
00202
PDEVICE_EXTENSION DeviceExtension
00203 )
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 {
00221
if ((
DWORD)(BufPtr +
00222 DeviceExtension->
EmulateInfo.
BytePerLine -
00223 (PUCHAR)DeviceExtension->
CurrentMode.VideoMemory.FrameBufferBase)
00224 >= DeviceExtension->
EmulateInfo.
LimitGRAM)
00225
return (BufPtr +
00226 DeviceExtension->
EmulateInfo.
BytePerLine -
00227 DeviceExtension->
EmulateInfo.
LimitGRAM);
00228
else
00229
return (BufPtr + DeviceExtension->
EmulateInfo.
BytePerLine);
00230 }
00231
00232
VOID
00233 memcpyGRAM(
00234 IN PCHAR TargetPtr,
00235 IN PCHAR SourcePtr,
00236 IN ULONG Length
00237 )
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257 {
00258
while (Length--)
00259 *TargetPtr++ = *SourcePtr++;
00260 }
00261
00262
VOID
00263 memcpyGRAMOver(
00264 IN PCHAR TargetPtr,
00265 IN PCHAR SourcePtr,
00266 IN ULONG Length,
00267 IN PUCHAR FrameBufPtr,
00268 IN
PDEVICE_EXTENSION DeviceExtension
00269 )
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289 {
00290 ULONG tmpLen;
00291
00292
if ((
DWORD)(SourcePtr + Length - FrameBufPtr) >= DeviceExtension->EmulateInfo.LimitGRAM) {
00293 tmpLen = DeviceExtension->EmulateInfo.LimitGRAM - (SourcePtr - FrameBufPtr);
00294
memcpyGRAM(TargetPtr, SourcePtr, tmpLen);
00295 TargetPtr += tmpLen;
00296 Length -= tmpLen;
00297 SourcePtr = FrameBufPtr;
00298 }
00299
00300
if ((
DWORD)(TargetPtr + Length - FrameBufPtr) >= DeviceExtension->EmulateInfo.LimitGRAM) {
00301 tmpLen = DeviceExtension->EmulateInfo.LimitGRAM - (TargetPtr - FrameBufPtr);
00302
memcpyGRAM(TargetPtr, SourcePtr, tmpLen);
00303 SourcePtr += tmpLen;
00304 Length -= tmpLen;
00305 TargetPtr = FrameBufPtr;
00306 }
00307
00308
if (Length) {
00309
memcpyGRAM(TargetPtr, SourcePtr, Length);
00310 }
00311 }
00312
00313
VOID
00314 MoveGRAM(
00315 IN PCHAR TargetPtr,
00316 IN PCHAR SourcePtr,
00317 IN ULONG Length,
00318 IN PUCHAR FrameBufPtr,
00319 IN
PDEVICE_EXTENSION DeviceExtension
00320 )
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341 {
00342 PCHAR tmpSrc;
00343 PCHAR tmpTrg;
00344 ULONG tmpLen;
00345
00346
00347
00348
00349
00350
SetGRAMCopyMode(DeviceExtension);
00351
00352
if ((
DWORD)(SourcePtr + Length - FrameBufPtr) >= DeviceExtension->EmulateInfo.LimitGRAM ||
00353 (
DWORD)(TargetPtr + Length - FrameBufPtr) >= DeviceExtension->EmulateInfo.LimitGRAM ) {
00354
if (SourcePtr > TargetPtr) {
00355
memcpyGRAMOver(TargetPtr,SourcePtr,Length,FrameBufPtr,DeviceExtension);
00356 }
00357
else if ((ULONG)(TargetPtr - SourcePtr) >= Length) {
00358
memcpyGRAMOver(TargetPtr,SourcePtr,Length,FrameBufPtr,DeviceExtension);
00359 }
00360
else {
00361
if ((
DWORD)(SourcePtr + Length - FrameBufPtr) >= DeviceExtension->EmulateInfo.LimitGRAM) {
00362 tmpLen = SourcePtr + Length - FrameBufPtr - DeviceExtension->EmulateInfo.LimitGRAM;
00363 tmpTrg = TargetPtr + Length - tmpLen - DeviceExtension->EmulateInfo.LimitGRAM;
00364
memcpyGRAM(tmpTrg, FrameBufPtr, tmpLen);
00365 Length -= tmpLen;
00366 }
00367
if ((
DWORD)(TargetPtr + Length - FrameBufPtr) >= DeviceExtension->EmulateInfo.LimitGRAM) {
00368 tmpLen = TargetPtr + Length - FrameBufPtr - DeviceExtension->EmulateInfo.LimitGRAM;
00369 tmpSrc = SourcePtr + Length - tmpLen;
00370
memcpyGRAM(FrameBufPtr, tmpSrc, tmpLen);
00371 Length -= tmpLen;
00372 }
00373
if (Length) {
00374
memcpyGRAM(TargetPtr, SourcePtr, Length);
00375 }
00376 }
00377 }
00378
else {
00379
memcpyGRAM(TargetPtr, SourcePtr, Length);
00380 }
00381
00382
SetGRAMWriteMode(DeviceExtension);
00383 }
00384
00385
00386
NTSTATUS
00387 FsgVgaInitializeHWFlags(
00388
PDEVICE_EXTENSION DeviceExtension
00389 )
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405 {
00406 ULONG
Index;
00407
00408
GetHardwareScrollReg(DeviceExtension);
00409 DeviceExtension->
EmulateInfo.
BytePerLine =
00410 (WORD)
GetBytePerLine(DeviceExtension);
00411 DeviceExtension->
EmulateInfo.
MaxScanLine =
00412 (WORD)
CalcGRAMScanLine(DeviceExtension->
ScreenAndFont.ScreenSize.Y,
00413 DeviceExtension->
ScreenAndFont.FontSize.Y);
00414 DeviceExtension->
EmulateInfo.
DeltaNextFontRow =
00415 DeviceExtension->
EmulateInfo.
BytePerLine * DeviceExtension->
ScreenAndFont.FontSize.Y;
00416
00417
if (DeviceExtension->
Configuration.
HardwareScroll &
USE_LINE_COMPARE) {
00418 DeviceExtension->
EmulateInfo.
LimitGRAM =
00419 DeviceExtension->
EmulateInfo.
MaxScanLine * DeviceExtension->
EmulateInfo.
BytePerLine;
00420 }
00421
else {
00422 DeviceExtension->
EmulateInfo.
LimitGRAM =
LIMIT_64K;
00423 }
00424
00425 DeviceExtension->
EmulateInfo.
ColorFg = (
BYTE)-1;
00426 DeviceExtension->
EmulateInfo.
ColorBg = (
BYTE)-1;
00427
00428 DeviceExtension->
EmulateInfo.
CursorAttributes.Enable = 0;
00429 DeviceExtension->
EmulateInfo.
ShowCursor =
FALSE;
00430
00431
SetGRAMWriteMode(DeviceExtension);
00432
00433
return STATUS_SUCCESS;
00434 }
00435
00436
NTSTATUS
00437 FsgCopyFrameBuffer(
00438
PDEVICE_EXTENSION DeviceExtension,
00439 PFSVIDEO_COPY_FRAME_BUFFER CopyFrameBuffer,
00440 ULONG inputBufferLength
00441 )
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466 {
00467 PUCHAR SourcePtr, TargetPtr;
00468
00469
FsgInvertCursor(DeviceExtension,
FALSE);
00470
00471 SourcePtr =
CalcGRAMAddress (CopyFrameBuffer->SrcScreen.Position,
00472 DeviceExtension);
00473 TargetPtr =
CalcGRAMAddress (CopyFrameBuffer->DestScreen.Position,
00474 DeviceExtension);
00475
MoveGRAM (TargetPtr,
00476 SourcePtr,
00477 CopyFrameBuffer->SrcScreen.nNumberOfChars *
00478 DeviceExtension->
ScreenAndFont.FontSize.Y,
00479 DeviceExtension->
CurrentMode.VideoMemory.FrameBufferBase,
00480 DeviceExtension
00481 );
00482
00483
FsgInvertCursor(DeviceExtension,
TRUE);
00484
00485
return STATUS_SUCCESS;
00486 }
00487
00488
NTSTATUS
00489 FsgWriteToFrameBuffer(
00490
PDEVICE_EXTENSION DeviceExtension,
00491 PFSVIDEO_WRITE_TO_FRAME_BUFFER WriteFrameBuffer,
00492 ULONG inputBufferLength
00493 )
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518 {
00519 PCHAR_IMAGE_INFO pCharInfoUni = WriteFrameBuffer->SrcBuffer;
00520 PUCHAR TargetPtr;
00521 COORD Position = WriteFrameBuffer->DestScreen.Position;
00522
DWORD Length = WriteFrameBuffer->DestScreen.nNumberOfChars;
00523 COORD FontSize1 = DeviceExtension->
ScreenAndFont.FontSize;
00524 COORD FontSize2;
00525 PVOID pCapBuffer =
NULL;
00526 ULONG cCapBuffer = 0;
00527
BOOL fDbcs;
00528
NTSTATUS Status;
00529
00530
FsgInvertCursor(DeviceExtension,
FALSE);
00531
00532 DeviceExtension->
EmulateInfo.
ColorFg = (
BYTE)-1;
00533 DeviceExtension->
EmulateInfo.
ColorBg = (
BYTE)-1;
00534
00535 FontSize2 = FontSize1;
00536 FontSize2.X *= 2;
00537 cCapBuffer =
CalcBitmapBufferSize(FontSize2,
BYTE_ALIGN);
00538 pCapBuffer =
ExAllocatePool(
PagedPool, cCapBuffer);
00539
00540
while (Length--)
00541 {
00542
if (pCharInfoUni->FontImageInfo.ImageBits !=
NULL)
00543 {
00544
try
00545 {
00546 fDbcs = pCharInfoUni->CharInfo.Attributes & COMMON_LVB_SBCSDBCS;
00547
AlignCopyMemory((PVOID)pCapBuffer,
00548
BYTE_ALIGN,
00549 pCharInfoUni->FontImageInfo.ImageBits,
00550
WORD_ALIGN,
00551 fDbcs ? FontSize2 : FontSize1);
00552
00553 TargetPtr =
CalcGRAMAddress (Position,
00554 DeviceExtension);
00555
if (fDbcs)
00556 {
00557
if (Length)
00558 {
00559
FsgWriteToScreen(TargetPtr, pCapBuffer, 2, fDbcs,
00560 pCharInfoUni->CharInfo.Attributes,
00561 (pCharInfoUni+1)->CharInfo.Attributes,
00562 DeviceExtension);
00563 }
00564
else
00565 {
00566
FsgWriteToScreen(TargetPtr, pCapBuffer, 2,
FALSE,
00567 pCharInfoUni->CharInfo.Attributes,
00568 (WORD)-1,
00569 DeviceExtension);
00570 }
00571 }
00572
else
00573 {
00574
FsgWriteToScreen(TargetPtr, pCapBuffer, 1, fDbcs,
00575 pCharInfoUni->CharInfo.Attributes,
00576 (WORD)-1,
00577 DeviceExtension);
00578 }
00579
00580 }
00581 except (
EXCEPTION_EXECUTE_HANDLER)
00582 {
00583 }
00584
00585 }
00586
00587
if (fDbcs && Length)
00588 {
00589 Length--;
00590 Position.X += 2;
00591 pCharInfoUni += 2;
00592 }
00593
else
00594 {
00595 Position.X++;
00596 pCharInfoUni++;
00597 }
00598 }
00599
00600
FsgInvertCursor(DeviceExtension,
TRUE);
00601
00602
if (pCapBuffer !=
NULL)
00603
ExFreePool(pCapBuffer);
00604
00605
return STATUS_SUCCESS;
00606 }
00607
00608
NTSTATUS
00609 FsgReverseMousePointer(
00610
PDEVICE_EXTENSION DeviceExtension,
00611 PFSVIDEO_REVERSE_MOUSE_POINTER MouseBuffer,
00612 ULONG inputBufferLength
00613 )
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638 {
00639
00640 PUCHAR CurFrameBufPtr;
00641 COORD CursorPosition;
00642 COORD FontSize;
00643
SHORT i;
00644
BOOL fOneMore =
FALSE;
00645
00646
FsgInvertCursor(DeviceExtension,
FALSE);
00647
00648 FontSize = DeviceExtension->
ScreenAndFont.FontSize;
00649
00650 CursorPosition.X = MouseBuffer->Screen.Position.X;
00651 CursorPosition.Y = MouseBuffer->Screen.Position.Y;
00652
if ( (0 <= CursorPosition.X &&
00653 CursorPosition.X < MouseBuffer->Screen.ScreenSize.X) &&
00654 (0 <= CursorPosition.Y &&
00655 CursorPosition.Y < MouseBuffer->Screen.ScreenSize.Y) )
00656 {
00657
switch (MouseBuffer->dwType)
00658 {
00659
case CHAR_TYPE_LEADING:
00660
if (CursorPosition.X != MouseBuffer->Screen.ScreenSize.X-1)
00661 {
00662 fOneMore =
TRUE;
00663 }
00664
break;
00665
case CHAR_TYPE_TRAILING:
00666
if (CursorPosition.X != 0)
00667 {
00668 fOneMore =
TRUE;
00669 CursorPosition.X--;
00670 }
00671
break;
00672 }
00673
00674 CurFrameBufPtr =
CalcGRAMAddress (CursorPosition,
00675 DeviceExtension);
00676
00677
00678
00679
00680
SetGRAMInvertMode(DeviceExtension);
00681
00682
00683
00684
00685
for (i=0 ; i < FontSize.Y; i++)
00686 {
00687
AccessGRAM_AND(CurFrameBufPtr, (
BYTE)-1);
00688
if (fOneMore)
00689
AccessGRAM_AND(CurFrameBufPtr+1, (
BYTE)-1);
00690 CurFrameBufPtr =
NextGRAMRow(CurFrameBufPtr,DeviceExtension);
00691 }
00692
00693
SetGRAMWriteMode(DeviceExtension);
00694 }
00695
00696
FsgInvertCursor(DeviceExtension,
TRUE);
00697
00698
return STATUS_SUCCESS;
00699 }
00700
00701
NTSTATUS
00702 FsgInvertCursor(
00703
PDEVICE_EXTENSION DeviceExtension,
00704 BOOL Invert
00705 )
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728 {
00729 PUCHAR CurFrameBufPtr;
00730 COORD CursorPosition;
00731 COORD FontSize;
00732
SHORT i;
00733
SHORT TopScanLine;
00734
BOOL fOneMore =
FALSE;
00735
00736
if (DeviceExtension->
EmulateInfo.
ShowCursor == Invert)
00737
return STATUS_SUCCESS;
00738
00739 DeviceExtension->
EmulateInfo.
ShowCursor = Invert;
00740
00741
if (!(DeviceExtension->
EmulateInfo.
CursorAttributes.Enable))
00742
return STATUS_SUCCESS;
00743
00744 FontSize = DeviceExtension->
ScreenAndFont.FontSize;
00745
if (DeviceExtension->
ScreenAndFont.ScreenSize.Y > 25)
00746 {
00747 TopScanLine = ((DeviceExtension->
EmulateInfo.
CursorAttributes.Height + 8) * 100 / 8) - 100;
00748 }
00749
else
00750 {
00751 TopScanLine = ((DeviceExtension->
EmulateInfo.
CursorAttributes.Height + 16) * 100 / 16) - 100;
00752 }
00753 TopScanLine = (FontSize.Y * TopScanLine) / 100;
00754
00755 CursorPosition.X = DeviceExtension->
EmulateInfo.
CursorPosition.Coord.Column;
00756 CursorPosition.Y = DeviceExtension->
EmulateInfo.
CursorPosition.Coord.Row;
00757
if ( (0 <= CursorPosition.X &&
00758 CursorPosition.X < DeviceExtension->
ScreenAndFont.ScreenSize.X) &&
00759 (0 <= CursorPosition.Y &&
00760 CursorPosition.Y < DeviceExtension->
ScreenAndFont.ScreenSize.Y) )
00761 {
00762
switch (DeviceExtension->
EmulateInfo.
CursorPosition.dwType)
00763 {
00764
case CHAR_TYPE_LEADING:
00765
if (CursorPosition.X != DeviceExtension->
ScreenAndFont.ScreenSize.X-1)
00766 {
00767 fOneMore =
TRUE;
00768 }
00769
break;
00770
case CHAR_TYPE_TRAILING:
00771
if (CursorPosition.X != 0)
00772 {
00773 fOneMore =
TRUE;
00774 CursorPosition.X--;
00775 }
00776
break;
00777 }
00778
00779 CurFrameBufPtr =
CalcGRAMAddress (CursorPosition,
00780 DeviceExtension);
00781
00782
00783
00784
00785
for (i = 0; i < TopScanLine; i++)
00786 {
00787 CurFrameBufPtr =
NextGRAMRow(CurFrameBufPtr,DeviceExtension);
00788 }
00789
00790
00791
00792
00793
SetGRAMInvertMode(DeviceExtension);
00794
00795
00796
00797
00798
for ( ; i < FontSize.Y; i++)
00799 {
00800
AccessGRAM_AND(CurFrameBufPtr, (
BYTE)-1);
00801
if (fOneMore)
00802
AccessGRAM_AND(CurFrameBufPtr+1, (
BYTE)-1);
00803 CurFrameBufPtr =
NextGRAMRow(CurFrameBufPtr,DeviceExtension);
00804 }
00805
00806
SetGRAMWriteMode(DeviceExtension);
00807 }
00808
00809
return STATUS_SUCCESS;
00810 }
00811
00812
NTSTATUS
00813 FsgWriteToScreen(
00814 PUCHAR FrameBuffer,
00815 PUCHAR BitmapBuffer,
00816 DWORD cjBytes,
00817 BOOL fDbcs,
00818 WORD Attributes1,
00819 WORD Attributes2,
00820
PDEVICE_EXTENSION DeviceExtension
00821 )
00822 {
00823 WORD
Index;
00824 PCHAR CurFrameBufPtrTmp;
00825 PCHAR CurFrameBufPtr2nd;
00826 PWORD CurFrameBufPtrWord;
00827 PUCHAR BitmapBufferTmp;
00828
00829
#ifdef LATER_HIGH_SPPED_VRAM_ACCESS // kazum
00830
if (!
IsGRAMRowOver(FrameBuffer,fDBCS,DeviceExtension)) {
00831
if (!fDbcs) {
00832
if (cjBytes == 2)
00833 BitmapBuffer++;
00834 (*WriteGramInfo->pfnWriteFontToByteGRAM)(WriteGramInfo);
00835 }
00836
else if (cjBytes == 2 && fDBCS) {
00837
if (DeviceExtension->
Configuration.
EmulationMode &
ENABLE_WORD_WRITE_VRAM) {
00838 (*WriteGramInfo->pfnWriteFontToFirstWordGRAM)(WriteGramInfo);
00839 }
00840
else {
00841 (*WriteGramInfo->pfnWriteFontToWordGRAM)(WriteGramInfo);
00842 }
00843 }
00844 }
00845
else
00846
#endif // LATER_HIGH_SPPED_VRAM_ACCESS // kazum
00847
try
00848 {
00849
set_opaque_bkgnd_proc(DeviceExtension,FrameBuffer,Attributes1);
00850
00851
if (!fDbcs) {
00852 CurFrameBufPtrTmp = FrameBuffer;
00853
if (cjBytes == 2)
00854 BitmapBuffer++;
00855
for (
Index=0;
Index < DeviceExtension->
ScreenAndFont.FontSize.Y;
Index++) {
00856 *CurFrameBufPtrTmp = *BitmapBuffer;
00857 BitmapBuffer += cjBytes;
00858 CurFrameBufPtrTmp=
NextGRAMRow(CurFrameBufPtrTmp,DeviceExtension);
00859 }
00860 }
00861
else if (cjBytes == 2 && fDbcs) {
00862
if ((DeviceExtension->
Configuration.
EmulationMode &
ENABLE_WORD_WRITE_VRAM) &&
00863 !((ULONG)FrameBuffer & 1) &&
00864 (Attributes2 != -1) &&
00865 (Attributes1 == Attributes2)
00866 ) {
00867 CurFrameBufPtrWord = (PWORD)FrameBuffer;
00868
for (
Index=0;
Index < DeviceExtension->
ScreenAndFont.FontSize.Y;
Index++) {
00869 *CurFrameBufPtrWord = *((PWORD)BitmapBuffer);
00870 BitmapBuffer += cjBytes;
00871 CurFrameBufPtrWord=(PWORD)
NextGRAMRow((PCHAR)CurFrameBufPtrWord,DeviceExtension);
00872 }
00873 }
00874
else {
00875 CurFrameBufPtrTmp = FrameBuffer;
00876 CurFrameBufPtr2nd = FrameBuffer + 1;
00877 BitmapBufferTmp = BitmapBuffer + 1;
00878
for (
Index=0;
Index < DeviceExtension->
ScreenAndFont.FontSize.Y;
Index++) {
00879 *CurFrameBufPtrTmp = *BitmapBuffer;
00880 BitmapBuffer += cjBytes;
00881 CurFrameBufPtrTmp=
NextGRAMRow(CurFrameBufPtrTmp,DeviceExtension);
00882 }
00883
if (Attributes2 != -1 &&
00884 Attributes1 != Attributes2)
00885
set_opaque_bkgnd_proc(DeviceExtension,FrameBuffer,Attributes2);
00886
for (
Index=0;
Index < DeviceExtension->
ScreenAndFont.FontSize.Y;
Index++) {
00887 *CurFrameBufPtr2nd = *BitmapBufferTmp;
00888 BitmapBufferTmp += cjBytes;
00889 CurFrameBufPtr2nd=
NextGRAMRow(CurFrameBufPtr2nd,DeviceExtension);
00890 }
00891 }
00892 }
00893 }
00894 except (
EXCEPTION_EXECUTE_HANDLER)
00895 {
00896 }
00897
00898
if (Attributes1 &
COMMON_LVB_MASK)
00899 {
00900
FsgWriteToScreenCommonLVB(FrameBuffer,
00901 Attributes1,
00902 DeviceExtension);
00903 }
00904
if ((Attributes2 != (WORD)-1) && (Attributes2 &
COMMON_LVB_MASK))
00905 {
00906
FsgWriteToScreenCommonLVB(FrameBuffer+1,
00907 Attributes2,
00908 DeviceExtension);
00909 }
00910
00911
return STATUS_SUCCESS;
00912 }
00913
00914
NTSTATUS
00915 FsgWriteToScreenCommonLVB(
00916 PUCHAR FrameBuffer,
00917 WORD Attributes,
00918
PDEVICE_EXTENSION DeviceExtension
00919 )
00920 {
00921 WORD
Index;
00922 PUCHAR CurFrameBufPtrTmp;
00923
00924
try
00925 {
00926
if (Attributes & COMMON_LVB_UNDERSCORE)
00927 {
00928
set_opaque_bkgnd_proc(DeviceExtension,FrameBuffer,Attributes);
00929 CurFrameBufPtrTmp = FrameBuffer;
00930
for (
Index=0;
Index < DeviceExtension->
ScreenAndFont.FontSize.Y - 1;
Index++)
00931 CurFrameBufPtrTmp=
NextGRAMRow(CurFrameBufPtrTmp,DeviceExtension);
00932 *CurFrameBufPtrTmp = 0xff;
00933 }
00934
00935
if (Attributes & COMMON_LVB_GRID_HORIZONTAL)
00936 {
00937
ColorSetDirect(DeviceExtension, FrameBuffer,
00938 FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED,
00939 0);
00940 *FrameBuffer = 0xff;
00941 }
00942
00943
if ( (Attributes & COMMON_LVB_GRID_LVERTICAL) ||
00944 (Attributes & COMMON_LVB_GRID_RVERTICAL) )
00945 {
00946
BYTE mask = ((Attributes & COMMON_LVB_GRID_LVERTICAL) ? 0x80 : 0) +
00947 ((Attributes & COMMON_LVB_GRID_RVERTICAL) ? 0x01 : 0);
00948
ColorSetGridMask(DeviceExtension,
00949 mask
00950 );
00951 CurFrameBufPtrTmp = FrameBuffer;
00952
for (
Index=0;
Index < DeviceExtension->
ScreenAndFont.FontSize.Y;
Index++) {
00953
AccessGRAM_RW(CurFrameBufPtrTmp, mask);
00954 CurFrameBufPtrTmp=
NextGRAMRow(CurFrameBufPtrTmp,DeviceExtension);
00955 }
00956
00957
SetGRAMWriteMode(DeviceExtension);
00958 }
00959
00960 DeviceExtension->
EmulateInfo.
ColorFg = (
BYTE)-1;
00961 DeviceExtension->
EmulateInfo.
ColorBg = (
BYTE)-1;
00962
00963 }
00964 except (
EXCEPTION_EXECUTE_HANDLER)
00965 {
00966 }
00967
00968
return STATUS_SUCCESS;
00969 }
00970
00971
#pragma optimize("",off)
00972
00973
00974
00975 UCHAR
00976 AccessGRAM_WR(
00977 PUCHAR FrameBuffer,
00978 UCHAR write
00979 )
00980 {
00981 *FrameBuffer = write;
00982
return *FrameBuffer;
00983 }
00984
00985 UCHAR
00986 AccessGRAM_RW(
00987 PUCHAR FrameBuffer,
00988 UCHAR write
00989 )
00990 {
00991 UCHAR tmp;
00992 tmp = *FrameBuffer;
00993 *FrameBuffer = write;
00994
return tmp;
00995 }
00996
00997 UCHAR
00998 AccessGRAM_AND(
00999 PUCHAR FrameBuffer,
01000 UCHAR write
01001 )
01002 {
01003
return *FrameBuffer &= write;
01004 }
01005
#pragma optimize("",on)