Author: ion
Date: Sun Aug 25 23:13:00 2013
New Revision: 59826
URL:
http://svn.reactos.org/svn/reactos?rev=59826&view=rev
Log:
[SACDRV]: A few more ANSI commands. Also now that I grok ANSI, CursorX and CursorY were
actually back/fore colors. Also define cursor flags/attributes that SAC supports (bold,
inverted, blinking).
WANTED: The fact that the SAC developers cherry-picked *which* ANSI standard and VT
standard they were going to follow, threw in ANSI.SYS compatibility, and then added a
bunch of bugs, makes me wonder if real people use SAC on Windows...
Modified:
trunk/reactos/drivers/sac/driver/sacdrv.h
trunk/reactos/drivers/sac/driver/vtutf8chan.c
Modified: trunk/reactos/drivers/sac/driver/sacdrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/sacdrv.…
==============================================================================
--- trunk/reactos/drivers/sac/driver/sacdrv.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/sacdrv.h [iso-8859-1] Sun Aug 25 23:13:00 2013
@@ -174,6 +174,13 @@
#define SAC_CHANNEL_FLAG_LOCK_EVENT 0x8
#define SAC_CHANNEL_FLAG_REDRAW_EVENT 0x10
#define SAC_CHANNEL_FLAG_APPLICATION 0x20
+
+//
+// Cursor Flags
+//
+#define SAC_CURSOR_FLAG_BLINK 1
+#define SAC_CURSOR_FLAG_BOLD 2
+#define SAC_CURSOR_FLAG_INVERTED 4
//
// Forward definitions
@@ -226,6 +233,8 @@
SacEraseEndOfScreen,
SacEraseStartOfScreen,
SacEraseScreen,
+ SacSetCursorPosition,
+ SacSetScrollRegion,
SacSetBackgroundColor = 21,
SacSetFontColor
} SAC_ANSI_COMMANDS;
@@ -272,9 +281,9 @@
//
typedef struct _SAC_CURSOR_DATA
{
- UCHAR CursorX;
- UCHAR CursorY;
- UCHAR CursorVisible;
+ UCHAR CursorBackColor;
+ UCHAR CursorColor;
+ UCHAR CursorFlags;
WCHAR CursorValue;
} SAC_CURSOR_DATA, *PSAC_CURSOR_DATA;
C_ASSERT(sizeof(SAC_CURSOR_DATA) == 6);
@@ -403,9 +412,9 @@
LONG ChannelHasNewIBufferData;
UCHAR CursorRow;
UCHAR CursorCol;
- UCHAR CursorY;
- UCHAR CursorX;
- UCHAR CursorVisible;
+ UCHAR CursorColor;
+ UCHAR CursorBackColor;
+ UCHAR CursorFlags;
PCHAR OBuffer;
ULONG OBufferIndex;
ULONG OBufferFirstGoodIndex;
Modified: trunk/reactos/drivers/sac/driver/vtutf8chan.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/sac/driver/vtutf8c…
==============================================================================
--- trunk/reactos/drivers/sac/driver/vtutf8chan.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/sac/driver/vtutf8chan.c [iso-8859-1] Sun Aug 25 23:13:00 2013
@@ -161,6 +161,9 @@
#define VT_ANSI_SET_ATTRIBUTE_CHAR L'm'
#define VT_ANSI_SEPARATOR_CHAR L';'
+#define VT_ANSI_HVP_CURSOR_CHAR L'f'
+#define VT_ANSI_CUP_CURSOR_CHAR L'H'
+#define VT_ANSI_SCROLL_CHAR L'r'
SAC_STATIC_ESCAPE_STRING SacStaticEscapeStrings [] =
{
@@ -343,8 +346,8 @@
}
if (*Sequence != VT_ANSI_SEPARATOR_CHAR) return 0;
+
Sequence++;
-
if (!VTUTF8ChannelScanForNumber(Sequence, &Number2)) return 0;
while ((*Sequence >= L'0') && (*Sequence <= L'9'))
Sequence++;
@@ -354,9 +357,9 @@
goto ProcessString;
}
- if (*Sequence == L'H')
- {
- Action = 18;
+ if (*Sequence == VT_ANSI_CUP_CURSOR_CHAR)
+ {
+ Action = SacSetCursorPosition;
goto ProcessString;
}
@@ -364,15 +367,16 @@
Sequence++;
- if ((*Sequence == L'H') || (*Sequence == L'f'))
- {
- Action = 18;
+ if ((*Sequence == VT_ANSI_CUP_CURSOR_CHAR) ||
+ (*Sequence == VT_ANSI_HVP_CURSOR_CHAR))
+ {
+ Action = SacSetCursorPosition;
goto ProcessString;
}
- if (*Sequence == L'r')
- {
- Action = 19;
+ if (*Sequence == VT_ANSI_SCROLL_CHAR)
+ {
+ Action = SacSetScrollRegion;
goto ProcessString;
}
@@ -394,7 +398,7 @@
VTUTF8ChannelAssertCursor(Channel);
switch (Action)
{
- case 0:
+ case SacCursorUp:
if (Channel->CursorRow < Number)
{
Channel->CursorRow = 0;
@@ -406,7 +410,7 @@
VTUTF8ChannelAssertCursor(Channel);
break;
- case 1:
+ case SacCursorDown:
if (Channel->CursorRow >= SAC_VTUTF8_ROW_HEIGHT)
{
Channel->CursorRow = SAC_VTUTF8_ROW_HEIGHT;
@@ -418,7 +422,7 @@
VTUTF8ChannelAssertCursor(Channel);
break;
- case 3:
+ case SacCursorLeft:
if (Channel->CursorCol < Number)
{
Channel->CursorCol = 0;
@@ -430,7 +434,7 @@
VTUTF8ChannelAssertCursor(Channel);
break;
- case 2:
+ case SacCursorRight:
if (Channel->CursorCol >= SAC_VTUTF8_COL_WIDTH)
{
Channel->CursorCol = SAC_VTUTF8_COL_WIDTH;
@@ -442,110 +446,110 @@
VTUTF8ChannelAssertCursor(Channel);
break;
- case 4:
- Channel->CursorVisible = 0;
- Channel->CursorX = 40;
- Channel->CursorY = 37;
- break;
-
- case 5:
- Channel->CursorVisible |= 1;
- break;
-
- case 6:
- Channel->CursorVisible &= ~1;
- break;
-
- case 7:
- Channel->CursorVisible |= 2;
- break;
-
- case 8:
- Channel->CursorVisible &= ~2;
- break;
-
- case 9:
- Channel->CursorVisible |= 4;
- break;
-
- case 10:
- Channel->CursorVisible &= ~4;
- break;
-
- case 12:
+ case SacFontNormal:
+ Channel->CursorFlags = 0;
+ Channel->CursorBackColor = SetBackColorBlack;
+ Channel->CursorColor = SetColorWhite;
+ break;
+
+ case SacFontBlink:
+ Channel->CursorFlags |= SAC_CURSOR_FLAG_BLINK;
+ break;
+
+ case SacFontBlinkOff:
+ Channel->CursorFlags &= ~SAC_CURSOR_FLAG_BLINK;
+ break;
+
+ case SacFontBold:
+ Channel->CursorFlags |= SAC_CURSOR_FLAG_BOLD;
+ break;
+
+ case SacFontBoldOff:
+ Channel->CursorFlags &= ~SAC_CURSOR_FLAG_BOLD;
+ break;
+
+ case SacFontInverse:
+ Channel->CursorFlags |= SAC_CURSOR_FLAG_INVERTED;
+ break;
+
+ case SacFontInverseOff:
+ Channel->CursorFlags &= ~SAC_CURSOR_FLAG_INVERTED;
+ break;
+
+ case SacEraseEndOfLine:
for (i = Channel->CursorCol; i < SAC_VTUTF8_COL_WIDTH; i++)
{
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
- (i * SAC_VTUTF8_ROW_HEIGHT)].CursorVisible =
Channel->CursorVisible;
- Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
- (i * SAC_VTUTF8_ROW_HEIGHT)].CursorX = Channel->CursorY;
- Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
- (i * SAC_VTUTF8_ROW_HEIGHT)].CursorY = Channel->CursorX;
+ (i * SAC_VTUTF8_ROW_HEIGHT)].CursorFlags =
Channel->CursorFlags;
+ Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
+ (i * SAC_VTUTF8_ROW_HEIGHT)].CursorBackColor =
Channel->CursorColor;
+ Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
+ (i * SAC_VTUTF8_ROW_HEIGHT)].CursorColor =
Channel->CursorBackColor;
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorValue = ' ';
}
break;
- case 13:
+ case SacEraseStartOfLine:
for (i = 0; i < (Channel->CursorCol + 1); i++)
{
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
- (i * SAC_VTUTF8_ROW_HEIGHT)].CursorVisible =
Channel->CursorVisible;
- Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
- (i * SAC_VTUTF8_ROW_HEIGHT)].CursorX = Channel->CursorY;
- Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
- (i * SAC_VTUTF8_ROW_HEIGHT)].CursorY = Channel->CursorX;
+ (i * SAC_VTUTF8_ROW_HEIGHT)].CursorFlags =
Channel->CursorFlags;
+ Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
+ (i * SAC_VTUTF8_ROW_HEIGHT)].CursorBackColor =
Channel->CursorColor;
+ Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
+ (i * SAC_VTUTF8_ROW_HEIGHT)].CursorColor =
Channel->CursorBackColor;
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorValue = ' ';
}
break;
- case 14:
+ case SacEraseLine:
for (i = 0; i < SAC_VTUTF8_COL_WIDTH; i++)
{
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
- (i * SAC_VTUTF8_ROW_HEIGHT)].CursorVisible =
Channel->CursorVisible;
- Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
- (i * SAC_VTUTF8_ROW_HEIGHT)].CursorX = Channel->CursorY;
- Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
- (i * SAC_VTUTF8_ROW_HEIGHT)].CursorY = Channel->CursorX;
+ (i * SAC_VTUTF8_ROW_HEIGHT)].CursorFlags =
Channel->CursorFlags;
+ Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
+ (i * SAC_VTUTF8_ROW_HEIGHT)].CursorBackColor =
Channel->CursorColor;
+ Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
+ (i * SAC_VTUTF8_ROW_HEIGHT)].CursorColor =
Channel->CursorBackColor;
Cursor[(Channel->CursorRow * SAC_VTUTF8_COL_WIDTH) +
(i * SAC_VTUTF8_ROW_HEIGHT)].CursorValue = ' ';
}
break;
- case 15:
- break;
-
- case 16:
- break;
-
- case 17:
- break;
-
- case 18:
- break;
-
- case 19:
+ case SacEraseEndOfScreen:
+ break;
+
+ case SacEraseStartOfScreen:
+ break;
+
+ case SacEraseScreen:
+ break;
+
+ case SacSetCursorPosition:
+ break;
+
+ case SacSetScrollRegion:
break;
case 20:
- Channel->CursorY = Number;
- Channel->CursorX = Number2;
- break;
-
- case 21:
- Channel->CursorX = Number;
- break;
-
- case 22:
- Channel->CursorY = Number;
+ Channel->CursorColor = Number;
+ Channel->CursorBackColor = Number2;
+ break;
+
+ case SacSetBackgroundColor:
+ Channel->CursorBackColor = Number;
+ break;
+
+ case SacSetFontColor:
+ Channel->CursorColor = Number;
break;
case 23:
- Channel->CursorVisible = Number;
- Channel->CursorY = Number2;
- Channel->CursorX = Number3;
+ Channel->CursorFlags = Number;
+ Channel->CursorColor = Number2;
+ Channel->CursorBackColor = Number3;
break;
default:
break;
@@ -563,13 +567,13 @@
CHECK_PARAMETER(Channel);
/* Set the current channel cursor parameters */
- Channel->CursorVisible = 0;
- Channel->CursorX = 40;
- Channel->CursorY = 37;
+ Channel->CursorFlags = 0;
+ Channel->CursorBackColor = SetBackColorBlack;
+ Channel->CursorColor = SetColorWhite;
/* Loop the output buffer height by width */
Cursor = (PSAC_CURSOR_DATA)Channel->OBuffer;
- y = SAC_VTUTF8_COL_HEIGHT - 1;
+ y = SAC_VTUTF8_ROW_HEIGHT;
do
{
x = SAC_VTUTF8_COL_WIDTH;
@@ -577,8 +581,8 @@
{
/* For every character, set the defaults */
Cursor->CursorValue = ' ';
- Cursor->CursorX = 40;
- Cursor->CursorY = 38;
+ Cursor->CursorBackColor = SetBackColorBlack;
+ Cursor->CursorColor = SetColorWhite;
/* Move to the next character */
Cursor++;