Mail Archives: djgpp/1995/03/21/19:16:50
I wrote:-
> According to a manual that came with my PC:-
> Addresses 0xb0000000 etseq are the screen when in black & white text ...
ld AT netrix DOT com replied:-
> These are supposed to be: b000:0000 -> 0xe00b0000 ...
That I already knew; what I was wondering about was this:-
> I wrote a program (a text editor called AAEMACS) that needs the PC's
> screen to be in a text mode. It tests for mode type thus:-
> #define uns unsigned
> uns char*graphicalscreen=(uns char*)0xd0000000; /**** this addr only in Gnu C
> and I set the byte graphicalscreen[44] = 16. If thereupon the byte
> graphicalscreen[44] == 16, then the graphical screen address range exists
> and I am in a graphical mode, not a text mode, so I complain and exit. ...
but someone seems to have a PC where the graphical screen addresses exist even
when he is in text mode 3, which upsets the above way to tell which mode.
ld AT netrix DOT com replied:-
> This doesn't work unless you have a new SVGA card with linear addressing
> enabled. Or, if you ran it on a PC that has enough RAM to fill up to
> 0xd0000000, you'll get a wrong prediction. Why don't just call int 10h
> and/or VESA interrupt to see if you're in graphic mode?
It seems that e.g. address 0x0000044a (real mode), 0xe000044a (Gnu C) contains
how many text columns are on the screen, etc.:-
inline int ScreenRows() {return *(unsigned char*)0xe0000484+1;}
inline int ScreenCols() {return *(unsigned short*)0xe000044a;}
inline int ScreenMode() {return *(unsigned char*)0xe0000449;}
Similarly, please what byte or bit address contains whether the current screen
is text or graphic?, so I can read it directly and bypass all the complication
of interrupts and converting array addresses between Gnu C mode and real mode.
Also, which bit or byte contains whether the screen is color or mono?
> Or better yet, just assume that changing the screen mode is OK, and just do
> a mode switch at the beginning of the program.
Sometimes I want to work in e.g. 43*132 chars mode, so I set the screen to the
required mode before entering my program.
> (It's unlikely that someone'd call a textmode editor inside a graphic
> program...)
Sometimes my PC's screen has been left in graphics mode when a graphics
program has aborted.
- Raw text -