Fixed a slight bug that was included in the change from WND ptr to
[wine/hacks.git] / msdos / int10.c
blob3f55dba7ce219e28bd3bf0f2da319de70c94eb97
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_palette[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 /* Jess Haas 2/99
49 * Added support for Vesa. It is not complete but is a start.
50 * NOTE: Im not sure if i did all this right or if eny of it works.
51 * Currently i dont have a program that uses Vesa that actually gets far
52 * enough without crashing to do vesa stuff.
54 * Added additional vga graphic support - 3/99
57 void WINAPI INT_Int10Handler( CONTEXT *context )
59 static int registered_colors = FALSE;
61 if (!registered_colors)
63 /* Colors:
64 0000b black 1000b dark gray
65 0001b blue 1001b light blue
66 0010b green 1010b light green
67 0011b cyan 1011b light cyan
68 0100b red 1100b light red
69 0101b magenta 1101b light magenta
70 0110b brown 1110b yellow
71 0111b light gray 1111b white
74 /* These AllocColor calls have the side-effect of triggering
75 ternimal initialization as xx_Init() is no longer called on
76 startup. Which is what we want anyway. */
78 color_palette[0] = CONSOLE_AllocColor(WINE_BLACK);
79 color_palette[1] = CONSOLE_AllocColor(WINE_BLUE);
80 color_palette[2] = CONSOLE_AllocColor(WINE_GREEN);
81 color_palette[3] = CONSOLE_AllocColor(WINE_CYAN);
82 color_palette[4] = CONSOLE_AllocColor(WINE_RED);
83 color_palette[5] = CONSOLE_AllocColor(WINE_MAGENTA);
84 color_palette[6] = CONSOLE_AllocColor(WINE_BROWN);
85 color_palette[7] = CONSOLE_AllocColor(WINE_LIGHT_GRAY);
86 color_palette[8] = CONSOLE_AllocColor(WINE_DARK_GRAY);
87 color_palette[9] = CONSOLE_AllocColor(WINE_LIGHT_BLUE);
88 color_palette[10] = CONSOLE_AllocColor(WINE_LIGHT_GREEN);
89 color_palette[11] = CONSOLE_AllocColor(WINE_LIGHT_CYAN);
90 color_palette[12] = CONSOLE_AllocColor(WINE_LIGHT_RED);
91 color_palette[13] = CONSOLE_AllocColor(WINE_LIGHT_MAGENTA);
92 color_palette[14] = CONSOLE_AllocColor(WINE_YELLOW);
93 color_palette[15] = CONSOLE_AllocColor(WINE_WHITE);
95 registered_colors = TRUE;
98 if(AL_reg(context) == 0x4F) { /* VESA functions */
99 switch(AH_reg(context)) {
101 case 0x00: /* GET SuperVGA INFORMATION */
102 FIXME(int10, "Vesa Get SuperVGA Info STUB!\n");
103 AL_reg(context) = 0x4f;
104 AH_reg(context) = 0x01; /* 0x01=failed 0x00=succesful */
105 break;
106 case 0x01: /* GET SuperVGA MODE INFORMATION */
107 FIXME(int10, "VESA GET SuperVGA Mode Information - Not supported\n");
108 AL_reg(context) = 0x4f;
109 AH_reg(context) = 0x01; /* 0x00 = successful 0x01 = failed */
110 break;
111 case 0x02: /* SET SuperVGA VIDEO MODE */
112 switch(BX_reg(context)) {
113 /* OEM Video Modes */
114 case 0x00: /* 40x25 */
115 case 0x01:
116 VGA_Exit();
117 TRACE(int10, "Set Video Mode - Set to Text - 0x0%x\n",
118 BX_reg(context));
119 CONSOLE_ResizeScreen(40, 25);
120 CONSOLE_ClearScreen();
121 DOSMEM_BiosData()->VideoColumns = 40;
122 break;
123 case 0x02:
124 case 0x03:
125 case 0x07:
126 VGA_Exit();
127 TRACE(int10, "Set Video Mode - Set to Text - 0x0%x\n",
128 BX_reg(context));
129 CONSOLE_ResizeScreen(80, 25);
130 CONSOLE_ClearScreen();
131 DOSMEM_BiosData()->VideoColumns = 80;
132 break;
133 case 0x04:
134 TRACE(int10, "Setting VGA 320x200 4-color mode\n");
135 VGA_SetMode(320,200,2); /* FIXME is this right/supported? */
136 break;
137 case 0x05:
138 TRACE(int10, "Setting VGA 320x200 4-color mode\n");
139 VGA_SetMode(320,200,2); /* FIXME is this right/supported? */
140 break;
141 case 0x06:
142 TRACE(int10, "Setting VGA 640x200 2-color mode\n");
143 VGA_SetMode(640,200,1); /* FIXME is this right/supported? */
144 break;
145 case 0x0D:
146 TRACE(int10, "Setting VGA 320x200 16-color mode\n");
147 VGA_SetMode(320,200,4);
148 break;
149 case 0x0E:
150 TRACE(int10, "Setting VGA 640x200 16-color mode\n");
151 VGA_SetMode(640,200,4);
152 break;
153 case 0x0F:
154 TRACE(int10, "Setting VGA 640x350 2-color mode\n");
155 VGA_SetMode(640,350,1); /* FIXME is this right/supported? */
156 break;
157 case 0x10:
158 TRACE(int10, "Setting VGA 640x350 16-color mode\n");
159 VGA_SetMode(640,350,4);
160 break;
161 case 0x11:
162 TRACE(int10, "Setting VGA 640x480 2-color mode\n");
163 VGA_SetMode(640,480,1); /* FIXME is this right/supported? */
164 break;
165 case 0x12:
166 TRACE(int10, "Setting VGA 640x480 16-color mode\n");
167 VGA_SetMode(640,480,4);
168 break;
169 case 0x13:
170 TRACE(int10, "Setting VESA 320x200 256-color mode\n");
171 VGA_SetMode(320,200,8);
172 break;
173 /* VBE Modes */
174 case 0x100:
175 TRACE(int10, "Setting VESA 640x400 256-color mode\n");
176 VGA_SetMode(640,400,8);
177 break;
178 case 0x101:
179 TRACE(int10, "Setting VESA 640x480 256-color mode\n");
180 VGA_SetMode(640,480,8);
181 break;
182 case 0x102:
183 TRACE(int10, "Setting VESA 800x600 16-color mode\n");
184 VGA_SetMode(800,600,4);
185 break;
186 case 0x103:
187 TRACE(int10, "Setting VESA 800x600 256-color mode\n");
188 VGA_SetMode(800,600,8);
189 break;
190 case 0x104:
191 TRACE(int10, "Setting VESA 1024x768 16-color mode\n");
192 VGA_SetMode(1024,768,4);
193 break;
194 case 0x105:
195 TRACE(int10, "Setting VESA 1024x768 256-color mode\n");
196 VGA_SetMode(1024,768,8);
197 break;
198 case 0x106:
199 TRACE(int10, "Setting VESA 1280x1024 16-color mode\n");
200 VGA_SetMode(1280,1024,4);
201 break;
202 case 0x107:
203 TRACE(int10, "Setting VESA 1280x1024 256-color mode\n");
204 VGA_SetMode(1280,1024,8);
205 break;
206 /* 108h - 10Ch are text modes and im lazy so :p */
207 /* VBE v1.2+ */
208 case 0x10D:
209 TRACE(int10, "Setting VESA 320x200 15bpp\n");
210 VGA_SetMode(320,200,15);
211 break;
212 case 0x10E:
213 TRACE(int10, "Setting VESA 320x200 16bpp\n");
214 VGA_SetMode(320,200,16);
215 break;
216 case 0x10F:
217 TRACE(int10, "Setting VESA 320x200 24bpp\n");
218 VGA_SetMode(320,200,24);
219 break;
220 case 0x110:
221 TRACE(int10, "Setting VESA 640x480 15bpp\n");
222 VGA_SetMode(640,480,15);
223 break;
224 case 0x111:
225 TRACE(int10, "Setting VESA 640x480 16bpp\n");
226 VGA_SetMode(640,480,16);
227 break;
228 case 0x112:
229 TRACE(int10, "Setting VESA 640x480 24bpp\n");
230 VGA_SetMode(640,480,24);
231 break;
232 case 0x113:
233 TRACE(int10, "Setting VESA 800x600 15bpp\n");
234 VGA_SetMode(800,600,15);
235 break;
236 case 0x114:
237 TRACE(int10, "Setting VESA 800x600 16bpp\n");
238 VGA_SetMode(800,600,16);
239 break;
240 case 0x115:
241 TRACE(int10, "Setting VESA 800x600 24bpp\n");
242 VGA_SetMode(800,600,24);
243 break;
244 case 0x116:
245 TRACE(int10, "Setting VESA 1024x768 15bpp\n");
246 VGA_SetMode(1024,768,15);
247 break;
248 case 0x117:
249 TRACE(int10, "Setting VESA 1024x768 16bpp\n");
250 VGA_SetMode(1024,768,16);
251 break;
252 case 0x118:
253 TRACE(int10, "Setting VESA 1024x768 24bpp\n");
254 VGA_SetMode(1024,768,24);
255 break;
256 case 0x119:
257 TRACE(int10, "Setting VESA 1280x1024 15bpp\n");
258 VGA_SetMode(1280,1024,15);
259 break;
260 case 0x11A:
261 TRACE(int10, "Setting VESA 1280x1024 16bpp\n");
262 VGA_SetMode(1280,1024,16);
263 break;
264 case 0x11B:
265 TRACE(int10, "Setting VESA 1280x1024 24bpp\n");
266 VGA_SetMode(1280,1024,24);
267 break;
268 default:
269 FIXME(int10,"VESA Set Video Mode (0x%x) - Not Supported\n", BX_reg(context));
271 DOSMEM_BiosData()->VideoMode = BX_reg(context);
272 AL_reg(context) = 0x4f;
273 AH_reg(context) = 0x00;
274 break;
275 case 0x03: /* VESA SuperVGA BIOS - GET CURRENT VIDEO MODE */
276 AL_reg(context) = 0x4f;
277 AH_reg(context) = 0x00; /* should probly check if a vesa mode has ben set */
278 BX_reg(context) = DOSMEM_BiosData()->VideoMode;
279 break;
280 case 0x04: /* VESA SuperVGA BIOS - SAVE/RESTORE SuperVGA VIDEO STATE */
281 ERR(int10,"VESA SAVE/RESTORE Video State - Not Implemented\n");
282 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
283 /* maby we should do this instead ? */
284 /* AH_reg(context = 0x01; not implemented so just fail */
285 break;
286 case 0x05: /* VESA SuperVGA BIOS - CPU VIDEO MEMORY CONTROL */
287 ERR(int10,"VESA CPU VIDEO MEMORY CONTROL\n");
288 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
289 /* maby we should do this instead ? */
290 /* AH_reg(context = 0x001; not implemented so just fail */
291 break;
292 case 0x06: /* VESA GET/SET LOGICAL SCAN LINE LENGTH */
293 ERR(int10,"VESA GET/SET LOGICAL SCAN LINE LENGTH - Not Implemented\n");
294 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
295 /* maby we should do this instead ? */
296 /* AH_reg(context = 0x001; not implemented so just fail */
297 break;
298 case 0x07: /* GET/SET DISPLAY START */
299 ERR(int10,"VESA GET/SET DISPLAY START - Not Implemented\n");
300 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
301 /* maby we should do this instead ? */
302 /* AH_reg(context = 0x001; not implemented so just fail */
303 break;
304 case 0x08: /* GET/SET DAC PALETTE CONTROL */
305 ERR(int10,"VESA GET/SET DAC PALETTE CONTROL- Not Implemented\n");
306 /* AL_reg(context) = 0x4f; = supported so dont set since not implemented */
307 /* maby we should do this instead ? */
308 /* AH_reg(context = 0x001; not implemented so just fail */
309 break;
310 case 0xff: /* Turn VESA ON/OFF */
311 /* i dont know what to do */
312 break;
313 default:
314 FIXME(int10,"VESA Function (0x%x) - Not Supported\n", AH_reg(context));
315 break;
318 else {
320 switch(AH_reg(context)) {
322 case 0x00: /* SET VIDEO MODE */
323 /* Text Modes: */
324 /* (mode) (text rows/cols)
325 0x00 - 40x25
326 0x01 - 40x25
327 0x02 - 80x25
328 0x03 - 80x25 or 80x43 or 80x50 (assume 80x25)
329 0x07 - 80x25
332 switch (AL_reg(context)) {
333 case 0x00: /* 40x25 */
334 case 0x01:
335 VGA_Exit();
336 TRACE(int10, "Set Video Mode - Set to Text - 0x0%x\n",
337 AL_reg(context));
338 CONSOLE_ResizeScreen(40, 25);
339 CONSOLE_ClearScreen();
340 DOSMEM_BiosData()->VideoMode = AL_reg(context);
341 DOSMEM_BiosData()->VideoColumns = 40;
342 break;
343 case 0x02:
344 case 0x03:
345 case 0x07:
346 VGA_Exit();
347 TRACE(int10, "Set Video Mode - Set to Text - 0x0%x\n",
348 AL_reg(context));
349 CONSOLE_ResizeScreen(80, 25);
350 CONSOLE_ClearScreen();
351 DOSMEM_BiosData()->VideoMode = AL_reg(context);
352 DOSMEM_BiosData()->VideoColumns = 80;
353 break;
354 case 0x13:
355 TRACE(int10, "Setting VGA 320x200 256-color mode\n");
356 VGA_SetMode(320,200,8);
357 DOSMEM_BiosData()->VideoMode = AL_reg(context);
358 break;
359 default:
360 FIXME(int10, "Set Video Mode (0x%x) - Not Supported\n",
361 AL_reg(context));
363 break;
365 case 0x01: /* SET CURSOR SHAPE */
366 FIXME(int10, "Set Cursor Shape - Not Supported\n");
367 break;
369 case 0x02: /* SET CURSOR POSITION */
370 /* BH = Page Number */ /* Not supported */
371 /* DH = Row */ /* 0 is left */
372 /* DL = Column */ /* 0 is top */
373 if (BH_reg(context))
375 FIXME(int10, "Set Cursor Position: Cannot set to page %d\n",
376 BH_reg(context));
378 else
380 CONSOLE_MoveCursor(DH_reg(context), DL_reg(context));
381 TRACE(int10, "Set Cursor Position: %d %d\n", DH_reg(context),
382 DL_reg(context));
384 break;
386 case 0x03: /* GET CURSOR POSITION AND SIZE */
388 CHAR row, col;
390 FIXME(int10, "Get cursor position and size - partially supported\n");
391 CX_reg(context) = 0x0a0b; /* Bogus cursor data */
392 CONSOLE_GetCursorPosition(&row, &col);
393 DH_reg(context) = row;
394 DL_reg(context) = col;
396 break;
398 case 0x04: /* READ LIGHT PEN POSITION */
399 FIXME(int10, "Read Light Pen Position - Not Supported\n");
400 AH_reg(context) = 0x00; /* Not down */
401 break;
403 case 0x05: /* SELECT ACTIVE DISPLAY PAGE */
404 FIXME(int10, "Select Active Display Page - Not Supported\n");
405 break;
407 case 0x06: /* SCROLL UP WINDOW */
408 /* AL = Lines to scroll */
409 /* BH = Attribute */
410 /* CH,CL = row, col upper-left */
411 /* DH,DL = row, col lower-right */
412 scroll_window(SCROLL_UP, AL_reg(context), CH_reg(context),
413 CL_reg(context), DH_reg(context), DL_reg(context),
414 BH_reg(context));
415 TRACE(int10, "Scroll Up Window %d\n", AL_reg(context));
416 break;
418 case 0x07: /* SCROLL DOWN WINDOW */
419 /* AL = Lines to scroll */
420 /* BH = Attribute */
421 /* CH,CL = row, col upper-left */
422 /* DH,DL = row, col lower-right */
423 scroll_window(SCROLL_DOWN, AL_reg(context), CH_reg(context),
424 CL_reg(context), DH_reg(context), DL_reg(context),
425 BH_reg(context));
426 TRACE(int10, "Scroll Down Window %d\n", AL_reg(context));
427 break;
429 case 0x08: /* READ CHARACTER AND ATTRIBUTE AT CURSOR POSITION */
431 /* Note here that color data returned is bogus, will fix later. */
432 char ch;
433 int bg, fg, attr;
434 if (BH_reg(context)) /* Write to different page */
436 FIXME(int10, "Read character and attribute at cursor position -"
437 " Can't read from non-0 page\n");
438 AL_reg(context) = ' '; /* That page is blank */
439 AH_reg(context) = 7;
441 else
443 TRACE(int10,
444 "Read Character and Attribute at Cursor Position\n");
445 CONSOLE_GetCharacterAtCursor(&ch, &fg, &bg, &attr);
446 AL_reg(context) = ch;
447 AH_reg(context) = 7; /* FIXME: We're assuming wh on bl */
450 break;
452 case 0x09: /* WRITE CHARACTER AND ATTRIBUTE AT CURSOR POSITION */
453 /* AL = Character to display. */
454 /* BH = Page Number */ /* We can't write to non-0 pages, yet. */
455 /* BL = Attribute / Color */
456 /* CX = Times to Write Char */
457 /* Note here that the cursor is not advanced. */
458 write_char_attribute_at_cursor(AL_reg(context), BH_reg(context),
459 BL_reg(context), CX_reg(context));
460 if (CX_reg(context) > 1)
461 TRACE(int10, "Write Character and Attribute at Cursor Position "
462 "(Rep. %d) %c\n", CX_reg(context), AL_reg(context));
463 else
464 TRACE(int10, "Write Character and Attribute at Cursor"
465 "Position: %c\n", AL_reg(context));
466 break;
468 case 0x0a: /* WRITE CHARACTER ONLY AT CURSOR POSITION */
469 /* AL = Character to display. */
470 /* BH = Page Number */ /* We can't write to non-0 pages, yet. */
471 /* CX = Times to Write Char */
472 TRACE(int10, "Write Character at Cursor\n");
473 write_char_attribute_at_cursor(AL_reg(context), BH_reg(context),
474 0, CX_reg(context));
475 break;
477 case 0x0b:
478 switch BH_reg(context) {
479 case 0x00: /* SET BACKGROUND/BORDER COLOR */
480 /* In text modes, this sets only the border... */
481 /* According to the interrupt list and one of my books. */
482 /* Funny though that Beyond Zork seems to indicate that it
483 also sets up the default background attributes for clears
484 and scrolls... */
485 /* Bear in mind here that we do not want to change,
486 apparantly, the foreground or attribute of the background
487 with this call, so we should check first to see what the
488 foreground already is... FIXME */
489 TRACE(int10, "Set Background/Border Color: %d\n",
490 BL_reg(context));
491 CONSOLE_SetBackgroundColor(color_palette[0],
492 color_palette[BL_reg(context)]);
493 break;
494 case 0x01: /* SET PALETTE */
495 FIXME(int10, "Set Palette - Not Supported\n");
496 break;
497 default:
498 FIXME(int10, "INT 10 AH = 0x0b BH = 0x%x - Unknown\n",
499 BH_reg(context));
500 break;
502 break;
504 case 0x0c: /* WRITE GRAPHICS PIXEL */
505 /* Not in graphics mode, can ignore w/o error */
506 FIXME(int10, "Write Graphics Pixel - Not Supported\n");
507 break;
509 case 0x0d: /* READ GRAPHICS PIXEL */
510 /* Not in graphics mode, can ignore w/o error */
511 FIXME(int10, "Read Graphics Pixel - Not Supported\n");
512 break;
514 case 0x0e: /* TELETYPE OUTPUT */
515 TRACE(int10, "Teletype Output\n");
516 CONSOLE_Write(AL_reg(context), 0, 0, 0);
517 break;
519 case 0x0f: /* GET CURRENT VIDEO MODE */
520 TRACE(int10, "Get current video mode\n");
521 /* Note: This should not be a constant value. */
522 AL_reg(context) = DOSMEM_BiosData()->VideoMode;
523 AH_reg(context) = DOSMEM_BiosData()->VideoColumns;
524 BH_reg(context) = 0; /* Display page 0 */
525 break;
527 case 0x10:
528 switch AL_reg(context) {
529 case 0x00: /* SET SINGLE PALETTE REGISTER */
530 FIXME(int10, "Set Single Palette Register - Not Supported\n");
531 break;
532 case 0x01: /* SET BORDER (OVERSCAN) */
533 /* Text terminals have no overscan */
534 TRACE(int10, "Set Border (Overscan) - Ignored\n");
535 break;
536 case 0x02: /* SET ALL PALETTE REGISTERS */
537 FIXME(int10, "Set all palette registers - Not Supported\n");
538 break;
539 case 0x03: /* TOGGLE INTENSITY/BLINKING BIT */
540 FIXME(int10, "Toggle Intensity/Blinking Bit - Not Supported\n");
541 break;
542 case 0x07: /* GET INDIVIDUAL PALETTE REGISTER */
543 FIXME(int10, "Get Individual Palette Register - Not Supported\n");
544 break;
545 case 0x08: /* READ OVERSCAN (BORDER COLOR) REGISTER */
546 FIXME(int10,
547 "Read Overscan (Border Color) Register - Not Supported\n");
548 break;
549 case 0x09: /* READ ALL PALETTE REGISTERS AND OVERSCAN REGISTER */
550 FIXME(int10,
551 "Read All Palette Registers and Overscan Register "
552 " - Not Supported\n");
553 break;
554 case 0x10: /* SET INDIVIDUAL DAC REGISTER */
555 FIXME(int10, "Set Individual DAC register - Not Supported\n");
556 break;
557 case 0x12: /* SET BLOCK OF DAC REGISTERS */
558 FIXME(int10, "Set Block of DAC registers - Not Supported\n");
559 break;
560 case 0x13: /* SELECT VIDEO DAC COLOR PAGE */
561 FIXME(int10, "Select video DAC color page - Not Supported\n");
562 break;
563 case 0x15: /* READ INDIVIDUAL DAC REGISTER */
564 FIXME(int10, "Read individual DAC register - Not Supported\n");
565 break;
566 case 0x17: /* READ BLOCK OF DAC REGISTERS */
567 FIXME(int10, "Read block of DAC registers - Not Supported\n");
568 break;
569 case 0x18: /* SET PEL MASK */
570 FIXME(int10, "Set PEL mask - Not Supported\n");
571 break;
572 case 0x19: /* READ PEL MASK */
573 FIXME(int10, "Read PEL mask - Not Supported\n");
574 break;
575 case 0x1a: /* GET VIDEO DAC COLOR PAGE STATE */
576 FIXME(int10, "Get video DAC color page state - Not Supported\n");
577 break;
578 case 0x1b: /* PERFORM GRAY-SCALE SUMMING */
579 FIXME(int10, "Perform Gray-scale summing - Not Supported\n");
580 break;
581 default:
582 FIXME(int10, "INT 10 AH = 0x10 AL = 0x%x - Unknown\n",
583 AL_reg(context));
584 break;
586 break;
588 case 0x11: /* TEXT MODE CHARGEN */
589 /* Note that second subfunction is *almost* identical. */
590 /* See INTERRUPT.A for details. */
591 switch AH_reg(context) {
592 case 0x00: /* LOAD USER SPECIFIED PATTERNS */
593 case 0x10:
594 FIXME(int10, "Load User Specified Patterns - Not Supported\n");
595 break;
596 case 0x01: /* LOAD ROM MONOCHROME PATTERNS */
597 case 0x11:
598 FIXME(int10, "Load ROM Monochrome Patterns - Not Supported\n");
599 break;
600 case 0x02: /* LOAD ROM 8x8 DOUBLE-DOT PATTERNS */
601 case 0x12:
602 FIXME(int10,
603 "Load ROM 8x8 Double Dot Patterns - Not Supported\n");
604 break;
605 case 0x03: /* SET BLOCK SPECIFIER */
606 FIXME(int10, "Set Block Specifier - Not Supported\n");
607 break;
608 case 0x04: /* LOAD ROM 8x16 CHARACTER SET */
609 case 0x14:
610 FIXME(int10, "Load ROM 8x16 Character Set - Not Supported\n");
611 break;
612 case 0x20: /* SET USER 8x16 GRAPHICS CHARS */
613 FIXME(int10, "Set User 8x16 Graphics Chars - Not Supported\n");
614 break;
615 case 0x21: /* SET USER GRAPICS CHARACTERS */
616 FIXME(int10, "Set User Graphics Characters - Not Supported\n");
617 break;
618 case 0x22: /* SET ROM 8x14 GRAPHICS CHARS */
619 FIXME(int10, "Set ROM 8x14 Graphics Chars - Not Supported\n");
620 break;
621 case 0x23: /* SET ROM 8x8 DBL DOT CHARS */
622 FIXME(int10,
623 "Set ROM 8x8 Dbl Dot Chars (Graphics) - Not Supported\n");
624 break;
625 case 0x24: /* LOAD 8x16 GRAPHIC CHARS */
626 FIXME(int10, "Load 8x16 Graphic Chars - Not Supported\n");
627 break;
628 case 0x30: /* GET FONT INFORMATION */
629 FIXME(int10, "Get Font Information - Not Supported\n");
630 break;
631 default:
632 FIXME(int10, "INT 10 AH = 0x11 AL = 0x%x - Unknown\n",
633 AL_reg(context));
634 break;
636 break;
638 case 0x12: /* ALTERNATE FUNCTION SELECT */
639 switch BL_reg(context) {
640 case 0x10: /* GET EGA INFO */
641 TRACE(int10, "EGA info requested\n");
642 BH_reg(context) = 0x00; /* Color screen */
643 BL_reg(context) =
644 DOSMEM_BiosData()->ModeOptions >> 5; /* EGA memory size */
645 CX_reg(context) =
646 DOSMEM_BiosData()->FeatureBitsSwitches;
647 break;
648 case 0x20: /* ALTERNATE PRTSC */
649 FIXME(int10, "Install Alternate Print Screen - Not Supported\n");
650 break;
651 case 0x30: /* SELECT VERTICAL RESOULTION */
652 FIXME(int10, "Select vertical resolution - not supported\n");
653 break;
654 case 0x31: /* ENABLE/DISABLE DEFAULT PALETTE LOADING */
655 FIXME(int10, "Default palette loading - not supported\n");
656 DOSMEM_BiosData()->VGASettings =
657 (DOSMEM_BiosData()->VGASettings & 0xf7) |
658 ((AL_reg(context) == 1) << 3);
659 break;
660 case 0x32: /* ENABLE/DISABLE VIDEO ADDRERSSING */
661 FIXME(int10, "Video Addressing - Not Supported\n");
662 break;
663 case 0x33: /* ENABLE/DISABLE GRAY SCALE SUMMING */
664 FIXME(int10, "Gray Scale Summing - Not Supported\n");
665 break;
666 case 0x34: /* ENABLE/DISABLE CURSOR EMULATION */
667 TRACE(int10, "Set cursor emulation to %d\n", AL_reg(context));
668 DOSMEM_BiosData()->ModeOptions =
669 (DOSMEM_BiosData()->ModeOptions & 0xfe)|(AL_reg(context) == 1);
670 break;
671 case 0x36: /* VIDEO ADDRESS CONTROL */
672 FIXME(int10, "Video Address Control - Not Supported\n");
673 break;
674 default:
675 FIXME(int10, "INT 10 AH = 0x11 AL = 0x%x - Unknown\n",
676 AL_reg(context));
677 break;
679 break;
681 case 0x13: /* WRITE STRING */
682 /* This one does not imply that string be at cursor. */
683 FIXME(int10, "Write String - Not Supported\n");
684 break;
686 case 0x1a:
687 switch AL_reg(context) {
688 case 0x00: /* GET DISPLAY COMBINATION CODE */
689 TRACE(int10, "Get Display Combination Code\n");
690 AL_reg(context) = 0x1a;
691 BH_reg(context) = 0x08; /* VGA w/ color analog display */
692 BL_reg(context) = 0x00; /* No secondary hardware */
693 break;
694 case 0x01: /* SET DISPLAY COMBINATION CODE */
695 FIXME(int10, "Set Display Combination Code - Not Supported\n");
696 break;
697 default:
698 FIXME(int10, "INT 10 AH = 0x1a AL = 0x%x - Unknown\n",
699 AL_reg(context));
700 break;
702 break;
704 case 0x1b: /* FUNCTIONALITY/STATE INFORMATION */
705 FIXME(int10, "Get functionality/state information - partially implemented\n");
706 if (BX_reg(context) == 0x0)
708 AL_reg(context) = 0x1b;
709 if (ISV86(context)) /* real */
710 ES_reg(context) = 0xf000;
711 else
712 ES_reg(context) = DOSMEM_BiosSysSeg;
713 BX_reg(context) = 0xe000;
715 break;
717 case 0x1c: /* SAVE/RESTORE VIDEO STATE */
718 FIXME(int10, "Save/Restore Video State - Not Supported\n");
719 break;
721 case 0x4f: /* Get SuperVGA INFORMATION */
723 BYTE *p =
724 CTX_SEG_OFF_TO_LIN(context, ES_reg(context), EDI_reg(context));
725 /* BOOL16 vesa20 = (*(DWORD *)p == *(DWORD *)"VBE2"); */
727 TRACE(int10, "Get SuperVGA information\n");
728 AH_reg(context) = 0;
729 *(DWORD *)p = *(DWORD *)"VESA";
730 *(WORD *)(p+0x04) = 0x0200; /* VESA 2.0 */
731 *(DWORD *)(p+0x06) = NULL; /* pointer to OEM name */
732 *(DWORD *)(p+0x0a) = 0xfffffffd; /* capabilities flags :-) */
734 break;
735 default:
736 FIXME(int10, "Unknown - 0x%x\n", AH_reg(context));
737 INT_BARF( context, 0x10 );
742 static void write_char_attribute_at_cursor(char output, char page_num,
743 char attribute, short times)
745 /* Contrary to the interrupt list, this routine should not advance
746 the cursor. To keep this logic simple, we won't use the
747 CONSOLE_Put() routine.
750 int wattribute, fg_color, bg_color;
751 char x, y;
753 if (page_num) /* Only support one text page right now */
755 FIXME(int10, "Cannot write to alternate page %d", page_num);
756 return;
759 conv_text_mode_attributes(attribute, &fg_color, &bg_color,
760 &wattribute);
762 TRACE(int10, "Fore: %d Back: %d\n", fg_color, bg_color);
764 CONSOLE_GetCursorPosition(&x, &y);
766 while (times)
768 CONSOLE_Write(output, fg_color, bg_color, attribute);
769 times--;
772 CONSOLE_MoveCursor(x, y);
775 static void conv_text_mode_attributes(char attribute, int *fg, int *bg,
776 int *wattribute)
778 /* This is a local function to convert the text-mode attributes
779 to Wine's color and attribute scheme */
781 /* Foreground Color is stored in bits 3 through 0 */
782 /* Background Color is stored in bits 6 through 4 */
783 /* If this has bit 7 set, then we need to blink */
785 *fg = color_palette[attribute & 15];
786 *bg = color_palette[(attribute & 112) / 16];
787 *wattribute = attribute & 128;
791 static void scroll_window(int direction, char lines, char row1,
792 char col1, char row2, char col2, char attribute)
794 int wattribute, bg_color, fg_color;
796 conv_text_mode_attributes(attribute, &fg_color, &bg_color,
797 &wattribute);
799 if (!lines) /* Actually, clear the window */
801 CONSOLE_ClearWindow(row1, col1, row2, col2, bg_color, wattribute);
803 else if (direction == SCROLL_UP)
805 CONSOLE_ScrollUpWindow(row1, col1, row2, col2, lines, bg_color,
806 wattribute);
808 else
810 CONSOLE_ScrollDownWindow(row1, col1, row2, col2, lines, bg_color,
811 wattribute);