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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing background colors using an increment???

Status
Not open for further replies.

Netherbeast

Programmer
Jun 4, 2002
89
US
using the : mov eax, black+(backgroundColor*16)

how can I increment backgroundColor to display different colors without changing the color of the text?
I've tried to move backgroundColor to a register, increment the register then move it back to backgroundColor but it doesn't let me do that. Im very stuck right now.
 
hello
you are using text mode
the background color is in the second byte (the first is the ascii and the second is the attribute)
bits 4, 5, 6 are for background so you preserve the first four bits and the last ( of blinking); add 1000h to ax (ax is the video memory text word) or 10001000 to eax ( tow words of memory)
i mean direct access to video text memory is easy then using bios int or other libreray
 
Don't increment: add 16!

"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top