palette in screen 12 
Author Message
 palette in screen 12

hello :-)

I am using Qbasic on a DX2-66 with 1M video card and CL5426/8 screen driver.
I am trying to use a specific colour palette in screen mode 12.
The help file tells me that I have 16 attributes with a max of 256k colours.
However, the palette statement only gives me 63 shades of red.This must
be because palette lets you state only one number.
I have tried every conceivable syntaxis like palette x,r,g,b or
palette x,(r,g,b) but it just doesn't work, and the help isn't really very
helpful either.
Is there a way around this problem ? I just want to use a self-defined color
palette with 16 colours specified as 24bit rgb value.
BTW, will anything give me more than 16 attributes ?

aTdHvNaAnKcSe, bye,
Marc.
------------------------------------------------------------------------------

snail-mail: Isabellakaai 126 9000 Gent Belgium phone 09/264.71.52 050/42.78.68
------------------------------------------------------------------------------
   > Now I know why they're noodling and where they're noodling, and I can  
   tell the difference between good noodling and bad noodling, but without  
   some musical clues, it all just sounded like noodles to me. Frank Zappa  
------------------------------------------------------------------------------



Wed, 17 Dec 1997 03:00:00 GMT  
 palette in screen 12

'hello :-)

'I am using Qbasic on a DX2-66 with 1M video card and CL5426/8 screen driver.
'I am trying to use a specific colour palette in screen mode 12.
'The help file tells me that I have 16 attributes with a max of 256k colours.
'However, the palette statement only gives me 63 shades of red. This must
'be because palette lets you state only one number.
'I have tried every conceivable syntaxis like palette x,r,g,b or
'palette x,(r,g,b) but it just doesn't work, and the help isn't really very
'helpful either.

 Try this then:

 PALLETTE Attribute%, (Blue% * 65536) + (Green% * 256) + Red%

--
"...AND WITH DUST IN THROAT I CRAVE, ONLY KNOWLEDGE WILL I SAVE,
TO THE GAME YOU STAY A SLAVE... - ROVER                  WANDERER
                                  NOMAD                  VAGABOND
                                - CALL ME WHAT YOU WILL." (Hetfield/Ulrich)



Thu, 18 Dec 1997 03:00:00 GMT  
 palette in screen 12

Quote:
>X-Newsreader:

TIN [version 1.2 PL2]

Quote:

>hello :-)

>I am using Qbasic on a DX2-66 with 1M video card and CL5426/8 screen driver.
>I am trying to use a specific colour palette in screen mode 12.
>The help file tells me that I have 16 attributes with a max of 256k colours.
>However, the palette statement only gives me 63 shades of red.This must
>be because palette lets you state only one number.
>I have tried every conceivable syntaxis like palette x,r,g,b or
>palette x,(r,g,b) but it just doesn't work, and the help isn't really very
>helpful either.
>Is there a way around this problem ? I just want to use a self-defined color
>palette with 16 colours specified as 24bit rgb value.

Try this program:

-----CUT HERE-----

DEFLNG A-Z
SCREEN 12: CLS
INPUT "Intensity of red (0-63): ", red
INPUT "Intensity of green (0-63): ", green
INPUT "Intensity of blue (0-63): ", blue
PaletteValue = 65536 * blue + 256 * green + red
PALETTE 0, PaletteValue
PRINT "Press any key to continue."
WHILE INKEY$ = "": WEND
PALETTE
END

-----CUT HERE----

Quote:
>BTW, will anything give me more than 16 attributes ?

No, unless you use SCREEN 13, when you have 256 to work with.

---
Boyd Ross

FidoNet E-Mail: 1:255/200

- Don't blame me for my mistakes.  My modem is error-correcting.

- May the farce be with you!

* If at first you don't succeed, destroy all evidence that you tried.



Thu, 18 Dec 1997 03:00:00 GMT  
 palette in screen 12

->>> THIS JUST IN:  Marc De Bruyne has been spotted in a local night
-->> club whispering something about "palette in screen 12" to a shady
---> character named All.  Check it out!


 MDB> Subject: palette in screen 12
 MDB>
 MDB> I am using Qbasic on a DX2-66 with 1M video card and CL5426/8 screen
 MDB> driver. I am trying to use a specific colour palette in screen mode 12.
 MDB> The help file tells me that I have 16 attributes with a max of 256k
 MDB> colours. However, the palette statement only gives me 63 shades of
 MDB> red.This must  be because palette lets you state only one number.
 MDB> I have tried every conceivable syntaxis like palette x,r,g,b or
 MDB> palette x,(r,g,b) but it just doesn't work, and the help isn't really
 MDB> very helpful either.
 MDB> Is there a way around this problem ? I just want to use a self-defined
 MDB> color palette with 16 colours specified as 24bit rgb value.
 MDB> BTW, will anything give me more than 16 attributes ?

 I use mode 13, which gives me 256 attributes/256k colors.  The below
 should also work for mode 12.

 Red, Green, and Blue have 64 shades each, ranging from 0 to 63.

 The attribute is calculated like this:
                          '64k
            attribute& = (65536 * b%) + (256 & g%) + r%

 Use PALETTE Colr%, attribute& to set the correct palette.

 Don't forget the long (&), as the numbers generated are very large.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Bradley D. Hartin -- San Antonio, TX     /|\  C Program Run.
United States of America                 |||  C Program Crash.


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
PGP v2.6.2  /|\  1024 bit key  /|\  2047 bit key  /|\"We're only here
Public keys |||   1994/11/14   |||   1995/01/01   ||| for a while, so
available   ||| ID: 0xFDF0BB5D ||| ID: 0x2F9925C1 ||| why not smile--
by EMail or |||  Fingerprint:  |||  Fingerprint:  ||| Hey, living
keyservers  |||  BA 96 AB E2   |||  F2 E2 DA 74   ||| ain't all that
            |||  33 85 27 F0   |||  87 B0 95 96   ||| bad." - Give Me
            |||  9B A5 B2 8A   |||  37 7D 81 4F   ||| One More Shot -
            \|/  1C 1D B0 DC   \|/  66 40 D8 AC   \|/ Alabama
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

~~~ Quote Header 1.3 - (C) 1994, Bradley Hartin

... CGA is the pallete from HELL!
___ Blue Wave/QWK v2.12



Fri, 19 Dec 1997 03:00:00 GMT  
 palette in screen 12

->>> THIS JUST IN:  Bradley Hartin has been spotted in a local night
-->> club whispering something about "Re: palette in screen 12" to a shady
---> character named All.  Check it out!

 BH> attribute& = (65536 * b%) + (256 & g%) + r%

 This should be

 BH> attribute& = (65536 * b%) + (256 * g%) + r%
                                     ^^^

 Sorry about the typo... I decided to correct it because I mentioned the "&"
 character later in the posting.


... Why did CNN cancel that cool "Desert Storm" show?
___ Blue Wave/QWK v2.12



Fri, 19 Dec 1997 03:00:00 GMT  
 palette in screen 12

Quote:
Bruyne) writes:

>hello :-)

>I am using Qbasic on a DX2-66 with 1M video card and CL5426/8 screen driver.
>I am trying to use a specific colour palette in screen mode 12.
>The help file tells me that I have 16 attributes with a max of 256k colours.
>However, the palette statement only gives me 63 shades of red.This must
>be because palette lets you state only one number.
>I have tried every conceivable syntaxis like palette x,r,g,b or
>palette x,(r,g,b) but it just doesn't work, and the help isn't really
very
>helpful either.
>Is there a way around this problem ? I just want to use a self-defined
color
>palette with 16 colours specified as 24bit rgb value.
>BTW, will anything give me more than 16 attributes ?

>aTdHvNaAnKcSe, bye,
>Marc.

<<rest deleted>>>

Marc,

You have already received good replies, but I have a QBasic program to
get the palette numbers from RGB values, or the reverse and in either
case to show the color.  I have been using it a lot in designing color
palettes recently.  Hope it is of use to anyone using SCREEN 12
palettes.

----BEG Program-----
REM **** for QBasic SCREEN 12, VGA with 16 palette attributes ****
REM ** 1. Find RGB values from QBasic Palette Number  and show COLOR OR
'      2. Show COLOR and QBasic Palette Number from RGB Values.
'      The QBasic palette number is derived from RGB values (0-255) by
the
'      formula: pal& = ((red \ 4) + (green \ 4) * 256 + (blue \ 4) *
65536)
'                                     program name: FINDSHOW.BAS
CLS
SCREEN 12
PALETTE 0, 2105376                   'medium gray background color
PALETTE 1, 3421230                   'silver
COLOR 1
LOCATE 10, 20
INPUT "Enter _1_ to Find RGB, _2_ to Show RGB"; yn$
CLS
IF yn$ = "1" THEN
  LOCATE 22, 20
  INPUT "enter palette attribute number"; pal&
'
  blue = FIX(pal& / 65536)
  green = FIX((pal& - blue * 65536) / 256)
  red = pal& - green * 256 - blue * 65536
  red = red * 4
  green = green * 4
  blue = blue * 4
  LOCATE 24, 16
  PRINT pal&; " = red "; red; " green = "; green; " blue = "; blue
ELSE
  LOCATE 22, 15
  PRINT "Enter RED      , Enter GREEN      , Enter BLUE      "
  LOCATE 22, 25
  INPUT ; red
  LOCATE 22, 44
  INPUT ; green
  LOCATE 22, 62
  INPUT ; blue
  pal& = ((red \ 4) + (green \ 4) * 256 + (blue \ 4) * 65536)
  LOCATE 24, 24
  PRINT "QBasic palette number "; pal&
END IF
PALETTE 2, pal&
LINE (170, 60)-(450, 240), 2, BF
END
---END Program---




Sat, 20 Dec 1997 03:00:00 GMT  
 palette in screen 12

Quote:

>  BH> attribute& = (65536 * b%) + (256 & g%) + r%

>  This should be

>  BH> attribute& = (65536 * b%) + (256 * g%) + r%
>                                      ^^^

>  Sorry about the typo... I decided to correct it because I mentioned the "&"
>  character later in the posting.

Don't forget to add an ampersand (&) to the constant 65536.
Without that, you may get an integer overflow during the calculation.
Making the constant a long integer will prevent that from happening.

(The same could be said about the constant 256, but since g% should
be less than 64, it shouldn't be a problem.)

---
Glen Blankenship



Sun, 21 Dec 1997 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. faster PSET for SCREEN 12 / memory layout of SCREEN 12

2. Palette in QB45 Screen Mode 12 & 13

3. Screen 12 with Palette Using

4. save/load SCREEN 12 screens in QBasic?

5. Screen 12 backgrounds in QB 4.5

6. 80x60 in PowerBASIC Screen 12

7. Screen 12

8. Address for Screen 11,12,13?

9. Getting screen 12 in ASIC

10. QBasic Screen 12 Text

11. Bload and bsave in screen 12

12. Background Colour in QBasic screen mode 12

 

 
Powered by phpBB® Forum Software