summaryrefslogtreecommitdiff
path: root/src/msdos.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-01-06 21:23:25 +0000
committerRichard M. Stallman <rms@gnu.org>1997-01-06 21:23:25 +0000
commitd551fe2d3954e25f6f437a86df606e10b5bd6486 (patch)
tree18bc2417f6e55d6d668e0dd85acce387e004d6a7 /src/msdos.c
parent0521db9b9a193e903addb40cd045ce2fbe7cea45 (diff)
downloademacs-d551fe2d3954e25f6f437a86df606e10b5bd6486.tar.gz
(bright_bg): Save the original state of video blink bit.
(maybe_enable_blinking): New function, restores the original state of the blink bit. (IT_reset_terminal_modes): Restore the original state of the blink bit when suspending/exiting. (run_msdos_command): Make sure bright background colors are again enabled after subsidiary program returns.
Diffstat (limited to 'src/msdos.c')
-rw-r--r--src/msdos.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/msdos.c b/src/msdos.c
index 0b4cc858e16..d809fffd46a 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -62,6 +62,10 @@ Boston, MA 02111-1307, USA. */
#define _USE_LFN 0
#endif
+#ifndef _dos_ds
+#define _dos_ds _go32_info_block.selector_for_linear_memory
+#endif
+
#if __DJGPP__ > 1
#include <signal.h>
@@ -370,17 +374,39 @@ ScreenVisualBell (void)
#ifndef HAVE_X_WINDOWS
+static int blink_bit = -1; /* the state of the blink bit at startup */
+
/* Enable bright background colors. */
static void
bright_bg (void)
{
union REGS regs;
+ /* Remember the original state of the blink/bright-background bit.
+ It is stored at 0040:0065h in the BIOS data area. */
+ if (blink_bit == -1)
+ blink_bit = (_farpeekb (_dos_ds, 0x465) & 0x20) == 0x20;
+
regs.h.bl = 0;
regs.x.ax = 0x1003;
int86 (0x10, &regs, &regs);
}
+/* Disable bright background colors (and enable blinking) if we found
+ the video system in that state at startup. */
+static void
+maybe_enable_blinking (void)
+{
+ if (blink_bit == 1)
+ {
+ union REGS regs;
+
+ regs.h.bl = 1;
+ regs.x.ax = 0x1003;
+ int86 (0x10, &regs, &regs);
+ }
+}
+
/* Set the screen dimensions so that it can show no less than
ROWS x COLS frame. */
@@ -869,6 +895,10 @@ IT_reset_terminal_modes (void)
return;
mouse_off ();
+
+ /* Leave the video system in the same state as we found it,
+ as far as the blink/bright-background bit is concerned. */
+ maybe_enable_blinking ();
/* We have a situation here.
We cannot just do ScreenUpdate(startup_screen_buffer) because
@@ -3010,6 +3040,11 @@ run_msdos_command (argv, dir, tempin, tempout, temperr)
mouse_init ();
mouse_moveto (x, y);
}
+
+ /* Some programs might change the meaning of the highest bit of the
+ text attribute byte, so we get blinking characters instead of the
+ bright background colors. Restore that. */
+ bright_bg ();
done:
chdir (oldwd);