int10 SetCursorShape

Andreas Mohr andi at rhlx01.fht-esslingen.de
Sat Jun 29 17:41:07 CDT 2002


Hi all,

I was completely and utterly flabbergasted when I found out that
IDA DOS version is working (almost) beautifully on wineconsole !

Thus I decided to implement a missing set cursor shape functionality
right away.

BTW, "almost" meaning that the display is perfect
(see http://home.arcor.de/wineshots/ida.png), but it is still very SLOOOW.
I guess now there's some real incentive to improve something...

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: dlls/winedos/int10.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/int10.c,v
retrieving revision 1.13
diff -u -r1.13 int10.c
--- dlls/winedos/int10.c	31 May 2002 23:40:54 -0000	1.13
+++ dlls/winedos/int10.c	29 Jun 2002 22:38:22 -0000
@@ -36,11 +36,10 @@
 #define SCROLL_UP 1
 #define SCROLL_DOWN 2
 
-/* FIXME: is row or column first? */
 static void BIOS_GetCursorPos(BIOSDATA*data,unsigned page,unsigned*X,unsigned*Y)
 {
-  *X = data->VideoCursorPos[page*2];
-  *Y = data->VideoCursorPos[page*2+1];
+  *X = data->VideoCursorPos[page*2];   /* column */
+  *Y = data->VideoCursorPos[page*2+1]; /* row */
 }
 
 static void BIOS_SetCursorPos(BIOSDATA*data,unsigned page,unsigned X,unsigned Y)
@@ -365,7 +364,9 @@
         break;
 
     case 0x01: /* SET CURSOR SHAPE */
-        FIXME("Set Cursor Shape - Not Supported\n");
+        TRACE("Set Cursor Shape start %d end %d options %d\n", CH_reg(context) & 0x1f, CL_reg(context) & 0x1f, CH_reg(context) & 0xe0);
+        data->VideoCursorType = CX_reg(context); /* direct copy */
+	VGA_SetCursorShape(CH_reg(context), CL_reg(context));
         break;
 
     case 0x02: /* SET CURSOR POSITION */
Index: dlls/winedos/vga.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.c,v
retrieving revision 1.14
diff -u -r1.14 vga.c
--- dlls/winedos/vga.c	24 Jun 2002 22:57:28 -0000	1.14
+++ dlls/winedos/vga.c	29 Jun 2002 22:38:22 -0000
@@ -473,6 +473,21 @@
     if (Yres) *Yres=info.dwSize.Y;
 }
 
+void VGA_SetCursorShape(unsigned char start_options, unsigned char end)
+{
+    CONSOLE_CURSOR_INFO cci;
+
+    /* standard cursor settings:
+     * 0x0607 == CGA, 0x0b0c == monochrome, 0x0d0e == EGA/VGA */
+
+    /* calculate percentage from bottom - assuming VGA (bottom 0x0e) */
+    cci.dwSize = ((end & 0x1f) - (start_options & 0x1f))/0x0e * 100; 
+    if (!cci.dwSize) cci.dwSize++; /* NULL cursor would make SCCI() fail ! */
+    cci.bVisible = ((start_options & 0x60) != 0x20); /* invisible ? */
+
+    SetConsoleCursorInfo(VGA_AlphaConsole(),&cci);
+}
+
 void VGA_SetCursorPos(unsigned X,unsigned Y)
 {
     COORD pos;
Index: dlls/winedos/vga.h
===================================================================
RCS file: /home/wine/wine/dlls/winedos/vga.h,v
retrieving revision 1.8
diff -u -r1.8 vga.h
--- dlls/winedos/vga.h	31 May 2002 23:40:54 -0000	1.8
+++ dlls/winedos/vga.h	29 Jun 2002 22:38:22 -0000
@@ -40,6 +40,7 @@
 /* text mode */
 int VGA_SetAlphaMode(unsigned Xres,unsigned Yres);
 void VGA_GetAlphaMode(unsigned*Xres,unsigned*Yres);
+void VGA_SetCursorShape(unsigned char start_options,unsigned char end);
 void VGA_SetCursorPos(unsigned X,unsigned Y);
 void VGA_GetCursorPos(unsigned*X,unsigned*Y);
 void VGA_WriteChars(unsigned X,unsigned Y,unsigned ch,int attr,int count);
Index: include/miscemu.h
===================================================================
RCS file: /home/wine/wine/include/miscemu.h,v
retrieving revision 1.48
diff -u -r1.48 miscemu.h
--- include/miscemu.h	31 May 2002 23:06:48 -0000	1.48
+++ include/miscemu.h	29 Jun 2002 22:38:22 -0000
@@ -60,7 +60,7 @@
     WORD  VideoColumns;              /* 4a: Number of columns */
     WORD  VideoPageSize;             /* 4c: Video page size in bytes */
     WORD  VideoPageStartAddr;        /* 4e: Video page start address */
-    BYTE  VideoCursorPos[16];        /* 50: Cursor position for 8 pages */
+    BYTE  VideoCursorPos[16];        /* 50: Cursor position for 8 pages, column/row order */
     WORD  VideoCursorType;           /* 60: Video cursor type */
     BYTE  VideoCurPage;              /* 62: Video current page */
     WORD  VideoCtrlAddr WINE_PACKED; /* 63: Video controller address */


More information about the wine-patches mailing list