Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changin Text Color

Status
Not open for further replies.

sdTech

Programmer
Oct 29, 2002
10
0
0
US
Hi.

I want to change the text color...Appriciate any help from you guys


Thanks
 
Hi,

the service 09h of the interrupt 10h can change color.

MOV AH,09 ; FUNCTION 9
MOV AL,03 ; HEART ASCII
MOV BX,0004 ; PAGE 0, COLOR 4
MOV CX,07D0 ; 2000 CARACTERS
INT 10H ; INTERRUPT 10 -> BIOS
INT 20H ; END

Enjoy. ;-)
 
Thanks Oak

It works but the cursor is not advanced...the first character got overdrived(I want to highline a number in an array). I try to used

mov ah, oeh

It displayed the number, but i lost the color

Hope to here from you

Thanks
 
Well, I guess I've got your answer.
In the previously sent program, the BX register is used to set the video page and set the color of the caracter.
BH <- Page
BL <- Color

This text page allows 16 colors -> 00H to 0FH. So what about those extra 4 bites? (That is where you're supposed to get extasic) ;-)

In fact, the first 4 bites are used to set the background color, and the last 4 others, the forecolor.

MOV BL,0EH ; Background = Black, Foreground = Yellow
MOV BL,1EH ; Background = Blue, Foreground = Yellow

Don't forget to put the H to indicate that you're using hex numbers. [pipe]

Hope it will help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top