Need help: colors on SCREEN 13 
Author Message
 Need help: colors on SCREEN 13

Hi, everyone-

I have several programs I wrote in SCREEN 13, but i do not understand how
to invoke the full range of colors.  256, I believe.

I know the colors 1-15, but how do you extend this beyond those 15 colors?
Is it just additional numbers or is there another way?

I am on a recent Gateway computer now (also have 386).  Both have super
VGA-type color cards.

Thanks,

Gloria



Tue, 25 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13

Quote:

> Hi, everyone-

> I have several programs I wrote in SCREEN 13, but i do not understand how
> to invoke the full range of colors.  256, I believe.

> I know the colors 1-15, but how do you extend this beyond those 15 colors?
> Is it just additional numbers or is there another way?

> I am on a recent Gateway computer now (also have 386).  Both have super
> VGA-type color cards.

> Thanks,

> Gloria

Yes there are 256 different colors, and you just use additional numbers for
the other colors.

-Gabe

--

(If you are replying directly to me, change home.me to home.com in my address)



Tue, 25 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13

Quote:

>Hi, everyone-

>I have several programs I wrote in SCREEN 13, but i do not understand how
>to invoke the full range of colors.  256, I believe.

>I know the colors 1-15, but how do you extend this beyond those 15 colors?
>Is it just additional numbers or is there another way?

In screen 13, you are free to use any value between 0 and 255, no
limitations. You can either use the predefinied color values, or modify
them using the PALETTE or OUT statements.

--
Marc van den Dikkenberg
--
The powerbasic Archives (EU) -- http://www.xs4all.nl/~excel/pb.html
The PowerBasic Archives (US) -- http://www.basicguru.com/dikkenberg
All Basic Code Archives      -- http://come.to/abcpackets



Tue, 25 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13
No, you don't just use other numbers.

See the PALETTE verb in your manual or help file.

--
Michael Mattias
Tal Systems
Racine WI USA

Quote:


>> Hi, everyone-

>> I have several programs I wrote in SCREEN 13, but i do not understand how
>> to invoke the full range of colors.  256, I believe.

>> I know the colors 1-15, but how do you extend this beyond those 15
colors?
>> Is it just additional numbers or is there another way?

>> I am on a recent Gateway computer now (also have 386).  Both have super
>> VGA-type color cards.

>> Thanks,

>> Gloria

>Yes there are 256 different colors, and you just use additional numbers for
>the other colors.

>-Gabe

>--

>(If you are replying directly to me, change home.me to home.com in my
address)



Tue, 25 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13
Yes, mode 13 has 256 colors.  To set it, just type

COLOR integer%

where integer can be anything in the range of 0 to 254.

To change them, use the PALETTE command.

PALETTE color_to_change%,  r% + v% * 256 + b% * 65536

where color_to_change% is an integer between 0 to 254 and r%, v% and b%
between 0 and 63.

An other way to change them is using the OUT command.

OUT &H3C8, color_to_change%
OUT &H3C9, r%
OUT &H3C9, v%
OUT &H3C9, b%

--
Jonathan McDougall
Montral, Qubec

http://www.multimania.com/jmcdougall - Programmation BASIC

-*-*-*-


Quote:

> Hi, everyone-

> I have several programs I wrote in SCREEN 13, but i do not understand
how
> to invoke the full range of colors.  256, I believe.

> I know the colors 1-15, but how do you extend this beyond those 15
colors?
> Is it just additional numbers or is there another way?

> I am on a recent Gateway computer now (also have 386).  Both have
super
> VGA-type color cards.

> Thanks,

> Gloria



Tue, 25 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13

Quote:

> Yes, mode 13 has 256 colors.  To set it, just type

> COLOR integer%

> where integer can be anything in the range of 0 to 254.

It can actually be anything in the range of 0 to 255, just thought i'd
point that out.

TTFN
Arclight



Wed, 26 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13
Sorry, a moment of distraction.

Jonathan McDougall

-*-*-*-

Quote:
> > where integer can be anything in the range of 0 to 254.

> It can actually be anything in the range of 0 to 255, just thought i'd
> point that out.



Wed, 26 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13
You need to set what colours you want using the primary colours:  Red, Blue
and Green.  By using the command PALETTE you can do this.  Here's a way of
doing it:

PALETTE num, B*65536 + G*256 + R

This will set the colour NUM to a what ever you want.  You must just
substitute number in for B, G and R which represent Blue, Green and Red.
The number you substitute must be between 1 and 64 (I think that's the
limit).  Experiment.

Benjamin Gardiner


Quote:

>Hi, everyone-

>I have several programs I wrote in SCREEN 13, but i do not understand how
>to invoke the full range of colors.  256, I believe.

>I know the colors 1-15, but how do you extend this beyond those 15 colors?
>Is it just additional numbers or is there another way?

>I am on a recent Gateway computer now (also have 386).  Both have super
>VGA-type color cards.

>Thanks,

>Gloria



Wed, 26 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13


Quote:
>You need to set what colours you want using the primary colours:  Red, Blue
>and Green.  By using the command PALETTE you can do this.  Here's a way of
>doing it:

>PALETTE num, B*65536 + G*256 + R

>This will set the colour NUM to a what ever you want.  You must just
>substitute number in for B, G and R which represent Blue, Green and Red.
>The number you substitute must be between 1 and 64 (I think that's the
>limit).  Experiment.

Or try manipulating the VGA registers directly, which is a LOT faster than
using the PALETTE function:

OUT &H3C8, colournumber%
OUT &H3C9, redvalue( r% )
OUT &H3C9, greenvalue( g% )
OUT &H3C9, bluevalue( b% )

r%, g% and b% are a value between 0 and 63
--
Marc van den Dikkenberg
--
The PowerBasic Archives (EU) -- http://www.xs4all.nl/~excel/pb.html
The PowerBasic Archives (US) -- http://www.basicguru.com/dikkenberg
All Basic Code Archives      -- http://come.to/abcpackets



Thu, 27 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13
<<Or try manipulating the VGA registers directly, which is a LOT faster than
using the PALETTE function:>>

A LOT faster is an understatement. The VGA registers totally blow away the
PALETTE statement and it's fairly easy to see why. Just look at all the
multiplications you have to do when you use the PALETTE statement! The VGA
registers are also alot easier to implement and understand. Just request the
color to change and send its new RGB value.

In response to the original post. Screen 13 also known as mode 13h is pretty
much the standard for QB games. It supports a 320x200 resolution, which is made
up for by the fact that it supports 256 colors on screen at once.

If you're new to the concept of the palette then here's how it works. In mode
13h the palette consists of 256 attributes. Technically an attribute is NOT a
color, but most people refer to them as such. The attribute is more like a
holding place for the color, since the actual color can change. If that didn't
make sense then think of it like this. On the computer a color consists of a
red green and blue intensity referred to as an RGB value. Using different RGB
values results in different colors. An attribute simply "holds" these RGB
values. So by changing an attributes RGB values you change the color the
attribute currently "holds".

By the way in mode 13h each RGB intensity can range from 0-63 giving you a
grand total of 64^3 = 262144 possible colors. If you'd like to learn more about
the palette, and how to manipulate it (fading it in and out, setting it,
capturing, changing it, rotating, etc.) then check out the tutorial I wrote
available on my page at: (http://members.aol.com/eclipzer/x-tech/init.htm)

-Eclipzer



Mon, 31 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13

Quote:

> <<Or try manipulating the VGA registers directly, which is a LOT faster than
> using the PALETTE function:>>

> A LOT faster is an understatement. The VGA registers totally blow away the
> PALETTE statement and it's fairly easy to see why. Just look at all the
> multiplications you have to do when you use the PALETTE statement! The VGA
> registers are also alot easier to implement and understand. Just request the
> color to change and send its new RGB value.

the fact that it needs quite a bit of multiplication to calculate, has nothing to
do with the speed of it, it's slow because it waits for the screen refresh every
time you set a colour, which means you can only change 50/60/70/85 colours a
second  (depending on the screens vertical refresh rate)

TTFN
Arclight



Mon, 31 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13
<<the fact that it needs quite a bit of multiplication to calculate, has
nothing to
do with the speed of it, it's slow because it waits for the screen refresh
every
time you set a colour, which means you can only change 50/60/70/85 colours a
second  (depending on the screens vertical refresh rate)>>

I beg to differ. I'm not saying you're wrong, but I'm not saying you're totally
right. If you're going for pure speed any time, then you never want to have
multiplications division exponents ect. in your code. The multiplication may
not have everything to do with PALETTE's lack of speed, but it does definately
having SOMETHING to do with it, as the value you use with the PALETTE statement
must be calculated.
-Eclipzer



Mon, 31 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13

Quote:

> <<the fact that it needs quite a bit of multiplication to calculate, has
> nothing to
> do with the speed of it, it's slow because it waits for the screen refresh
> every
> time you set a colour, which means you can only change 50/60/70/85 colours a
> second  (depending on the screens vertical refresh rate)>>

> I beg to differ. I'm not saying you're wrong, but I'm not saying you're totally
> right. If you're going for pure speed any time, then you never want to have
> multiplications division exponents ect. in your code. The multiplication may
> not have everything to do with PALETTE's lack of speed, but it does definately
> having SOMETHING to do with it, as the value you use with the PALETTE statement
> must be calculated.

Seriously the time taken by the multiplication has absolutley nothing to do with
the slow speed of the PALETTE command, the multiplications could take at much as
1/86th of a second to complete and it'd still be the same speed. in most cases the
use of maths slows the thing down, but hey so does everything else, and you have to
work out what is the fastest way to do something in a given situation.
even with hellishly large numbers of multiplications and divisions you can get some
very fast code for example, I have written a program which raytraces a ground plane
at 18fps on a Pentium Pro 200, and it has 9 Multiplications, 2 divides, 2 Mods, and
it does that for each of the 32000 pixels per frame, All of them Floating point.
and if you can do that sort of maths at that sort of speed, then a few
multiplications, are not going to cause any problems.

TTFN
Arclight



Mon, 31 Dec 2001 03:00:00 GMT  
 Need help: colors on SCREEN 13
<<Seriously the time taken by the multiplication has absolutley nothing to do
with the slow speed of the PALETTE command, the multiplications could take at
much as 1/86th of a second to complete and it'd still be the same speed.>>

I've been doing code optimization enough to know that 3 HUGE multiplications
especially in a FOR LOOP which loops 256 times is SLOW. There's just no denying
it.

<< in most cases the use of maths slows the thing down, but hey so does
everything else, and you have to work out what is the fastest way to do
something in a given situation. even with hellishly large numbers of
multiplications and divisions you can get some very fast code for example, I
have written a program which raytraces a ground plane at 18fps on a Pentium Pro
200, and it has 9 Multiplications, 2 divides, 2 Mods, and it does that for each
of the 32000 pixels per frame, All of them Floating point.>>

Well no wonder?! You're running on 200Mhz. Try running that code on a 486 with
33Mhz!!! First off floating point is like a speed killer, division is even
slower than multiplication (unless you're using integer division) and MODs well
I think they're about as fast as integer division. Anyway, that code wouldn't
even run on a system like the one I described. Its not fast at all, the
processor is what is fast.

I do all my speed testing on a 486 33Mhz, I know what's fast and what's
not...and I know enough to know 768 mutiplications and 768 additions is
seriously slow, especially to update the palette once.

The problem is that optimization doesn't mean much anymore, the processor takes
care of all the speed stuff for you. I find that sad.

and if you can do that sort of maths at that sort of speed, then a few
multiplications, are not going to cause any problems.>>
-Eclipzer

X-Tech (http://members.aol.com/eclipzer/x-tech/init.htm)



Tue, 01 Jan 2002 03:00:00 GMT  
 Need help: colors on SCREEN 13

Quote:

> <<Seriously the time taken by the multiplication has absolutley nothing to do
> with the slow speed of the PALETTE command, the multiplications could take at
> much as 1/86th of a second to complete and it'd still be the same speed.>>

> I've been doing code optimization enough to know that 3 HUGE multiplications
> especially in a FOR LOOP which loops 256 times is SLOW. There's just no denying
> it.

Those three multiplications may slow the code down a lot, but it still doesn't
change the fact that those multiplications have nothing to do with the slow speed
of the palette command, it's slow speed is totally due to the fact it waits for a
vertical retrace.

Quote:
> << in most cases the use of maths slows the thing down, but hey so does
> everything else, and you have to work out what is the fastest way to do
> something in a given situation. even with hellishly large numbers of
> multiplications and divisions you can get some very fast code for example, I
> have written a program which raytraces a ground plane at 18fps on a Pentium Pro
> 200, and it has 9 Multiplications, 2 divides, 2 Mods, and it does that for each
> of the 32000 pixels per frame, All of them Floating point.>>

> Well no wonder?! You're running on 200Mhz. Try running that code on a 486 with
> 33Mhz!!! First off floating point is like a speed killer, division is even
> slower than multiplication (unless you're using integer division) and MODs well
> I think they're about as fast as integer division. Anyway, that code wouldn't
> even run on a system like the one I described. Its not fast at all, the
> processor is what is fast.

on a 486 slc25 laptop it runs at 1.2 frames per second, so it's not that slow.
and 200mhz is slow by current standards, most companies don't even advertise that
they sell anything under 300mhz. and intel is cutting production (it's probably
already cut it) of all chips under that speed.

Quote:
> I do all my speed testing on a 486 33Mhz, I know what's fast and what's
> not...and I know enough to know 768 mutiplications and 768 additions is
> seriously slow, especially to update the palette once.

but alot of the multiplication can be speeded up with lookup tables. even if you
did that, the code would still run at the same speed if you used palette

Quote:
> The problem is that optimization doesn't mean much anymore, the processor takes
> care of all the speed stuff for you. I find that sad.

This code is as optimised as it can be, there are certain limits to how much you
can optimise it, it is a raytracer after all, and each pixel requires an
intersection test, which requires at least one divide and to work out the fog you
need several multiplications, and to find out the texture location you need mods,
and multiplies, I know plenty about optimisation, I have written plasma generators
that run at 80fps, if you look at the latest ABC packet, you'll find a bump mapper
of mine that runs at over 200fps on a pentium pro 200, and 30fps on my 25mhz
laptop.

TTFN
Arclight



Wed, 02 Jan 2002 03:00:00 GMT  
 
 [ 16 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Need help with page flipping using SCREEN 13

2. 256,000 Colors in Screen 13 (To Martin)

3. 256,000 Colors in Screen 13

4. QBasic: putting total screen on disk when SCREEN-mode=13

5. Error 13 Help Needed - Correction

6. Error 13 Help Needed

7. 13 year old needs animation help

8. 13 year old needs ASCII help

9. Help needed with runtime error 13

10. 13 year old needs animation help

11. 13 year old needs ASCII help

12. Need Help With error 13

 

 
Powered by phpBB® Forum Software