2 * BIOS interrupt 10h handler
11 static void conv_text_mode_attributes(char attribute
, int *fg
, int *bg
,
13 static void write_char_attribute_at_cursor(char output
, char page_num
,
14 char attribute
, short times
);
15 static void scroll_window(int direction
, char lines
, char row1
,
16 char col1
, char row2
, char col2
, char attribute
);
18 static int color_pallet
[16];
23 /**********************************************************************
26 * Handler for int 10h (video).
29 * Most INT 10 functions for text-mode, CGA, EGA, and VGA cards
30 * are present in this list. (SVGA and XGA are not) That is not
31 * to say that all these functions should be supported, but if
32 * anyone is braindamaged enough to want to emulate one of these
33 * beasts then this should get you started.
36 * Several common graphical extensions used by Microsoft hook
37 * off of here. I have *not* added them to this list (yet). They
40 * MSHERC.COM - More functionality for Hercules cards.
41 * EGA.SYS (also MOUSE.COM) - More for EGA cards.
43 * Yes, MS also added this support into their mouse driver. Don't
44 * ask me, I don't work for them.
46 * Joseph Pranevich - 9/98
48 /* Added support for Vesa. It is not complete but is a start.
49 * NOTE: Im not sure if i did all this right or if eny of it works.
50 * Currently i dont have a program that uses Vesa that actually gets far
51 * enough without crashing to do vesa stuff.
56 void WINAPI
INT_Int10Handler( CONTEXT
*context
)
58 static int registered_colors
= FALSE
;
59 static int video_mode
= 7;
60 static int video_columns
= 80;
62 if (!registered_colors
)
65 0000b black 1000b dark gray
66 0001b blue 1001b light blue
67 0010b green 1010b light green
68 0011b cyan 1011b light cyan
69 0100b red 1100b light red
70 0101b magenta 1101b light magenta
71 0110b brown 1110b yellow
72 0111b light gray 1111b white
75 /* These AllocColor calls have the side-effect of triggering
76 ternimal initialization as xx_Init() is no longer called on
77 startup. Which is what we want anyway. */
79 color_pallet
[0] = CONSOLE_AllocColor(WINE_BLACK
);
80 color_pallet
[1] = CONSOLE_AllocColor(WINE_BLUE
);
81 color_pallet
[2] = CONSOLE_AllocColor(WINE_GREEN
);
82 color_pallet
[3] = CONSOLE_AllocColor(WINE_CYAN
);
83 color_pallet
[4] = CONSOLE_AllocColor(WINE_RED
);
84 color_pallet
[5] = CONSOLE_AllocColor(WINE_MAGENTA
);
85 color_pallet
[6] = CONSOLE_AllocColor(WINE_BROWN
);
86 color_pallet
[7] = CONSOLE_AllocColor(WINE_LIGHT_GRAY
);
87 color_pallet
[8] = CONSOLE_AllocColor(WINE_DARK_GRAY
);
88 color_pallet
[9] = CONSOLE_AllocColor(WINE_LIGHT_BLUE
);
89 color_pallet
[10] = CONSOLE_AllocColor(WINE_LIGHT_GREEN
);
90 color_pallet
[11] = CONSOLE_AllocColor(WINE_LIGHT_CYAN
);
91 color_pallet
[12] = CONSOLE_AllocColor(WINE_LIGHT_RED
);
92 color_pallet
[13] = CONSOLE_AllocColor(WINE_LIGHT_MAGENTA
);
93 color_pallet
[14] = CONSOLE_AllocColor(WINE_YELLOW
);
94 color_pallet
[15] = CONSOLE_AllocColor(WINE_WHITE
);
96 registered_colors
= TRUE
;
99 if(AL_reg(context
) == 0x4F) { /* VESA functions */
100 switch(AH_reg(context
)) {
102 case 0x00: /* GET SuperVGA INFORMATION */
103 FIXME(int10
, "Vesa Get SuperVGA Info STUB!\n");
104 AL_reg(context
) = 0x4f;
105 AH_reg(context
) = 0x01; /* 0x01=failed 0x00=succesful */
107 case 0x01: /* GET SuperVGA MODE INFORMATION */
108 FIXME(int10
, "VESA GET SuperVGA Mode Information - Not supported\n");
109 AL_reg(context
) = 0x4f;
110 AH_reg(context
) = 0x01; /* 0x00 = successful 0x01 = failed */
112 case 0x02: /* SET SuperVGA VIDEO MODE */
113 switch(BX_reg(context
)) {
114 /* OEM Video Modes */
115 case 0x00: /* 40x25 */
118 TRACE(int10
, "Set Video Mode - Set to Text - 0x0%x\n",
120 CONSOLE_ResizeScreen(40, 25);
121 CONSOLE_ClearScreen();
128 TRACE(int10
, "Set Video Mode - Set to Text - 0x0%x\n",
130 CONSOLE_ResizeScreen(80, 25);
131 CONSOLE_ClearScreen();
135 TRACE(int10
, "Setting VESA 320x200 256-color mode\n");
136 VGA_SetMode(320,200,8);
140 TRACE(int10
, "Setting VESA 640x400 256-color mode\n");
141 VGA_SetMode(640,400,8);
144 TRACE(int10
, "Setting VESA 640x480 256-color mode\n");
145 VGA_SetMode(640,480,8);
148 TRACE(int10
, "Setting VESA 800x600 16-color mode\n");
149 VGA_SetMode(800,600,4);
152 TRACE(int10
, "Setting VESA 800x600 256-color mode\n");
153 VGA_SetMode(800,600,8);
156 TRACE(int10
, "Setting VESA 1024x768 16-color mode\n");
157 VGA_SetMode(1024,768,4);
160 TRACE(int10
, "Setting VESA 1024x768 256-color mode\n");
161 VGA_SetMode(1024,768,8);
164 TRACE(int10
, "Setting VESA 1280x1024 16-color mode\n");
165 VGA_SetMode(1280,1024,4);
168 TRACE(int10
, "Setting VESA 1280x1024 256-color mode\n");
169 VGA_SetMode(1280,1024,8);
171 /* 108h - 10Ch are text modes and im lazy so :p */
174 TRACE(int10
, "Setting VESA 320x200 15bpp\n");
175 VGA_SetMode(320,200,15);
178 TRACE(int10
, "Setting VESA 320x200 16bpp\n");
179 VGA_SetMode(320,200,16);
182 TRACE(int10
, "Setting VESA 320x200 24bpp\n");
183 VGA_SetMode(320,200,24);
186 TRACE(int10
, "Setting VESA 640x480 15bpp\n");
187 VGA_SetMode(640,480,15);
190 TRACE(int10
, "Setting VESA 640x480 16bpp\n");
191 VGA_SetMode(640,480,16);
194 TRACE(int10
, "Setting VESA 640x480 24bpp\n");
195 VGA_SetMode(640,480,24);
198 TRACE(int10
, "Setting VESA 800x600 15bpp\n");
199 VGA_SetMode(800,600,15);
202 TRACE(int10
, "Setting VESA 800x600 16bpp\n");
203 VGA_SetMode(800,600,16);
206 TRACE(int10
, "Setting VESA 800x600 24bpp\n");
207 VGA_SetMode(800,600,24);
210 TRACE(int10
, "Setting VESA 1024x768 15bpp\n");
211 VGA_SetMode(1024,768,15);
214 TRACE(int10
, "Setting VESA 1024x768 16bpp\n");
215 VGA_SetMode(1024,768,16);
218 TRACE(int10
, "Setting VESA 1024x768 24bpp\n");
219 VGA_SetMode(1024,768,24);
222 TRACE(int10
, "Setting VESA 1280x1024 15bpp\n");
223 VGA_SetMode(1280,1024,15);
226 TRACE(int10
, "Setting VESA 1280x1024 16bpp\n");
227 VGA_SetMode(1280,1024,16);
230 TRACE(int10
, "Setting VESA 1280x1024 24bpp\n");
231 VGA_SetMode(1280,1024,24);
234 FIXME(int10
,"VESA Set Video Mode (0x%x) - Not Supported\n", BX_reg(context
));
236 video_mode
= BX_reg(context
);
237 AL_reg(context
) = 0x4f;
238 AH_reg(context
) = 0x00;
240 case 0x03: /* VESA SuperVGA BIOS - GET CURRENT VIDEO MODE */
241 AL_reg(context
) = 0x4f;
242 AH_reg(context
) = 0x00; /* should probly check if a vesa mode has ben set */
243 BX_reg(context
) = video_mode
;
245 case 0x04: /* VESA SuperVGA BIOS - SAVE/RESTORE SuperVGA VIDEO STATE */
246 ERR(int10
,"VESA SAVE/RESTORE Video State - Not Implemented\n");
247 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
248 /* maby we should do this instead ? */
249 /* AH_reg(context = 0x01; not implemented so just fail */
251 case 0x05: /* VESA SuperVGA BIOS - CPU VIDEO MEMORY CONTROL */
252 ERR(int10
,"VESA CPU VIDEO MEMORY CONTROL\n");
253 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
254 /* maby we should do this instead ? */
255 /* AH_reg(context = 0x001; not implemented so just fail */
257 case 0x06: /* VESA GET/SET LOGICAL SCAN LINE LENGTH */
258 ERR(int10
,"VESA GET/SET LOGICAL SCAN LINE LENGTH - Not Implemented\n");
259 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
260 /* maby we should do this instead ? */
261 /* AH_reg(context = 0x001; not implemented so just fail */
263 case 0x07: /* GET/SET DISPLAY START */
264 ERR(int10
,"VESA GET/SET DISPLAY START - Not Implemented\n");
265 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
266 /* maby we should do this instead ? */
267 /* AH_reg(context = 0x001; not implemented so just fail */
269 case 0x08: /* GET/SET DAC PALETTE CONTROL */
270 ERR(int10
,"VESA GET/SET DAC PALETTE CONTROL- Not Implemented\n");
271 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
272 /* maby we should do this instead ? */
273 /* AH_reg(context = 0x001; not implemented so just fail */
275 case 0xff: /* Turn VESA ON/OFF */
276 /* i dont know what to do */
279 FIXME(int10
,"VESA Function (0x%x) - Not Supported\n", AH_reg(context
));
285 switch(AH_reg(context
)) {
287 case 0x00: /* SET VIDEO MODE */
289 /* (mode) (text rows/cols)
293 0x03 - 80x25 or 80x43 or 80x50 (assume 80x25)
297 switch (AL_reg(context
)) {
298 case 0x00: /* 40x25 */
301 TRACE(int10
, "Set Video Mode - Set to Text - 0x0%x\n",
303 CONSOLE_ResizeScreen(40, 25);
304 CONSOLE_ClearScreen();
305 video_mode
= AL_reg(context
);
312 TRACE(int10
, "Set Video Mode - Set to Text - 0x0%x\n",
314 CONSOLE_ResizeScreen(80, 25);
315 CONSOLE_ClearScreen();
316 video_mode
= AL_reg(context
);
320 TRACE(int10
, "Setting VGA 320x200 256-color mode\n");
321 VGA_SetMode(320,200,8);
322 video_mode
= AL_reg(context
);
325 FIXME(int10
, "Set Video Mode (0x%x) - Not Supported\n",
330 case 0x01: /* SET CURSOR SHAPE */
331 FIXME(int10
, "Set Cursor Shape - Not Supported\n");
334 case 0x02: /* SET CURSOR POSITION */
335 /* BH = Page Number */ /* Not supported */
336 /* DH = Row */ /* 0 is left */
337 /* DL = Column */ /* 0 is top */
340 FIXME(int10
, "Set Cursor Position: Cannot set to page %d\n",
345 CONSOLE_MoveCursor(DH_reg(context
), DL_reg(context
));
346 TRACE(int10
, "Set Cursor Position: %d %d\n", DH_reg(context
),
351 case 0x03: /* GET CURSOR POSITION AND SIZE */
352 FIXME(int10
, "Get Cursor Position and Size - Not Supported\n");
353 CX_reg(context
) = 0x0000; /* Bogus cursor data */
354 DX_reg(context
) = 0x0000;
357 case 0x04: /* READ LIGHT PEN POSITION */
358 FIXME(int10
, "Read Light Pen Position - Not Supported\n");
359 AH_reg(context
) = 0x00; /* Not down */
362 case 0x05: /* SELECT ACTIVE DISPLAY PAGE */
363 FIXME(int10
, "Select Active Display Page - Not Supported\n");
366 case 0x06: /* SCROLL UP WINDOW */
367 /* AL = Lines to scroll */
369 /* CH,CL = row, col upper-left */
370 /* DH,DL = row, col lower-right */
371 scroll_window(SCROLL_UP
, AL_reg(context
), CH_reg(context
),
372 CL_reg(context
), DH_reg(context
), DL_reg(context
),
374 TRACE(int10
, "Scroll Up Window %d\n", AL_reg(context
));
377 case 0x07: /* SCROLL DOWN WINDOW */
378 /* AL = Lines to scroll */
380 /* CH,CL = row, col upper-left */
381 /* DH,DL = row, col lower-right */
382 scroll_window(SCROLL_DOWN
, AL_reg(context
), CH_reg(context
),
383 CL_reg(context
), DH_reg(context
), DL_reg(context
),
385 TRACE(int10
, "Scroll Down Window %d\n", AL_reg(context
));
388 case 0x08: /* READ CHARACTER AND ATTRIBUTE AT CURSOR POSITION */
390 /* Note here that color data returned is bogus, will fix later. */
393 if (BH_reg(context
)) /* Write to different page */
395 FIXME(int10
, "Read Character and Attribute at Cursor Position -"
396 " Can't read from non-0 page\n");
397 AL_reg(context
) = ' '; /* That page is blank */
403 "Read Character and Attribute at Cursor Position\n");
404 CONSOLE_GetCharacterAtCursor(&ch
, &fg
, &bg
, &attr
);
405 AL_reg(context
) = ch
;
406 AH_reg(context
) = 7; /* FIXME: We're assuming wh on bl */
411 case 0x09: /* WRITE CHARACTER AND ATTRIBUTE AT CURSOR POSITION */
412 /* AL = Character to display. */
413 /* BH = Page Number */ /* We can't write to non-0 pages, yet. */
414 /* BL = Attribute / Color */
415 /* CX = Times to Write Char */
416 /* Note here that the cursor is not advanced. */
417 write_char_attribute_at_cursor(AL_reg(context
), BH_reg(context
),
418 BL_reg(context
), CX_reg(context
));
419 if (CX_reg(context
) > 1)
420 TRACE(int10
, "Write Character and Attribute at Cursor Position "
421 "(Rep. %d) %c\n", CX_reg(context
), AL_reg(context
));
423 TRACE(int10
, "Write Character and Attribute at Cursor"
424 "Position: %c\n", AL_reg(context
));
427 case 0x0a: /* WRITE CHARACTER ONLY AT CURSOR POSITION */
428 /* AL = Character to display. */
429 /* BH = Page Number */ /* We can't write to non-0 pages, yet. */
430 /* CX = Times to Write Char */
431 TRACE(int10
, "Write Character at Cursor\n");
432 write_char_attribute_at_cursor(AL_reg(context
), BH_reg(context
),
437 switch BH_reg(context
) {
438 case 0x00: /* SET BACKGROUND/BORDER COLOR */
439 /* In text modes, this sets only the border... */
440 /* According to the interrupt list and one of my books. */
441 /* Funny though that Beyond Zork seems to indicate that it
442 also sets up the default background attributes for clears
444 /* Bear in mind here that we do not want to change,
445 apparantly, the foreground or attribute of the background
446 with this call, so we should check first to see what the
447 foreground already is... FIXME */
448 TRACE(int10
, "Set Background/Border Color: %d\n",
450 CONSOLE_SetBackgroundColor(color_pallet
[0],
451 color_pallet
[BL_reg(context
)]);
453 case 0x01: /* SET PALETTE */
454 FIXME(int10
, "Set Palette - Not Supported\n");
457 FIXME(int10
, "INT 10 AH = 0x0b BH = 0x%x - Unknown\n",
463 case 0x0c: /* WRITE GRAPHICS PIXEL */
464 /* Not in graphics mode, can ignore w/o error */
465 FIXME(int10
, "Write Graphics Pixel - Not Supported\n");
468 case 0x0d: /* READ GRAPHICS PIXEL */
469 /* Not in graphics mode, can ignore w/o error */
470 FIXME(int10
, "Read Graphics Pixel - Not Supported\n");
473 case 0x0e: /* TELETYPE OUTPUT */
474 TRACE(int10
, "Teletype Output\n");
475 CONSOLE_Write(AL_reg(context
), 0, 0, 0);
478 case 0x0f: /* GET CURRENT VIDEO MODE */
479 TRACE(int10
, "Get Current Video Mode\n");
480 /* Note: This should not be a constant value. */
481 AL_reg(context
) = video_mode
;
482 AH_reg(context
) = video_columns
;
483 BH_reg(context
) = 0; /* Display page 0 */
487 switch AL_reg(context
) {
488 case 0x00: /* SET SINGLE PALETTE REGISTER */
489 FIXME(int10
, "Set Single Palette Register - Not Supported\n");
491 case 0x01: /* SET BORDER (OVERSCAN) */
492 /* Text terminals have no overscan */
493 TRACE(int10
, "Set Border (Overscan) - Ignored\n");
495 case 0x02: /* SET ALL PALETTE REGISTERS */
496 FIXME(int10
, "Set all palette registers - Not Supported\n");
498 case 0x03: /* TOGGLE INTENSITY/BLINKING BIT */
499 FIXME(int10
, "Toggle Intensity/Blinking Bit - Not Supported\n");
501 case 0x07: /* GET INDIVIDUAL PALETTE REGISTER */
502 FIXME(int10
, "Get Individual Palette Register - Not Supported\n");
504 case 0x08: /* READ OVERSCAN (BORDER COLOR) REGISTER */
506 "Read Overscan (Border Color) Register - Not Supported\n");
508 case 0x09: /* READ ALL PALETTE REGISTERS AND OVERSCAN REGISTER */
510 "Read All Palette Registers and Overscan Register "
511 " - Not Supported\n");
513 case 0x10: /* SET INDIVIDUAL DAC REGISTER */
514 FIXME(int10
, "Set Individual DAC register - Not Supported\n");
516 case 0x12: /* SET BLOCK OF DAC REGISTERS */
517 FIXME(int10
, "Set Block of DAC registers - Not Supported\n");
519 case 0x13: /* SELECT VIDEO DAC COLOR PAGE */
520 FIXME(int10
, "Select video DAC color page - Not Supported\n");
522 case 0x15: /* READ INDIVIDUAL DAC REGISTER */
523 FIXME(int10
, "Read individual DAC register - Not Supported\n");
525 case 0x17: /* READ BLOCK OF DAC REGISTERS */
526 FIXME(int10
, "Read block of DAC registers - Not Supported\n");
528 case 0x18: /* SET PEL MASK */
529 FIXME(int10
, "Set PEL mask - Not Supported\n");
531 case 0x19: /* READ PEL MASK */
532 FIXME(int10
, "Read PEL mask - Not Supported\n");
534 case 0x1a: /* GET VIDEO DAC COLOR PAGE STATE */
535 FIXME(int10
, "Get video DAC color page state - Not Supported\n");
537 case 0x1b: /* PERFORM GRAY-SCALE SUMMING */
538 FIXME(int10
, "Perform Gray-scale summing - Not Supported\n");
541 FIXME(int10
, "INT 10 AH = 0x10 AL = 0x%x - Unknown\n",
547 case 0x11: /* TEXT MODE CHARGEN */
548 /* Note that second subfunction is *almost* identical. */
549 /* See INTERRUPT.A for details. */
550 switch AH_reg(context
) {
551 case 0x00: /* LOAD USER SPECIFIED PATTERNS */
553 FIXME(int10
, "Load User Specified Patterns - Not Supported\n");
555 case 0x01: /* LOAD ROM MONOCHROME PATTERNS */
557 FIXME(int10
, "Load ROM Monochrome Patterns - Not Supported\n");
559 case 0x02: /* LOAD ROM 8x8 DOUBLE-DOT PATTERNS */
562 "Load ROM 8x8 Double Dot Patterns - Not Supported\n");
564 case 0x03: /* SET BLOCK SPECIFIER */
565 FIXME(int10
, "Set Block Specifier - Not Supported\n");
567 case 0x04: /* LOAD ROM 8x16 CHARACTER SET */
569 FIXME(int10
, "Load ROM 8x16 Character Set - Not Supported\n");
571 case 0x20: /* SET USER 8x16 GRAPHICS CHARS */
572 FIXME(int10
, "Set User 8x16 Graphics Chars - Not Supported\n");
574 case 0x21: /* SET USER GRAPICS CHARACTERS */
575 FIXME(int10
, "Set User Graphics Characters - Not Supported\n");
577 case 0x22: /* SET ROM 8x14 GRAPHICS CHARS */
578 FIXME(int10
, "Set ROM 8x14 Graphics Chars - Not Supported\n");
580 case 0x23: /* SET ROM 8x8 DBL DOT CHARS */
582 "Set ROM 8x8 Dbl Dot Chars (Graphics) - Not Supported\n");
584 case 0x24: /* LOAD 8x16 GRAPHIC CHARS */
585 FIXME(int10
, "Load 8x16 Graphic Chars - Not Supported\n");
587 case 0x30: /* GET FONT INFORMATION */
588 FIXME(int10
, "Get Font Information - Not Supported\n");
591 FIXME(int10
, "INT 10 AH = 0x11 AL = 0x%x - Unknown\n",
597 case 0x12: /* ALTERNATE FUNCTION SELECT */
598 switch BL_reg(context
) {
599 case 0x10: /* GET EGA INFO */
600 TRACE(int10
, "EGA Info Requested\n");
601 BH_reg(context
) = 0x00; /* Color screen */
602 BL_reg(context
) = 0x03; /* 256K EGA card */
603 CH_reg(context
) = 0x00; /* Switch settings?? */
604 CL_reg(context
) = 0x09; /* EGA+ card */
606 case 0x20: /* ALTERNATE PRTSC */
607 FIXME(int10
, "Install Alternate Print Screen - Not Supported\n");
609 case 0x30: /* SELECT VERTICAL RESOULTION */
610 FIXME(int10
, "Select Vertical Resoultion - Not Supported\n");
612 case 0x31: /* ENABLE/DISABLE PALETTE LOADING */
613 FIXME(int10
, "Palette Loading - Not Supported\n");
615 case 0x32: /* ENABLE/DISABLE VIDEO ADDRERSSING */
616 FIXME(int10
, "Video Addressing - Not Supported\n");
618 case 0x33: /* ENABLE/DISABLE GRAY SCALE SUMMING */
619 FIXME(int10
, "Gray Scale Summing - Not Supported\n");
621 case 0x34: /* ENABLE/DISABLE CURSOR EMULATION */
622 FIXME(int10
, "Cursor Emulation - Not Supported\n");
624 case 0x36: /* VIDEO ADDRESS CONTROL */
625 FIXME(int10
, "Video Address Control - Not Supported\n");
628 FIXME(int10
, "INT 10 AH = 0x11 AL = 0x%x - Unknown\n",
634 case 0x13: /* WRITE STRING */
635 /* This one does not imply that string be at cursor. */
636 FIXME(int10
, "Write String - Not Supported\n");
640 switch AL_reg(context
) {
641 case 0x00: /* GET DISPLAY COMBINATION CODE */
642 TRACE(int10
, "Get Display Combination Code\n");
643 AL_reg(context
) = 0x1a;
644 BH_reg(context
) = 0x08; /* VGA w/ color analog display */
645 BL_reg(context
) = 0x00; /* No secondary hardware */
647 case 0x01: /* SET DISPLAY COMBINATION CODE */
648 FIXME(int10
, "Set Display Combination Code - Not Supported\n");
651 FIXME(int10
, "INT 10 AH = 0x1a AL = 0x%x - Unknown\n",
657 case 0x1b: /* FUNCTIONALITY/STATE INFORMATION */
658 FIXME(int10
, "Get Functionality/State Information - Not Supported\n");
661 case 0x1c: /* SAVE/RESTORE VIDEO STATE */
662 FIXME(int10
, "Save/Restore Video State - Not Supported\n");
666 FIXME(int10
, "Unknown - 0x%x\n", AH_reg(context
));
667 INT_BARF( context
, 0x10 );
672 static void write_char_attribute_at_cursor(char output
, char page_num
,
673 char attribute
, short times
)
675 /* Contrary to the interrupt list, this routine should not advance
676 the cursor. To keep this logic simple, we won't use the
677 CONSOLE_Put() routine.
680 int wattribute
, fg_color
, bg_color
;
683 if (page_num
) /* Only support one text page right now */
685 FIXME(int10
, "Cannot write to alternate page %d", page_num
);
689 conv_text_mode_attributes(attribute
, &fg_color
, &bg_color
,
692 TRACE(int10
, "Fore: %d Back: %d\n", fg_color
, bg_color
);
694 CONSOLE_GetCursorPosition(&x
, &y
);
698 CONSOLE_Write(output
, fg_color
, bg_color
, attribute
);
702 CONSOLE_MoveCursor(x
, y
);
705 static void conv_text_mode_attributes(char attribute
, int *fg
, int *bg
,
708 /* This is a local function to convert the text-mode attributes
709 to Wine's color and attribute scheme */
711 /* Foreground Color is stored in bits 3 through 0 */
712 /* Background Color is stored in bits 6 through 4 */
713 /* If this has bit 7 set, then we need to blink */
715 *fg
= color_pallet
[attribute
& 15];
716 *bg
= color_pallet
[(attribute
& 112) / 16];
717 *wattribute
= attribute
& 128;
721 static void scroll_window(int direction
, char lines
, char row1
,
722 char col1
, char row2
, char col2
, char attribute
)
724 int wattribute
, bg_color
, fg_color
;
726 conv_text_mode_attributes(attribute
, &fg_color
, &bg_color
,
729 if (!lines
) /* Actually, clear the window */
731 CONSOLE_ClearWindow(row1
, col1
, row2
, col2
, bg_color
, wattribute
);
733 else if (direction
== SCROLL_UP
)
735 CONSOLE_ScrollUpWindow(row1
, col1
, row2
, col2
, lines
, bg_color
,
740 CONSOLE_ScrollDownWindow(row1
, col1
, row2
, col2
, lines
, bg_color
,