Giving BriOS some color....
Giving BriOS some color....
Hello OSDev community,
If you haven't already guessed it, I am new to the world of OS programming. right now I am programming a simple OS only using a command propmt like interface, no GUI's or anything special like that....
What I am wondering is, how can I ( in ASM) change the colors of things like the text and the background.
Thank you very much!
-Brian
If you haven't already guessed it, I am new to the world of OS programming. right now I am programming a simple OS only using a command propmt like interface, no GUI's or anything special like that....
What I am wondering is, how can I ( in ASM) change the colors of things like the text and the background.
Thank you very much!
-Brian
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: Giving BriOS some color....
The standard VGA text mode that most people are used to (80x25) is mapped to physical 0xb8000 and contains alternating bytes of text and attribute information.
The attribute byte contains colour information. If I recall correctly, the high 4 bits contain the background colour, and the low 4 bits contain the foreground colour.
Also, depending on how the hardware is configured, background colours >= 8 will either make the foreground text blink, or will actually appear as a high intensity background colour.
--Jeff
The attribute byte contains colour information. If I recall correctly, the high 4 bits contain the background colour, and the low 4 bits contain the foreground colour.
Also, depending on how the hardware is configured, background colours >= 8 will either make the foreground text blink, or will actually appear as a high intensity background colour.
--Jeff
Re: Giving BriOS some color....
Thank you for replying...carbonBased wrote:Also, depending on how the hardware is configured, background colours >= 8 will either make the foreground text blink, or will actually appear as a high intensity background colour.
--Jeff
I will have to try this out.
Thank you!
Last edited by BriOS on Tue Aug 23, 2005 11:00 pm, edited 1 time in total.
Re: Giving BriOS some color....
Well, I found some code for doing VGA stuff and plugged it in, and when I did, it made my program have a resolution of 320 x 300, as it said it would, and all my text was trange colors, I don't understand, every otehr character I typed was a different color?!?!?!? Here is the code:
Yes, that is all I added. Can anyone explain why it's doing this?
Thanks!
Code: Select all
mov ax,11h
int 10h
Thanks!
- carbonBased
- Member
- Posts: 382
- Joined: Sat Nov 20, 2004 12:00 am
- Location: Wellesley, Ontario, Canada
- Contact:
Re: Giving BriOS some color....
The code changes the video mode by calling a function in the video bios (aka int 0x10).
And, as I just said, memory is arranged as alternating bytes of attributes and text...
--Jeff
And, as I just said, memory is arranged as alternating bytes of attributes and text...
--Jeff
Re: Giving BriOS some color....
Code: Select all
/*this is some code made in C it should be quite self-explanatory
byte iseven(word value){
byte ret;
word tmp;
tmp=value%2;
if (tmp>0){ret=0;}else{ret=1;}
return ret;
}
void bprint2(byte chr,byte col,byte row)
{
word offset;
offset=160*row+col*2; /*this is a jewel of an alogorithim, 160= how many coloumns * 2*/
if (iseven(offset)==1){ /*if it wasnt for this, if it was not even then it would write the character as the attribute*/
pokeb(0xb800,offset,chr);
pokeb(0xb800,offset+1,0x0f); /*this is the attribute, 0x0f means black background with white text(intense)*/
}else{ /*if the offset is not even*/
pokeb(0xb800,offset+1,chr); /*add 1 to make it even*/
pokeb(0xb800,offset+2,0x0f);
}
}
/*commented extra for your use, if you need this code in asm ask, but it isnt understandable and i will almst guarentee that it wont work right out of the box, im not the best asm programmer either btw*/
now then that is a simple ega example without using interrupts, but here also is my code for using interrupts
Code: Select all
mov ah,0x0e ;this is the value for type-o-matic writing of something like that
mov al,chr ;mov the char to al
int 0x10 ;do it!
Re: Giving BriOS some color....
Thanks Hckr83!
I was wondering, then I am in mode 13h (mov ax,13h int 10h) I have 256 colors and 320 x 200 resolution, but when I go to mode 12h I get 16 colors and 1024 x 768, is there any way I could have 256 (or more) colors and 1024 x 768 resolution?
Thanks!
I was wondering, then I am in mode 13h (mov ax,13h int 10h) I have 256 colors and 320 x 200 resolution, but when I go to mode 12h I get 16 colors and 1024 x 768, is there any way I could have 256 (or more) colors and 1024 x 768 resolution?
Thanks!
Re: Giving BriOS some color....
umm vesa
i heard of evga or maybe avga or something with vga in it(not svga) that all you had to do was put something somewhere and switch modes using int 10h
also svga you might try searching for and i think that gives you 256 colors up to 1280,1024
ummm
http://jdev.zenconet.net/ect/VIDEO.ASM
that is a bit of source code i found, im not sure if it uses dos or if it can eb standalone but by the looks of it it is callable from a C programming language
btw it wasnt written by me
oh heres something i got off of good old clipx, not sure however if it works as i just now found it
and
btw if you want to check this out yourself just goto clipx.net ;click norton guides(or norton's i forgot) ;click interrupts and ports or something like that; then click interrupts ; then click int 10h and thats graphics
i heard of evga or maybe avga or something with vga in it(not svga) that all you had to do was put something somewhere and switch modes using int 10h
also svga you might try searching for and i think that gives you 256 colors up to 1280,1024
ummm
http://jdev.zenconet.net/ect/VIDEO.ASM
that is a bit of source code i found, im not sure if it uses dos or if it can eb standalone but by the looks of it it is callable from a C programming language
btw it wasnt written by me
oh heres something i got off of good old clipx, not sure however if it works as i just now found it
Code: Select all
+-------------------------------------------------------------------------+
| Mode | text |char| graphic|colors |disp|scrn| system |
| | resol |size| resoltn| |page|addr| |
|------+-------+----+--------+--------+----+----+-------------------------|
| 16h | | | 800x600| 16 | | |Tecmar VGA/AD |
| 1Dh | | | 800x600|256 | | |Tecmar VGA/AD |
| 29h | | | 800x600| 16 | | |VEGA VGA |
| 29h | | | 800x600| 16 | | |Allstar Peacock (VGA) |
| 30h | | | 800x600|256 | | |VEGA VGA |
| 46h |100x40 |8x15| 800x600| 2 | | |AT&T VDC600 |
| 47h |100x37 |8x16| 800x600| 16 | | |AT&T VDC600 |
| 54h |100x42 |8x14| 800x600| 16 | |A000|ATI EGA Wonder |
| 58h |100x75 |8x8 | 800x600|16/256k | |A000|Paradise VGA |
| 58h |100x75 |8x8 | 800x600| 16 | | |AT&T VDC600 |
| 58h | | | 800x600| 16 | | |AST VGA Plus |
| 58h | | | 800x600| 16 | | |Hewlett-Packard D1180A |
| 59h |100x75 |8x8 | 800x600| 2 | |A000|Paradise VGA |
| 59h |100x75 |8x8 | 800x600| 2 | | |AT&T VDC600 |
| 59h | | | 800x600| 2 | | |AST VGA Plus |
| 59h | | | 800x600| 2 | | |Hewlett-Packard D1180A |
| 62h | | | 800x600| | | |VEGA VGA |
| 62h | | | 800x600| 16 | | |Tatung VGA |
| 62h | | | 800x600| 16 | | |Video7 V-RAM VGA |
| 71h |100x35 |8x16| 800x600|16of64 | |A000|NSI Smart EGA+ |
+-------------------------------------------------------------------------+
and
Code: Select all
+-------------------------------------------------------------------------+
| Mode | text |char| graphic|colors |disp|scrn| system |
| | resol |size| resoltn| |page|addr| |
|------+-------+----+--------+--------+----+----+-------------------------|
| 25h | | | 640x480| 16 | | |VEGA VGA |
| 27h | | | 720x512| 16 | | |VEGA VGA |
| 28h | ??x?? | | | | | |VEGA VGA |
| 29h | | | 800x600| 16 | | |VEGA VGA |
| 2Dh | | | 640x350|256 | | |VEGA VGA |
| 2Eh | | | 640x480|256 | | |VEGA VGA |
| 2Fh | | | 720x512|256 | | |VEGA VGA |
| 30h | | | 800x600|256 | | |VEGA VGA |
| 36h | | | 960x720| 16 | | |VEGA VGA |
| 37h | | |1024x768| 16 | | |VEGA VGA |
| 40h | 80x43 | | | | | |VEGA VGA, Tecmar VGA/AD |
| 41h |132x25 | | | | | |VEGA VGA |
| 42h |132x43 | | | | | |VEGA VGA |
| 43h | 80x60 | | | | | |VEGA VGA |
| 44h |100x60 | | | | | |VEGA VGA |
| 4Dh | 120x25| | | | | |VEGA VGA |
| 4Eh | 120x43| | | | | |VEGA VGA |
| 4Fh |132x25 | | | | | |VEGA VGA |
| 50h | 80x43 | | |mono | | |VEGA VGA |
| 51h |132x25 | | |mono | | |VEGA VGA |
| 52h |132x43 | | |mono | | |VEGA VGA |
| 5Eh | | | 640x400|256 | | |Paradise VGA,VEGA VGA |
| 60h | | | 752x410| | | |VEGA VGA |
| 61h | | | 720x540| | | |VEGA VGA |
| 62h | | | 800x600| | | |VEGA VGA |
+-------------------------------------------------------------------------+
Code: Select all
+-------------------------------------------------------------------------+
| Mode | text |char| graphic|colors |disp|scrn| system |
| | resol |size| resoltn| |page|addr| |
|------+-------+----+--------+--------+----+----+-------------------------|
| 00h | 40x25 |8x8 | |B&W | 8 |B800|CGA |
| | 40x25 |8x14| |B&W | 8 |B800|ATI VIP |
| 01h | 40x25 |8x8 | | 16 | 8 |B800|CGA |
| | 40x25 |8x14| | 16 | 8 |B800|ATI VIP |
| 02h | 80x25 |8x8 | |B&W | 4 |B800|CGA |
| | 80x25 |8x8 | |B&W | 8 |B800|EGA,MCGA,VGA |
| | 80x25 |8x14| |B&W | 8 |B800|ATI VIP |
| 03h | 80x25 |8x8 | | 16 | 4 |B800|CGA |
| | 80x25 |8x8 | | 16 | 8 |B800|EGA,MCGA,VGA |
| 04h | 40x25 |8x8 | 320x200| 4 | 1 |B800|CGA |
| 05h | 40x25 |8x8 | 320x200|4 gray | 1 |B800|CGA |
| 06h | 80x25 |8x8 | 640x200|B&W | 1 |B800|CGA |
| 07h | 80x25 |9x14| |mono | 1 |B000|MDA,Hercules |
| | 80x25 | | | | 8 | |EGA,VGA |
| | 80x25 |9x14| |mono | |B000|ATI VIP |
| 08h | 20x25 |8x8 | 160x200| 16 | |B800|PCjr,Tandy 1000 |
| 09h | 40x25 |8x8 | 320x200| 16 | |B800|PCjr,Tandy 1000 |
| 0Ah | 80x25 |8x8 | 640x200| 4 | |B800|PCjr,Tandy 1000 |
| 0Dh | 40x25 |8x8 | 320x200| 16 | 8 |A000|EGA,VGA |
| 0Eh | 80x25 |8x8 | 640x200| 16 | 4 |A000|EGA,VGA |
| 0Fh | 80x25 |8x14| 640x350|mono | 2 |A000|EGA,VGA |
| 10h | 80x25 |8x14| 640x350|4or16 | 2 |A000|EGA,VGA |
| 11h | 80x30 |8x16| 640x480|mono | |A000|VGA,MCGA,ATI EGA,ATI VIP |
| 12h | 80x30 |8x16| 640x480|16/256k | |A000|VGA,ATI VIP |
| | 80x30 |8x16| 640x480|16/64 | |A000|ATI EGA Wonder |
| 13h | 40x25 |8x8 | 320x200|256/256k| |A000|VGA,MCGA,ATI VIP |
| 14h | 80x25 |8x8 | 640x200| | | |Lava Chrome II EGA |
| | | | 640x400| 16 | | |Tecmar VGA/AD |
| 15h | 80x25 |8x14| 640x350| | | |Lava Chrome II EGA |
| 16h | 80x25 |8x14| 640x350| | | |Lava Chrome II EGA |
| | | | 800x600| 16 | | |Tecmar VGA/AD |
| 17h | 80x34 |8x14| 640x480| | | |Lava Chrome II EGA |
| |132x25 | | | | | |Tecmar VGA/AD |
| 18h |132x44 |8x8 | |mono | | |Tseng Labs EVA |
| | 80x34 |8x14| 640x480| | | |Lava Chrome II EGA |
| | | |1024x768| 16 | | |Tecmar VGA/AD |
| 19h |132x25 |8x14| |mono | | |Tseng Labs EVA |
| 1Ah |132x28 |8x13| |mono | | |Tseng Labs EVA |
| | | | 640x350|256 | | |Tecmar VGA/AD |
| 1Bh | | | 640x400|256 | | |Tecmar VGA/AD |
| 1Ch | | | 640x480|256 | | |Tecmar VGA/AD |
| 1Dh | | | 800x600|256 | | |Tecmar VGA/AD |
| 22h |132x44 |8x8 | | | | |Tseng Labs EVA |
| |132x44 |8x8 | | | | |Ahead Systems EGA2001 |
| |132x43 | | | | | |Allstar Peacock (VGA) |
| 23h |132x25 |6x14| | | | |Tseng Labs EVA |
| |132x25 |8x14| | | | |Ahead Systems EGA2001 |
| |132x25 |8x8 | | 16 | |B800|ATI EGA Wonder,ATI VIP |
| |132x28 | | | | | |Allstar Peacock (VGA) |
| 24h |132x28 |6x13| | | | |Tseng Labs EVA |
| |132x25 | | | | | |Allstar Peacock (VGA) |
| 25h | 80x60 |8x8 | 640x480| | | |Tseng Labs EVA |
| | | | 640x480| 16 | | |VEGA VGA |
| 26h | 80x60 |8x8 | | | | |Tseng Labs EVA |
| | 80x60 |8x8 | 640x480| | | |Ahead Systems EGA2001 |
| | 80x60 | | | | | |Allstar Peacock (VGA) |
| 27h | | | 720x512| 16 | | |VEGA VGA |
| |132x25 |8x8 | |mono | |B000|ATI EGA Wonder,ATI VIP |
| 28h | ??x?? | | | | | |VEGA VGA |
| 29h | | | 800x600| 16 | | |VEGA VGA |
| | | | 800x600| 16 | | |Allstar Peacock (VGA) |
| 2Ah |100x40 | | | | | |Allstar Peacock (VGA) |
| 2Dh | | | 640x350|256 | | |VEGA VGA |
| 2Eh | | | 640x480|256 | | |VEGA VGA |
| 2Fh | | | 720x512|256 | | |VEGA VGA |
| 30h | | | 800x600|256 | | |VEGA VGA |
| | | | ???x???| | |B800|AT&T 6300 |
| 33h |132x44 |8x8 | | 16 | |B800|ATI EGA Wonder,ATI VIP |
| 36h | | | 960x720| 16 | | |VEGA VGA |
| 37h | | |1024x768| 16 | | |VEGA VGA |
| |132x44 |8x8 | |mono | |B000|ATI EGA Wonder,ATI VIP |
| 40h | 80x25 |8x16| 640x400| 2 | 1 |B800|AT&T 6300, AT&T VDC600 |
| | 80x25 |8x16| 640x400| 2 | 1 |B800|Compaq Portable |
| | 80x43 | | | | | |VEGA VGA, Tecmar VGA/AD |
| | 80x43 | | | | | |Video7 V-RAM VGA |
| | 80x43 | | | | | |Tatung VGA |
| 41h | | | 640x200| 16 | 1 | |AT&T 6300 |
| |132x25 | | | | | |VEGA VGA |
| |132x25 | | | | | |Tatung VGA |
| |132x25 | | | | | |Video7 V-RAM VGA |
| 42h | 80x25 |8x16| 640x400| 16 | | |AT&T 6300, AT&T VDC600 |
| |132x43 | | | | | |VEGA VGA |
| |132x43 | | | | | |Tatung VGA |
| |132x43 | | | | | |Video7 V-RAM VGA |
| 43h | 80x60 | | | | | |VEGA VGA |
| | 80x60 | | | | | |Tatung VGA |
| | 80x60 | | | | | |Video7 V-RAM VGA |
| 44h |100x60 | | | | | |VEGA VGA |
| |100x60 | | | | | |Tatung VGA |
| |100x60 | | | | | |Video7 V-RAM VGA |
| 45h |132x28 | | | | | |Tatung VGA |
| |132x28 | | | | | |Video7 V-RAM VGA |
| 46h |100x40 |8x15| 800x600| 2 | | |AT&T VDC600 |
| 47h |100x37 |8x16| 800x600| 16 | | |AT&T VDC600 |
| 48h | 80x50 |8x8 | 640x400| 2 | |B800|AT&T 6300, AT&T VDC600 |
| 49h | 80x30 |8x16| 640x480| | | |Lava Chrome II EGA |
| 4Dh | 120x25| | | | | |VEGA VGA |
| 4Eh | 120x43| | | | | |VEGA VGA |
| 4Fh |132x25 | | | | | |VEGA VGA |
| 50h |132x25 |9x14| |mono | | |Ahead Systems EGA2001 |
| | 80x30 |8x16| 640x480| 16 | | |Paradise EGA-480 |
| | 80x43 | | |mono | | |VEGA VGA |
| | | | 640x480|mono??? | | |Taxan 565 EGA |
| | 80x34 | | | | | |Lava Chrome II EGA |
| 51h | 80x30 |8x16| | | | |Paradise EGA-480 |
| | 80x30 | | | | | |Lava Chrome II EGA |
| | 80x34 |8x14| 640x480| 16 | | |ATI EGA Wonder |
| |132x25 | | |mono | | |VEGA VGA |
| 52h |132x44 |9x8 | |mono | | |Ahead Systems EGA2001 |
| |132x43 | | |mono | | |VEGA VGA |
| | 94x29 |8x14| 752x410| 16 | | |ATI EGA Wonder |
| | 80x60 | | | | | |Lava Chrome II EGA |
| 53h |100x40 |8x14| 800x560| 16 | | |ATI EGA Wonder,ATI VIP |
| |132x43 | | | | | |Lava Chrome II EGA |
| 54h |132x43 |8x8 | | | | |Paradise EGA-480 |
| |132x43 |7x9 | |16/256k | |B800|Paradise VGA |
| |132x43 |8x9 | |16/256k | |B800|Paradise VGA on multisync|
| |132x43 | | | | | |Taxan 565 EGA |
| |132x43 | | | | | |AST VGA Plus |
| |132x43 | | | | | |Hewlett-Packard D1180A |
| |132x43 |7x9 | | 16 | | |AT&T VDC600 |
| |132x25 | | | | | |Lava Chrome II EGA |
| |100x42 |8x14| 800x600| 16 | |A000|ATI EGA Wonder |
| 55h |132x25 |8x14| | | | |Paradise EGA-480 |
| |132x25 |7x16| |16/256k | |B800|Paradise VGA |
| |132x25 |8x16| |16/256k | |B800|Paradise VGA on multisync|
| |132x25 | | | | | |Taxan 565 EGA |
| |132x25 | | | | | |AST VGA Plus |
| |132x25 | | | | | |Hewlett-Packard D1180A |
| |132x25 |7x16| | 16 | | |AT&T VDC600 |
| | 80x66 |8x8 | |16/256k | |A000|ATI VIP |
| | 94x29 |8x14| 752x410| | | |Lava Chrome II EGA |
| 56h |132x43 |8x8 | |3??? | 2 |B000|NSI Smart EGA+ |
| |132x43 |7x9 | | 4 | |B000|Paradise VGA |
| |132x43 |8x9 | | 4 | |B000|Paradisk VGA on multisync|
| |132x43 | | |mono | | |Taxan 565 EGA |
| |132x43 |7x9 | | 2 | | |AT&T VDC600 |
| 57h |132x25 |8x14| |3??? | 4 |B000|NSI Smart EGA+ |
| |132x25 |7x16| | 4 | |B000|Paradise VGA |
| |132x25 |8x16| | 4 | |B000|Paradise VGA on multisync|
| |132x25 | | |mono | | |Taxan 565 EGA |
| |132x25 |7x16| | 2 | | |AT&T VDC600 |
| 58h |100x75 |8x8 | 800x600|16/256k | |A000|Paradise VGA |
| |100x75 |8x8 | 800x600| 16 | | |AT&T VDC600 |
| | 80x33 |8x14| | 16 | |B800|ATI EGA Wonder,ATI VIP |
| | | | 800x600| 16 | | |AST VGA Plus |
| | | | 800x600| 16 | | |Hewlett-Packard D1180A |
| 59h |100x75 |8x8 | 800x600| 2 | |A000|Paradise VGA |
| |100x75 |8x8 | 800x600| 2 | | |AT&T VDC600 |
| | 80x66 |8x8 | |16/256k | |A000|ATI VIP |
| | | | 800x600| 2 | | |AST VGA Plus |
| | | | 800x600| 2 | | |Hewlett-Packard D1180A |
| 5Eh | | | 640x400|256 | | |Paradise VGA,VEGA VGA |
| | | | 640x400|256 | | |AST VGA Plus |
| | 80x25 |8x16| 640x400|256 | | |AT&T VDC600 |
| 5Fh | | | 640x480|256 | | |Paradise VGA |
| | | | 640x480|256 | | |AST VGA Plus |
| | | | 640x480|256 | | |Hewlett-Packard D1180A |
| | 80x30 |8x16| 640x480|256 | | |AT&T VDC600 (512K) |
| 60h | 80x???| | ???x400| | | |Corona/Cordata BIOS 4.10+|
| | | | 752x410| | | |VEGA VGA |
| | | | 752x410| 16 | | |Tatung VGA |
| | | | 752x410| 16 | | |Video7 V-RAM VGA |
| 61h | | | ???x400| | | |Corona/Cordata BIOS 4.10+|
| | | | 720x540| | | |VEGA VGA |
| | | | 720x540| 16 | | |Tatung VGA |
| | | | 720x540| 16 | | |Video7 V-RAM VGA |
| 62h | | | 800x600| | | |VEGA VGA |
| | | | 800x600| 16 | | |Tatung VGA |
| | | | 800x600| 16 | | |Video7 V-RAM VGA |
| 63h | | |1024x768| 2 | | |Video7 V-RAM VGA |
| 64h | | |1024x768| 4 | | |Video7 V-RAM VGA |
| 65h | | |1024x768| 16 | | |Video7 V-RAM VGA |
| 66h | | | 640x400|256 | | |Tatung VGA |
| | | | 640x400|256 | | |Video7 V-RAM VGA |
| 67h | | | 640x480|256 | | |Video7 V-RAM VGA |
| 69h | | | 720x540|256 | | |Video7 V-RAM VGA |
| 71h |100x35 |8x16| 800x600|16of64 | |A000|NSI Smart EGA+ |
| 74h | | | 640x400| 2 | |B800|Toshiba 3100 AT&T mode |
| 82h | 80x25 | | |B&W | | |AT&T VDC overlay mode * |
| 83h | 80x25 | | | | | |AT&T VDC overlay mode * |
| 86h | | | 640x200|B&W | | |AT&T VDC overlay mode * |
| C0h | | | 640x400| 2 | | |AT&T VDC overlay mode * |
| D0h | | | 640x400| 2 | |B800|DEC VAXmate AT&T mode |
| ??? | | | 640x225| | | |Z-100 |
| ??? | | | 640x400| | | |Z-100 |
+-------------------------------------------------------------------------+
btw if you want to check this out yourself just goto clipx.net ;click norton guides(or norton's i forgot) ;click interrupts and ports or something like that; then click interrupts ; then click int 10h and thats graphics
Re: Giving BriOS some color....
Wow, Dude, Thanks! That is like, EXACTLY what I am looking for.
The way to use it is:
Instead of this:
Do this:
I am sorry if my questions are noob-ish, cause I just started ASM 3 days ago, and tend to try to get ahead of my self....
Thank you alot again!
The way to use it is:
Instead of this:
Code: Select all
mov ax,13h
int 10h
Code: Select all
mov ax, (x) ;Replace (X) with the mode form the list you found
int 10h
I am sorry if my questions are noob-ish, cause I just started ASM 3 days ago, and tend to try to get ahead of my self....
Thank you alot again!