diff options
Diffstat (limited to 'src/mesa/drivers/dos/vga')
-rw-r--r-- | src/mesa/drivers/dos/vga/vga.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/mesa/drivers/dos/vga/vga.c b/src/mesa/drivers/dos/vga/vga.c index 1888d98947..d1d2db51b5 100644 --- a/src/mesa/drivers/dos/vga/vga.c +++ b/src/mesa/drivers/dos/vga/vga.c @@ -31,6 +31,7 @@ */
+#include <pc.h>
#include <stdlib.h>
#include "vga.h"
@@ -158,22 +159,23 @@ static void vga_restore (void) * In : color index, R, G, B
* Out : -
*
- * Note: uses normalized values
+ * Note: uses integer values
*/
-static void vga_setCI_f (int index, float red, float green, float blue)
+static void vga_setCI_i (int index, int red, int green, int blue)
{
- float max = (1 << vga_color_precision) - 1;
-
- int _red = red * max;
- int _green = green * max;
- int _blue = blue * max;
-
+#if 0
__asm("\n\
movw $0x1010, %%ax \n\
movb %1, %%dh \n\
movb %2, %%ch \n\
int $0x10 \n\
- "::"b"(index), "m"(_red), "m"(_green), "c"(_blue):"%eax", "%edx");
+ "::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx");
+#else
+ outportb(0x03C8, index);
+ outportb(0x03C9, red);
+ outportb(0x03C9, green);
+ outportb(0x03C9, blue);
+#endif
}
@@ -183,16 +185,13 @@ static void vga_setCI_f (int index, float red, float green, float blue) * In : color index, R, G, B
* Out : -
*
- * Note: uses integer values
+ * Note: uses normalized values
*/
-static void vga_setCI_i (int index, int red, int green, int blue)
+static void vga_setCI_f (int index, float red, float green, float blue)
{
- __asm("\n\
- movw $0x1010, %%ax \n\
- movb %1, %%dh \n\
- movb %2, %%ch \n\
- int $0x10 \n\
-"::"b"(index), "m"(red), "m"(green), "c"(blue):"%eax", "%edx");
+ float max = (1 << vga_color_precision) - 1;
+
+ vga_setCI_i(index, (int)(red * max), (int)(green * max), (int)(blue * max));
}
|