diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/msdos.c | 35 |
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. */ | |||
| 62 | #define _USE_LFN 0 | 62 | #define _USE_LFN 0 |
| 63 | #endif | 63 | #endif |
| 64 | 64 | ||
| 65 | #ifndef _dos_ds | ||
| 66 | #define _dos_ds _go32_info_block.selector_for_linear_memory | ||
| 67 | #endif | ||
| 68 | |||
| 65 | #if __DJGPP__ > 1 | 69 | #if __DJGPP__ > 1 |
| 66 | 70 | ||
| 67 | #include <signal.h> | 71 | #include <signal.h> |
| @@ -370,17 +374,39 @@ ScreenVisualBell (void) | |||
| 370 | 374 | ||
| 371 | #ifndef HAVE_X_WINDOWS | 375 | #ifndef HAVE_X_WINDOWS |
| 372 | 376 | ||
| 377 | static int blink_bit = -1; /* the state of the blink bit at startup */ | ||
| 378 | |||
| 373 | /* Enable bright background colors. */ | 379 | /* Enable bright background colors. */ |
| 374 | static void | 380 | static void |
| 375 | bright_bg (void) | 381 | bright_bg (void) |
| 376 | { | 382 | { |
| 377 | union REGS regs; | 383 | union REGS regs; |
| 378 | 384 | ||
| 385 | /* Remember the original state of the blink/bright-background bit. | ||
| 386 | It is stored at 0040:0065h in the BIOS data area. */ | ||
| 387 | if (blink_bit == -1) | ||
| 388 | blink_bit = (_farpeekb (_dos_ds, 0x465) & 0x20) == 0x20; | ||
| 389 | |||
| 379 | regs.h.bl = 0; | 390 | regs.h.bl = 0; |
| 380 | regs.x.ax = 0x1003; | 391 | regs.x.ax = 0x1003; |
| 381 | int86 (0x10, ®s, ®s); | 392 | int86 (0x10, ®s, ®s); |
| 382 | } | 393 | } |
| 383 | 394 | ||
| 395 | /* Disable bright background colors (and enable blinking) if we found | ||
| 396 | the video system in that state at startup. */ | ||
| 397 | static void | ||
| 398 | maybe_enable_blinking (void) | ||
| 399 | { | ||
| 400 | if (blink_bit == 1) | ||
| 401 | { | ||
| 402 | union REGS regs; | ||
| 403 | |||
| 404 | regs.h.bl = 1; | ||
| 405 | regs.x.ax = 0x1003; | ||
| 406 | int86 (0x10, ®s, ®s); | ||
| 407 | } | ||
| 408 | } | ||
| 409 | |||
| 384 | /* Set the screen dimensions so that it can show no less than | 410 | /* Set the screen dimensions so that it can show no less than |
| 385 | ROWS x COLS frame. */ | 411 | ROWS x COLS frame. */ |
| 386 | 412 | ||
| @@ -869,6 +895,10 @@ IT_reset_terminal_modes (void) | |||
| 869 | return; | 895 | return; |
| 870 | 896 | ||
| 871 | mouse_off (); | 897 | mouse_off (); |
| 898 | |||
| 899 | /* Leave the video system in the same state as we found it, | ||
| 900 | as far as the blink/bright-background bit is concerned. */ | ||
| 901 | maybe_enable_blinking (); | ||
| 872 | 902 | ||
| 873 | /* We have a situation here. | 903 | /* We have a situation here. |
| 874 | We cannot just do ScreenUpdate(startup_screen_buffer) because | 904 | We cannot just do ScreenUpdate(startup_screen_buffer) because |
| @@ -3010,6 +3040,11 @@ run_msdos_command (argv, dir, tempin, tempout, temperr) | |||
| 3010 | mouse_init (); | 3040 | mouse_init (); |
| 3011 | mouse_moveto (x, y); | 3041 | mouse_moveto (x, y); |
| 3012 | } | 3042 | } |
| 3043 | |||
| 3044 | /* Some programs might change the meaning of the highest bit of the | ||
| 3045 | text attribute byte, so we get blinking characters instead of the | ||
| 3046 | bright background colors. Restore that. */ | ||
| 3047 | bright_bg (); | ||
| 3013 | 3048 | ||
| 3014 | done: | 3049 | done: |
| 3015 | chdir (oldwd); | 3050 | chdir (oldwd); |