Video mode and text output
Video mode and text output
Hi all,
i was wondering if it is possible in my real mode os to change the default black background color to white and the letters to black. But according to ralf brown's int list, in text mode only the border color is changeable. So i decided to change my video mode and go to graphics
xor ax,ax
mov ax,04h
int 10h
then i change the background color
xor ax,ax
mov ah,0Bh
mov bl,0Fh ;White
int 10h
and i've changed all my output functions
mov ah,0Eh
mov bl,00h ;black
int 10h
However what i get is a screen filled with an outstanding white and no black letters. How can i print black letters in graphics mode?
Thank you all!
i was wondering if it is possible in my real mode os to change the default black background color to white and the letters to black. But according to ralf brown's int list, in text mode only the border color is changeable. So i decided to change my video mode and go to graphics
xor ax,ax
mov ax,04h
int 10h
then i change the background color
xor ax,ax
mov ah,0Bh
mov bl,0Fh ;White
int 10h
and i've changed all my output functions
mov ah,0Eh
mov bl,00h ;black
int 10h
However what i get is a screen filled with an outstanding white and no black letters. How can i print black letters in graphics mode?
Thank you all!
Re:Video mode and text output
Well.. Once you enter a graphics mode you dont have text to print. I mean the bios fonts that you were using in text mode wont be available to you in graphics mode.
All you have is one thing PIXEL. This is a small magical dot with which you can form any image. And even you can print text by creating your own fonts with pixels.
Hope you got the point.
All you have is one thing PIXEL. This is a small magical dot with which you can form any image. And even you can print text by creating your own fonts with pixels.
Hope you got the point.
Re:Video mode and text output
Nice pun ;DViral wrote: Hope you got the point.
a link that may help you is: http://www.mega-tokyo.com/osfaq/How%20do%20I%20draw%20things%20in%20protected%20mode%3F if you look at the section "How do i draw text?" it should point you in the right direction.
Peace
Re:Video mode and text output
You could use some trickery to do this. If you "clear" the screen, in other words just print a space on every position on your screen that has the background colour white with the text black, you will make the all the screen white. Then all you have to do is print on the screen as you normally would.killedbydeath wrote: Hi all,
i was wondering if it is possible in my real mode os to change the default black background color to white and the letters to black. But according to ralf brown's int list, in text mode only the border color is changeable.
Re:Video mode and text output
I would do this by overwriting each word in the available video memory (starting at 0xb800?) with 0x0007 (nul, black on white) if it were in a text mode. This would avoid the slowish BIOS printing routines.
Cheers.
Cheers.
Re:Video mode and text output
how much is the video memory , i mean it starts at 0xb800 but where does it end? (at which address)
Best Regards
Best Regards
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Video mode and text output
that depends on your video mode. IIrc, the most basic text mode (e.g. mode 3) has 4 pages of 80x25 characters ... that makes 0xB8000, 0xB9000, 0xBA000 and 0xBC000. Whatever's beyond is no longer VRAM you can fill in with ascii code, afaik.
Re:Video mode and text output
so a
mov ax,0xb800
mov bx,0xbc00
loop:
mov [ax],0x0007
cmp ax,bx ;reached 0xbc00
je stop_filling
inc ax
jmp loop
stop_filling:
mov [ax],0x0007 ;fill 0xbc00 with white too
jmp <row of program>
would do the trick? i mean it fills with white the hole video memory but would my text appear black?
Best Regards
mov ax,0xb800
mov bx,0xbc00
loop:
mov [ax],0x0007
cmp ax,bx ;reached 0xbc00
je stop_filling
inc ax
jmp loop
stop_filling:
mov [ax],0x0007 ;fill 0xbc00 with white too
jmp <row of program>
would do the trick? i mean it fills with white the hole video memory but would my text appear black?
Best Regards
Re:Video mode and text output
Hello..
Well I dont think you will get pure white background . See the color attribute byte of screen is treated as:
0 0 0 0 0 0 0 0
+ +-+-+ +---+---+
| | +---------- Foreground Color
| +------------------- Background Color
+------------------------ Blink Bit
So that means there are 8 backgrounds, starting from black(000) to lightgray(111) . So I think you can go for lightgray. I think white background is not available in 80x25 text mode.
Well I dont think you will get pure white background . See the color attribute byte of screen is treated as:
0 0 0 0 0 0 0 0
+ +-+-+ +---+---+
| | +---------- Foreground Color
| +------------------- Background Color
+------------------------ Blink Bit
So that means there are 8 backgrounds, starting from black(000) to lightgray(111) . So I think you can go for lightgray. I think white background is not available in 80x25 text mode.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Video mode and text output
That depends on some other control settings. The "blink" bit can be replaced by a 16-colors background mode with appropriate knowledge of VGA registers. See the freevga documentations if you really wish to know how ...Viral wrote: Hello..
So I think you can go for lightgray. I think white background is not available in 80x25 text mode.
Re:Video mode and text output
You could also mess around with the palette:
Setting an entry
Getting an entry
Setting an entry
Code: Select all
out 0x03c8,index(0-15)
out 0x03c9,red(0-63)
out 0x03c9,green(0-63)
out 0x03c9,blue(0-63)
Code: Select all
out 0x03c7,index(0-15)
in 0x03c9,red(0-63)
in 0x03c9,green(0-63)
in 0x03c9,blue(0-63)
Re:Video mode and text output
It can be done with a simple BIOS call as well if you want, no need to fiddle with VGA registers.http://heim.ifi.uio.no/~stanisls/helppc/int_10-10.html
Code: Select all
mov ax,1003h
mov bl,0
int 10h