Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > strange bright/blink behavior
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 13th June 06:46
giorgio medeot
External User
 
Posts: 1
Default strange bright/blink behavior



Hi all.
I hope someone can help me with this code:

/***** foo.c *****/
#include <conio.h>
#include <pc.h>

int
main()
{
unsigned char oldScreen;

oldScreen = ScreenAttrib;
ScreenAttrib |= 0x80; /* sets blink bit */
putch('a');
ScreenAttrib = oldScreen;
return 0;
}
/*****************/

I compile with: gcc foo.c -o foo.exe
My DJGPP installation includes gcc 1.3.1 and djdev203 June 2002 refresh.
OS is Windows 98 SE.

When I launch foo.exe, if the DOS prompt is located at the bottom of the
screen, so that executing foo.exe causes the screen to scroll, all new
lines that are printed also look as they had the blink bit set. Typing
'cls' at the
prompt restores the screen. I tried normvideo(), with no results.
I tried both executing foo.exe in plain DOS or in a Windows DOS box and
I saw the same behavior. What may be happening?

Regards, Jo.
  Reply With Quote


  sponsored links


2 13th June 06:46
hans-bernhard broeker
External User
 
Posts: 1
Default strange bright/blink behavior



I suspect that's because the effect of updating "ScreenAttrib" only takes
place if you actually output a character.
I think you should rather use one of the other <conio.h> functions
instead of putch(), which take the attribute as one of their
arguments, and leave ScreenAttrib alone. See, e.g., ScreenPutChar().


--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
  Reply With Quote
3 13th June 06:46
giorgio medeot
External User
 
Posts: 1
Default strange bright/blink behavior


If I putch() a new character after restoring ScreenAttrib, it looks ok (so
"ScreenAttrib" should have been updated); but after foo has exited, new
lines on the screen still blink. Moreover, if I type at the DOS prompt:
cls
foo.exe
nothing strange happens, but if I press the enter key many times, reaching
the bottom of the screen, and then I type foo.exe, pressing now enter
gives me the blinking lines. This makes no sense to me.


I'll give it a try, but it's a little tedious to me having to get the
current cursor position every time I need to print a character

Thank you for helping, Jo.
  Reply With Quote
4 13th June 06:46
gisle vanem
External User
 
Posts: 1
Default strange bright/blink behavior


"Gi****o Medeot" <gmedeot@yahoo.it> said:

Smells like a ANSI driver problem. Do you by any chance use
Dan Kegel's NNANSI.SYS? If so, it has problems with the fast writing
mode. It can be turned off with "echo <27>[?98l". And on with
"echo <27>[?98h".

--gv
  Reply With Quote
5 13th June 06:46
giorgio medeot
External User
 
Posts: 1
Default strange bright/blink behavior


"Gisle Vanem" <giva@bgnett.no> ha scritto nel messaggio
news:28bd01c385c7$98599660$0600000a@broadpark.no.. .

reaching


Mmm, I don't use a ANSI driver at all: to double check, I've booted in DOS
ignoring the configuration files, and the problem is still here

Jo
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666