Changing default colors in Screen 1

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
michealey
Coder
Posts: 11
Joined: Sun Dec 03, 2006 8:31 pm
Location: Florida
Contact:

Changing default colors in Screen 1

Post by michealey » Sun Dec 03, 2006 8:44 pm

Hi Guys,

I was trying to change the default colors for screen one. Now I know you can assigned any of the 16 colors to the 4 CGA colors with the PALETTE COMMAND.

Example:

SCREEN 1
PALETTE 2, 4 'Turns the Magenta to Red for color 2


However, I was wondering if you could apply the routine as it is
used under SCREEN 13, but in SCREEN 1.


SCREEN 13

LINE (10, 10)-(160, 100), 2, BF


OUT &H3C8, 2 'The Number of the color to assign...
OUT &H3C9, 42 'Red values from 0 to 63
OUT &H3C9, 10 'Green
OUT &H3C9, 45 'Blue

'The above gives color 2 a custom color (from the default).

My question is by using a different HEX address, can this type of routine be allied in the colors under SCREEN 1, so I could get a custom set of 16 colors to utilize (instead of the default).


Any help kindly appreciated.

~Mic

User avatar
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt » Mon Dec 04, 2006 5:35 am

AFAIK, on true CGA hardware, the colours of the CGA palette cannot be modified. You can change them on VGA hardware though. Your code should technically work. If not, then maybe your video card doesn't support it. It's been many years since I monkeyed with such an ancient video mode so I'm a bit rusty on the subject but I do remember being able to specify absolute values for the palette in CGA mode...

You won't be able to get more colour slots in the palette than what the mode allows though...there's nothing you can do about that. If you need more colour slots in the palette, you'll need to use a different mode.

User avatar
michealey
Coder
Posts: 11
Joined: Sun Dec 03, 2006 8:31 pm
Location: Florida
Contact:

Changing default colors in Screen 1

Post by michealey » Mon Dec 04, 2006 6:49 pm

Thanks for the reply. Unfortuately, the OUT code listed previously only works under SCREEN 13. I was looking for a port address that would make it work under SCREEN 1 (on a VGA card equipped system of course).

CGA is ancient I guess... But, You can still do some pretty neat stuff with CGA if you change the palette, to: Black, Cyan, Red, White (0, 3, 4, 7). Also, utilising a neat old great pixel paint program called:

PCPAINT (3.1) allows you to run in CGA mode (among many others) and save directly into BSAVE format, so it is quite easy to use with one's programs and of course the memory footprint of CGA graphics is much smaller than VGA. PCPAINT also has a very impressive array of RMB/LMB assigned textures and patterns, and - while a challange, one can indeed make some pretty cool (abeit retro) looking graphics; even de-resolutioning/color paletting an image all the way to 4 color. (I have some examples if you are interested).

Well, thanks again for the kind reply.

Sincerely,

Mic

User avatar
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt » Mon Dec 04, 2006 8:06 pm

For true CGA hardware, register 03D8h functions as mode control and 03D9h is the colour control register. On some hardware, monkeying with these two registers can produce some interesting effects. But it's unlikely that any "modern" video cards are going to be able to do much beyond what is "standard".

EDIT: I just remembered...in a VERY old IBM BASIC manual, there was a code example of how to mess with the colours of a CGA mode that went beyond the normal palette limitation.

Post Reply