[TC] How to use color constant ( >=8 ) as background color ? - MS-DOS
This is a discussion on [TC] How to use color constant ( >=8 ) as background color ? - MS-DOS ; Dear all, In Turbo C, using textbackground( color ) can set the color of background. But color is ranging from 0( black ) to 7 ( lightgray )...few choices... Does anyone know how to use color constant which is [8~15] ...
| | LinkBack | Tools |
|
#1
| |||
| |||
| In Turbo C, using textbackground( color ) can set the color of background. But color is ranging from 0( black ) to 7 ( lightgray )...few choices... Does anyone know how to use color constant which is [8~15] as background color ? Do I need to change the video mode ? ( Now I used 80x25 text mode, which is mode "3"...) Thanks in advance ^_^ jimmyliao |
|
#2
| |||
| |||
| On 4 Jul 2006 04:52:03 -0700, "liaoo" >In Turbo C, using textbackground( color ) can set the color of >background. But color is ranging from 0( black ) to 7 ( lightgray >)...few choices... > >Does anyone know how to use color constant which is [8~15] as >background color ? Do I need to change the video mode ? ( Now I used >80x25 text mode, which is mode "3"...) There is a BIOS call that lets you do this, but you lose the "blink" attribute in trade. The call is INT 10 AX=1003, but I don't know if TC implements it in a library function. -Scott |
|
#3
| |||
| |||
| Scott 寫道: > There is a BIOS call that lets you do this, but you lose the "blink" > attribute in trade. The call is INT 10 AX=1003, but I don't know if TC > implements it in a library function. > > -Scott Thanks ! I think I can use inline assembly to "create" such function, right ? |
|
#4
| |||
| |||
| liaoo wrote: > Scott 寫道: > > >>There is a BIOS call that lets you do this, but you lose the "blink" >>attribute in trade. The call is INT 10 AX=1003, but I don't know if TC >>implements it in a library function. >> >>-Scott > > > Thanks ! I think I can use inline assembly to "create" such function, > right ? > int 10h ah=10h al=3 bl=0 for background colours, 1 for blink See int86() in the runtime library. int86() can be used to call interrupts from C. Alex |
|
#5
| |||
| |||
| Dear all, I found the following phenomenon and wonder whether anyone knows why : ------------------------------------------------------------------------------------------------------------ step1 : set background color to A ( A is color constant > 7, Ex. 8 ) by above method step2 : access directly video memory with background color B ( Ex. B = 2 ) step3 : write video memory with background color A ------------------------------------------------------------------------------------------------------------ The output is : ----------------------------------------------- after step2, I saw color "B" after step3, I saw color "A" ----------------------------------------------- Thus can I inference that only BOTH "set palette" and "directly access attribute byte" can change to the desired background color "which is > 7" ? ( For background color <=7, just access attribute byte is enough....) |
|
#6
| |||
| |||
| liaoo 寫道: > Dear all, > > I found the following phenomenon and wonder whether anyone knows why : > > ------------------------------------------------------------------------------------------------------------ > step1 : set background color to A ( A is color constant > 7, Ex. 8 ) > by above method > > step2 : access directly video memory with background color B > ( Ex. B = 2 ) > > step3 : write video memory with background color A > ------------------------------------------------------------------------------------------------------------ > > The output is : > > ----------------------------------------------- > after step2, I saw color "B" > after step3, I saw color "A" > ----------------------------------------------- > > Thus can I inference that only BOTH "set palette" and "directly access > attribute byte" can change to the desired background color "which is > > 7" ? > > ( For background color <=7, just access attribute byte is enough....) After testing, I used the following rule to config background color: -------------------------------------------------------------------------------------------------------------- if( color > 7 and color < 16 ) then set video palette by INT 10h ( ah = 10h, al = 03h, bl = 0h, bh= color ) write directly to video memory with bit[7:4] of attribute byte = color -------------------------------------------------------------------------------------------------------------- Is above a correct programming method ? Regards, jimmyliao |
« Previous Thread
|
Next Thread »
| Tools | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Background color of Canvas | unix | Websphere | 0 | 10-08-2007 07:24 PM |
| Get a background color of frame | unix | Programmer | 0 | 10-04-2007 07:39 PM |
| XFCE Background Color | unix | Questions | 2 | 09-30-2007 06:57 PM |
| Foreground/Background color | unix | Mozilla | 4 | 11-29-2006 08:41 AM |
| background color of current tab | unix | Mozilla | 5 | 08-23-2006 09:37 PM |
All times are GMT. The time now is 10:23 AM.
