Mask out the upper 12 bits from the resourceid, just like win95 does.
[wine/multimedia.git] / msdos / int10.c
blob3ae947141bc0aadb1b127e3526bc40cfa9f4841e
1 /*
2 * BIOS interrupt 10h handler
3 */
5 #include <stdlib.h>
6 #include "miscemu.h"
7 #include "vga.h"
8 #include "debug.h"
9 #include "console.h"
11 static void conv_text_mode_attributes(char attribute, int *fg, int *bg,
12 int *wattribute);
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];
20 #define SCROLL_UP 1
21 #define SCROLL_DOWN 2
23 /**********************************************************************
24 * INT_Int10Handler
26 * Handler for int 10h (video).
28 * NOTE:
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.
35 * NOTE:
36 * Several common graphical extensions used by Microsoft hook
37 * off of here. I have *not* added them to this list (yet). They
38 * include:
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.
53 * Jess Haas - 2/99
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)
64 /* 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 */
106 break;
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 */
111 break;
112 case 0x02: /* SET SuperVGA VIDEO MODE */
113 switch(BX_reg(context)) {
114 /* OEM Video Modes */
115 case 0x00: /* 40x25 */
116 case 0x01:
117 VGA_Exit();
118 TRACE(int10, "Set Video Mode - Set to Text - 0x0%x\n",
119 BX_reg(context));
120 CONSOLE_ResizeScreen(40, 25);
121 CONSOLE_ClearScreen();
122 video_columns = 40;
123 break;
124 case 0x02:
125 case 0x03:
126 case 0x07:
127 VGA_Exit();
128 TRACE(int10, "Set Video Mode - Set to Text - 0x0%x\n",
129 BX_reg(context));
130 CONSOLE_ResizeScreen(80, 25);
131 CONSOLE_ClearScreen();
132 video_columns = 80;
133 break;
134 case 0x13:
135 TRACE(int10, "Setting VESA 320x200 256-color mode\n");
136 VGA_SetMode(320,200,8);
137 break;
138 /* VBE Modes */
139 case 0x100:
140 TRACE(int10, "Setting VESA 640x400 256-color mode\n");
141 VGA_SetMode(640,400,8);
142 break;
143 case 0x101:
144 TRACE(int10, "Setting VESA 640x480 256-color mode\n");
145 VGA_SetMode(640,480,8);
146 break;
147 case 0x102:
148 TRACE(int10, "Setting VESA 800x600 16-color mode\n");
149 VGA_SetMode(800,600,4);
150 break;
151 case 0x103:
152 TRACE(int10, "Setting VESA 800x600 256-color mode\n");
153 VGA_SetMode(800,600,8);
154 break;
155 case 0x104:
156 TRACE(int10, "Setting VESA 1024x768 16-color mode\n");
157 VGA_SetMode(1024,768,4);
158 break;
159 case 0x105:
160 TRACE(int10, "Setting VESA 1024x768 256-color mode\n");
161 VGA_SetMode(1024,768,8);
162 break;
163 case 0x106:
164 TRACE(int10, "Setting VESA 1280x1024 16-color mode\n");
165 VGA_SetMode(1280,1024,4);
166 break;
167 case 0x107:
168 TRACE(int10, "Setting VESA 1280x1024 256-color mode\n");
169 VGA_SetMode(1280,1024,8);
170 break;
171 /* 108h - 10Ch are text modes and im lazy so :p */
172 /* VBE v1.2+ */
173 case 0x10D:
174 TRACE(int10, "Setting VESA 320x200 15bpp\n");
175 VGA_SetMode(320,200,15);
176 break;
177 case 0x10E:
178 TRACE(int10, "Setting VESA 320x200 16bpp\n");
179 VGA_SetMode(320,200,16);
180 break;
181 case 0x10F:
182 TRACE(int10, "Setting VESA 320x200 24bpp\n");
183 VGA_SetMode(320,200,24);
184 break;
185 case 0x110:
186 TRACE(int10, "Setting VESA 640x480 15bpp\n");
187 VGA_SetMode(640,480,15);
188 break;
189 case 0x111:
190 TRACE(int10, "Setting VESA 640x480 16bpp\n");
191 VGA_SetMode(640,480,16);
192 break;
193 case 0x112:
194 TRACE(int10, "Setting VESA 640x480 24bpp\n");
195 VGA_SetMode(640,480,24);
196 break;
197 case 0x113:
198 TRACE(int10, "Setting VESA 800x600 15bpp\n");
199 VGA_SetMode(800,600,15);
200 break;
201 case 0x114:
202 TRACE(int10, "Setting VESA 800x600 16bpp\n");
203 VGA_SetMode(800,600,16);
204 break;
205 case 0x115:
206 TRACE(int10, "Setting VESA 800x600 24bpp\n");
207 VGA_SetMode(800,600,24);
208 break;
209 case 0x116:
210 TRACE(int10, "Setting VESA 1024x768 15bpp\n");
211 VGA_SetMode(1024,768,15);
212 break;
213 case 0x117:
214 TRACE(int10, "Setting VESA 1024x768 16bpp\n");
215 VGA_SetMode(1024,768,16);
216 break;
217 case 0x118:
218 TRACE(int10, "Setting VESA 1024x768 24bpp\n");
219 VGA_SetMode(1024,768,24);
220 break;
221 case 0x119:
222 TRACE(int10, "Setting VESA 1280x1024 15bpp\n");
223 VGA_SetMode(1280,1024,15);
224 break;
225 case 0x11A:
226 TRACE(int10, "Setting VESA 1280x1024 16bpp\n");
227 VGA_SetMode(1280,1024,16);
228 break;
229 case 0x11B:
230 TRACE(int10, "Setting VESA 1280x1024 24bpp\n");
231 VGA_SetMode(1280,1024,24);
232 break;
233 default:
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;
239 break;
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;
244 break;
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 */
250 break;
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 */
256 break;
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 */
262 break;
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 */
268 break;
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 */
274 break;
275 case 0xff: /* Turn VESA ON/OFF */
276 /* i dont know what to do */
277 break;
278 default:
279 FIXME(int10,"VESA Function (0x%x) - Not Supported\n", AH_reg(context));
280 break;
283 else {
285 switch(AH_reg(context)) {
287 case 0x00: /* SET VIDEO MODE */
288 /* Text Modes: */
289 /* (mode) (text rows/cols)
290 0x00 - 40x25
291 0x01 - 40x25
292 0x02 - 80x25
293 0x03 - 80x25 or 80x43 or 80x50 (assume 80x25)
294 0x07 - 80x25
297 switch (AL_reg(context)) {
298 case 0x00: /* 40x25 */
299 case 0x01:
300 VGA_Exit();
301 TRACE(int10, "Set Video Mode - Set to Text - 0x0%x\n",
302 AL_reg(context));
303 CONSOLE_ResizeScreen(40, 25);
304 CONSOLE_ClearScreen();
305 video_mode = AL_reg(context);
306 video_columns = 40;
307 break;
308 case 0x02:
309 case 0x03:
310 case 0x07:
311 VGA_Exit();
312 TRACE(int10, "Set Video Mode - Set to Text - 0x0%x\n",
313 AL_reg(context));
314 CONSOLE_ResizeScreen(80, 25);
315 CONSOLE_ClearScreen();
316 video_mode = AL_reg(context);
317 video_columns = 80;
318 break;
319 case 0x13:
320 TRACE(int10, "Setting VGA 320x200 256-color mode\n");
321 VGA_SetMode(320,200,8);
322 video_mode = AL_reg(context);
323 break;
324 default:
325 FIXME(int10, "Set Video Mode (0x%x) - Not Supported\n",
326 AL_reg(context));
328 break;
330 case 0x01: /* SET CURSOR SHAPE */
331 FIXME(int10, "Set Cursor Shape - Not Supported\n");
332 break;
334 case 0x02: /* SET CURSOR POSITION */
335 /* BH = Page Number */ /* Not supported */
336 /* DH = Row */ /* 0 is left */
337 /* DL = Column */ /* 0 is top */
338 if (BH_reg(context))
340 FIXME(int10, "Set Cursor Position: Cannot set to page %d\n",
341 BH_reg(context));
343 else
345 CONSOLE_MoveCursor(DH_reg(context), DL_reg(context));
346 TRACE(int10, "Set Cursor Position: %d %d\n", DH_reg(context),
347 DL_reg(context));
349 break;
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;
355 break;
357 case 0x04: /* READ LIGHT PEN POSITION */
358 FIXME(int10, "Read Light Pen Position - Not Supported\n");
359 AH_reg(context) = 0x00; /* Not down */
360 break;
362 case 0x05: /* SELECT ACTIVE DISPLAY PAGE */
363 FIXME(int10, "Select Active Display Page - Not Supported\n");
364 break;
366 case 0x06: /* SCROLL UP WINDOW */
367 /* AL = Lines to scroll */
368 /* BH = Attribute */
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),
373 BH_reg(context));
374 TRACE(int10, "Scroll Up Window %d\n", AL_reg(context));
375 break;
377 case 0x07: /* SCROLL DOWN WINDOW */
378 /* AL = Lines to scroll */
379 /* BH = Attribute */
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),
384 BH_reg(context));
385 TRACE(int10, "Scroll Down Window %d\n", AL_reg(context));
386 break;
388 case 0x08: /* READ CHARACTER AND ATTRIBUTE AT CURSOR POSITION */
390 /* Note here that color data returned is bogus, will fix later. */
391 char ch;
392 int bg, fg, attr;
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 */
398 AH_reg(context) = 7;
400 else
402 TRACE(int10,
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 */
409 break;
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));
422 else
423 TRACE(int10, "Write Character and Attribute at Cursor"
424 "Position: %c\n", AL_reg(context));
425 break;
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),
433 0, CX_reg(context));
434 break;
436 case 0x0b:
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
443 and scrolls... */
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",
449 BL_reg(context));
450 CONSOLE_SetBackgroundColor(color_pallet[0],
451 color_pallet[BL_reg(context)]);
452 break;
453 case 0x01: /* SET PALETTE */
454 FIXME(int10, "Set Palette - Not Supported\n");
455 break;
456 default:
457 FIXME(int10, "INT 10 AH = 0x0b BH = 0x%x - Unknown\n",
458 BH_reg(context));
459 break;
461 break;
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");
466 break;
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");
471 break;
473 case 0x0e: /* TELETYPE OUTPUT */
474 TRACE(int10, "Teletype Output\n");
475 CONSOLE_Write(AL_reg(context), 0, 0, 0);
476 break;
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 */
484 break;
486 case 0x10:
487 switch AL_reg(context) {
488 case 0x00: /* SET SINGLE PALETTE REGISTER */
489 FIXME(int10, "Set Single Palette Register - Not Supported\n");
490 break;
491 case 0x01: /* SET BORDER (OVERSCAN) */
492 /* Text terminals have no overscan */
493 TRACE(int10, "Set Border (Overscan) - Ignored\n");
494 break;
495 case 0x02: /* SET ALL PALETTE REGISTERS */
496 FIXME(int10, "Set all palette registers - Not Supported\n");
497 break;
498 case 0x03: /* TOGGLE INTENSITY/BLINKING BIT */
499 FIXME(int10, "Toggle Intensity/Blinking Bit - Not Supported\n");
500 break;
501 case 0x07: /* GET INDIVIDUAL PALETTE REGISTER */
502 FIXME(int10, "Get Individual Palette Register - Not Supported\n");
503 break;
504 case 0x08: /* READ OVERSCAN (BORDER COLOR) REGISTER */
505 FIXME(int10,
506 "Read Overscan (Border Color) Register - Not Supported\n");
507 break;
508 case 0x09: /* READ ALL PALETTE REGISTERS AND OVERSCAN REGISTER */
509 FIXME(int10,
510 "Read All Palette Registers and Overscan Register "
511 " - Not Supported\n");
512 break;
513 case 0x10: /* SET INDIVIDUAL DAC REGISTER */
514 FIXME(int10, "Set Individual DAC register - Not Supported\n");
515 break;
516 case 0x12: /* SET BLOCK OF DAC REGISTERS */
517 FIXME(int10, "Set Block of DAC registers - Not Supported\n");
518 break;
519 case 0x13: /* SELECT VIDEO DAC COLOR PAGE */
520 FIXME(int10, "Select video DAC color page - Not Supported\n");
521 break;
522 case 0x15: /* READ INDIVIDUAL DAC REGISTER */
523 FIXME(int10, "Read individual DAC register - Not Supported\n");
524 break;
525 case 0x17: /* READ BLOCK OF DAC REGISTERS */
526 FIXME(int10, "Read block of DAC registers - Not Supported\n");
527 break;
528 case 0x18: /* SET PEL MASK */
529 FIXME(int10, "Set PEL mask - Not Supported\n");
530 break;
531 case 0x19: /* READ PEL MASK */
532 FIXME(int10, "Read PEL mask - Not Supported\n");
533 break;
534 case 0x1a: /* GET VIDEO DAC COLOR PAGE STATE */
535 FIXME(int10, "Get video DAC color page state - Not Supported\n");
536 break;
537 case 0x1b: /* PERFORM GRAY-SCALE SUMMING */
538 FIXME(int10, "Perform Gray-scale summing - Not Supported\n");
539 break;
540 default:
541 FIXME(int10, "INT 10 AH = 0x10 AL = 0x%x - Unknown\n",
542 AL_reg(context));
543 break;
545 break;
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 */
552 case 0x10:
553 FIXME(int10, "Load User Specified Patterns - Not Supported\n");
554 break;
555 case 0x01: /* LOAD ROM MONOCHROME PATTERNS */
556 case 0x11:
557 FIXME(int10, "Load ROM Monochrome Patterns - Not Supported\n");
558 break;
559 case 0x02: /* LOAD ROM 8x8 DOUBLE-DOT PATTERNS */
560 case 0x12:
561 FIXME(int10,
562 "Load ROM 8x8 Double Dot Patterns - Not Supported\n");
563 break;
564 case 0x03: /* SET BLOCK SPECIFIER */
565 FIXME(int10, "Set Block Specifier - Not Supported\n");
566 break;
567 case 0x04: /* LOAD ROM 8x16 CHARACTER SET */
568 case 0x14:
569 FIXME(int10, "Load ROM 8x16 Character Set - Not Supported\n");
570 break;
571 case 0x20: /* SET USER 8x16 GRAPHICS CHARS */
572 FIXME(int10, "Set User 8x16 Graphics Chars - Not Supported\n");
573 break;
574 case 0x21: /* SET USER GRAPICS CHARACTERS */
575 FIXME(int10, "Set User Graphics Characters - Not Supported\n");
576 break;
577 case 0x22: /* SET ROM 8x14 GRAPHICS CHARS */
578 FIXME(int10, "Set ROM 8x14 Graphics Chars - Not Supported\n");
579 break;
580 case 0x23: /* SET ROM 8x8 DBL DOT CHARS */
581 FIXME(int10,
582 "Set ROM 8x8 Dbl Dot Chars (Graphics) - Not Supported\n");
583 break;
584 case 0x24: /* LOAD 8x16 GRAPHIC CHARS */
585 FIXME(int10, "Load 8x16 Graphic Chars - Not Supported\n");
586 break;
587 case 0x30: /* GET FONT INFORMATION */
588 FIXME(int10, "Get Font Information - Not Supported\n");
589 break;
590 default:
591 FIXME(int10, "INT 10 AH = 0x11 AL = 0x%x - Unknown\n",
592 AL_reg(context));
593 break;
595 break;
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 */
605 break;
606 case 0x20: /* ALTERNATE PRTSC */
607 FIXME(int10, "Install Alternate Print Screen - Not Supported\n");
608 break;
609 case 0x30: /* SELECT VERTICAL RESOULTION */
610 FIXME(int10, "Select Vertical Resoultion - Not Supported\n");
611 break;
612 case 0x31: /* ENABLE/DISABLE PALETTE LOADING */
613 FIXME(int10, "Palette Loading - Not Supported\n");
614 break;
615 case 0x32: /* ENABLE/DISABLE VIDEO ADDRERSSING */
616 FIXME(int10, "Video Addressing - Not Supported\n");
617 break;
618 case 0x33: /* ENABLE/DISABLE GRAY SCALE SUMMING */
619 FIXME(int10, "Gray Scale Summing - Not Supported\n");
620 break;
621 case 0x34: /* ENABLE/DISABLE CURSOR EMULATION */
622 FIXME(int10, "Cursor Emulation - Not Supported\n");
623 break;
624 case 0x36: /* VIDEO ADDRESS CONTROL */
625 FIXME(int10, "Video Address Control - Not Supported\n");
626 break;
627 default:
628 FIXME(int10, "INT 10 AH = 0x11 AL = 0x%x - Unknown\n",
629 AL_reg(context));
630 break;
632 break;
634 case 0x13: /* WRITE STRING */
635 /* This one does not imply that string be at cursor. */
636 FIXME(int10, "Write String - Not Supported\n");
637 break;
639 case 0x1a:
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 */
646 break;
647 case 0x01: /* SET DISPLAY COMBINATION CODE */
648 FIXME(int10, "Set Display Combination Code - Not Supported\n");
649 break;
650 default:
651 FIXME(int10, "INT 10 AH = 0x1a AL = 0x%x - Unknown\n",
652 AL_reg(context));
653 break;
655 break;
657 case 0x1b: /* FUNCTIONALITY/STATE INFORMATION */
658 FIXME(int10, "Get Functionality/State Information - Not Supported\n");
659 break;
661 case 0x1c: /* SAVE/RESTORE VIDEO STATE */
662 FIXME(int10, "Save/Restore Video State - Not Supported\n");
663 break;
665 default:
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;
681 char x, y;
683 if (page_num) /* Only support one text page right now */
685 FIXME(int10, "Cannot write to alternate page %d", page_num);
686 return;
689 conv_text_mode_attributes(attribute, &fg_color, &bg_color,
690 &wattribute);
692 TRACE(int10, "Fore: %d Back: %d\n", fg_color, bg_color);
694 CONSOLE_GetCursorPosition(&x, &y);
696 while (times)
698 CONSOLE_Write(output, fg_color, bg_color, attribute);
699 times--;
702 CONSOLE_MoveCursor(x, y);
705 static void conv_text_mode_attributes(char attribute, int *fg, int *bg,
706 int *wattribute)
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,
727 &wattribute);
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,
736 wattribute);
738 else
740 CONSOLE_ScrollDownWindow(row1, col1, row2, col2, lines, bg_color,
741 wattribute);