Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

283 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. dndisp.c
  5. Abstract:
  6. DOS-based NT setup program video display routines.
  7. Author:
  8. Ted Miller (tedm) 30-March-1992
  9. Revision History:
  10. --*/
  11. #include "enduser.h"
  12. #define SCREEN_TOP_SCANLINE 80
  13. #define SCREEN_WIDTH 80
  14. #define SCREEN_HEIGHT 25
  15. BYTE CurrentPixelValue;
  16. BYTE LeftMargin;
  17. BYTE ScreenX;
  18. BYTE ScreenY;
  19. BYTE CharWidth;
  20. BYTE CharHeight;
  21. FPCHAR BannerBitmap;
  22. VOID
  23. DispInitialize(
  24. VOID
  25. )
  26. /*++
  27. Routine Description:
  28. Put the display in a known state and initialize
  29. the display package.
  30. Arguments:
  31. None.
  32. Return Value:
  33. None.
  34. --*/
  35. {
  36. VgaInit(); // this clears the screen
  37. FontGetInfo(&CharWidth,&CharHeight);
  38. DispClearClientArea(NULL);
  39. DispSetLeftMargin(TEXT_LEFT_MARGIN);
  40. DispPositionCursor(TEXT_LEFT_MARGIN,TEXT_TOP_LINE);
  41. CurrentPixelValue = DEFAULT_TEXT_PIXEL_VALUE;
  42. }
  43. VOID
  44. DispReinitialize(
  45. VOID
  46. )
  47. {
  48. FontGetInfo(&CharWidth,&CharHeight);
  49. }
  50. VOID
  51. DispSetCurrentPixelValue(
  52. IN BYTE PixelValue
  53. )
  54. {
  55. CurrentPixelValue = PixelValue;
  56. }
  57. FPVOID
  58. DispSaveDescriptionArea(
  59. OUT USHORT *SaveTop,
  60. OUT USHORT *SaveHeight,
  61. OUT USHORT *SaveBytesPerRow,
  62. OUT USHORT *DescriptionTop
  63. )
  64. {
  65. *DescriptionTop = (CharHeight > 12) ? 16 : 25;
  66. *SaveHeight = CharHeight * 5;
  67. *SaveTop = (*DescriptionTop * CharHeight) + SCREEN_TOP_SCANLINE;
  68. return(VgaSaveBlock(0,*SaveTop,640,*SaveHeight,SaveBytesPerRow));
  69. }
  70. VOID
  71. DispSetLeftMargin(
  72. IN BYTE X
  73. )
  74. {
  75. LeftMargin = X;
  76. }
  77. VOID
  78. DispClearClientArea(
  79. IN FPCHAR NewBannerBitmap OPTIONAL
  80. )
  81. /*++
  82. Routine Description:
  83. Clear the client area of the screen, ie, the area between the header
  84. and status line. We do this by restoring the background and banner
  85. bitmaps.
  86. Arguments:
  87. None.
  88. Return Value:
  89. None.
  90. --*/
  91. {
  92. if(NewBannerBitmap) {
  93. BannerBitmap = strdup(NewBannerBitmap);
  94. }
  95. VgaDisplayBitmapFromFile("backgrnd.bmp",0,0,IoBuffer,63*512);
  96. redisplay:
  97. if(!VgaDisplayBitmapFromFile(BannerBitmap ? BannerBitmap : "enduser.bmp",0,0,IoBuffer,63*512)) {
  98. //
  99. // File might not exist
  100. //
  101. if(BannerBitmap) {
  102. free(BannerBitmap);
  103. BannerBitmap = NULL;
  104. goto redisplay;
  105. }
  106. }
  107. }
  108. VOID
  109. DispPositionCursor(
  110. IN BYTE X,
  111. IN BYTE Y
  112. )
  113. /*++
  114. Routine Description:
  115. Position the cursor.
  116. Arguments:
  117. X,Y - cursor coords
  118. Return Value:
  119. None.
  120. --*/
  121. {
  122. if(X >= SCREEN_WIDTH) {
  123. X = 0;
  124. Y++;
  125. }
  126. if(Y >= SCREEN_HEIGHT) {
  127. Y = 0;
  128. }
  129. ScreenX = X;
  130. ScreenY = Y;
  131. }
  132. VOID
  133. DispGetCursorPosition(
  134. OUT FPBYTE X,
  135. OUT FPBYTE Y
  136. )
  137. {
  138. *X = ScreenX;
  139. *Y = ScreenY;
  140. }
  141. VOID
  142. DispWriteChar(
  143. IN CHAR chr
  144. )
  145. /*++
  146. Routine Description:
  147. Write a character in the current attribute at the current position.
  148. Arguments:
  149. chr - Character to write
  150. Return Value:
  151. None.
  152. --*/
  153. {
  154. if(chr == '\n') {
  155. ScreenX = LeftMargin;
  156. ScreenY++;
  157. return;
  158. }
  159. //
  160. // Output the character
  161. //
  162. FontWriteChar(
  163. chr,
  164. ScreenX * CharWidth,
  165. SCREEN_TOP_SCANLINE + (ScreenY * CharHeight),
  166. CurrentPixelValue,
  167. 16 // no background value, text is transparent
  168. );
  169. }
  170. VOID
  171. DispWriteString(
  172. IN FPCHAR String
  173. )
  174. /*++
  175. Routine Description:
  176. Write a string on the client area in the current position and
  177. adjust the current position. The string is written in the current
  178. attribute.
  179. Arguments:
  180. String - null terminated string to write.
  181. Return Value:
  182. None.
  183. --*/
  184. {
  185. FPCHAR p;
  186. for(p=String; *p; p++) {
  187. DispWriteChar(*p);
  188. if(*p != '\n') {
  189. ScreenX++;
  190. }
  191. }
  192. }