Page 1 of 1

Background Colors in Text Mode

Posted: Thu Jun 04, 2009 10:23 am
by DDastardly71
I have seen some programs that used colors beyond &H8 for its background like the old Norton Utilities that used &HF. How can I do this programmatically?

Can I do this strictly QB or with the aid of ASSEMBLY? Can you provide a code?

Posted: Thu Jun 04, 2009 5:05 pm
by MystikShadows
You can use extra colors by setting blinking mode off which turns intensity on. which allows colors 9 through 15 to be used as background color.

Here's a link to a microsoft article on the subject with sample QB code (which works with pds, vb-dos and qb 4.5

http://support.microsoft.com/kb/50945

Posted: Thu Jun 04, 2009 6:07 pm
by DDastardly71
Thanks for that quick reply but I forgot to mention that I needed it for SCREEN 0.

Posted: Thu Jun 04, 2009 8:09 pm
by burger2227
SCREEN 0 is the only mode with high intensity blinking colors above 15 that does not need Interrupt code.

By default when running full-screen, this makes the foreground blink rather than making the background brighter.
(But this also happens if you use CALL INTERRUPTX.) You can also:

T% = INP(&H3DA) 'read first (discarded)
OUT &H3C0, &H10
T% = INP(&H3C1) 'use in final setting
OUT &H3C0, &H10
OUT &H3C1, T% AND NOT 8

to switch from flashing to background-intensity mode.

Posted: Thu Jun 04, 2009 11:43 pm
by DDastardly71
I don't mean to sound like a noob but how do you insert this into your program.

This is what I want to accomplish...

COLOR 0, 15

without it blinking. Please include a sample code.

Posted: Fri Jun 05, 2009 1:28 am
by burger2227
That should work, but you have to use CLS to spread the background over the screen. That is one problem with screen 0. The background will only show up under PRINTs otherwise.

COLOR 0, 15: CLS

PRINT "Hello"

It should NOT blink as only the forecolors above 15 blink! Just add 16 to a normal color. If you want to stop the blinking, add my code above at the beginning of the program. The background CANNOT BLINK!

Posted: Fri Jun 05, 2009 11:34 am
by Harry Potter
COLOR 0, 15: CLS
The COLOR command takes the blinking option in the foreground color parameter as Foreground Color + 16. To have a high-intensity background, add 16 to the foreground color and use Color AND 7 as the background color.