Colorscreen mode 256 colors 
Author Message
 Colorscreen mode 256 colors

Is there anyone who can help me with this matter? I'd like to use 256
colors in my graphical application. But I'm stuck with 16 colors and
can't find the right mode for 256 colors. I thought it was 8 bits who were
used for the 256 colors, but if I uses a number greater than 16 my pc
reduce it to a number in the range [0 - 15].
Thanks in advance!


Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors

Quote:

> Is there anyone who can help me with this matter? I'd like to use 256
> colors in my graphical application. But I'm stuck with 16 colors and
> can't find the right mode for 256 colors. I thought it was 8 bits who were
> used for the 256 colors, but if I uses a number greater than 16 my pc
> reduce it to a number in the range [0 - 15].
> Thanks in advance!

        Do u ever have to have more than 16 on the screen at a time? If not,
you can just manually adjust the palette.

----------------------------------------------------------------------
    Paul Matthews - Lead Programmer : Creative Logic Software
  Check out Reality's Fringes at http://www.singnet.com.sg/~pmatth/
----------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors
If you are using BGI, you need the correct .BGI driver for your video
mode/card.  For example, VGA256 for 320x200x256 mode, and there are
various SVGA and VESA ones too.  I have a set of 'tweaked' ones I
downloaded from somewhere (someone round here will probably know the URL)
which can do up to 16M colours!

If you're still stuck, mail me.

        -Ben Jones-


Quote:
>>>  Come visit the WaistWear homepage!   <<<
> at http://www.compulink.co.uk/~waistwear/ <



Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors


Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors

Quote:

>> I wrote a program with Pascal that puts the moniter in vga mode, the
>>only problem was that the program looked for the .bgi file in a certain
>>directory on my hard disk! so anyone who runs the program and doesn't
>>have the bgi file it wont work! Is there some way to make it so that it
>>doesn't need and external driver?
>Look around in your example files.  You should find a file called
>BGIDRIV.PAS that shows you how to link drivers directly into your program.  
>If you don't want to do that (it makes for a very fat .EXE), just rewrite
>your code so that it asks for a directory for the BGI file if it can't find
>it.  Some very pseudo-code:
>procedure init_BGI;
>var
>  BGI_found : boolean;
>  BGI_path : string;
>begin
>  BGI_path := ''; {current directory}
>  BGI_found := false;
>  repeat
>    initialize BGI;
>    if BGI not initialized then
>      begin
>        prompt for path to BGI;
>        readln new path into BGI_path;
>      end
>    else
>      BGI_found := true;
>  until BGI_found;
>end;
>>please help. I am very young and
>>frustrated. I am 14 and I am totally bald!
>Hey, no big deal.  I'm 22, but I'm not much better off.  :-)
>--
>Scott F. Earnest            | We now return you to our regularly scheduled


Another suggestion:
Use an environment variable. I prefer doing it like this.
Example:
Uses Dos,Graph;
Var Driver,Mode:Integer;
Begin
  Driver:=Detect;
  Initgraph(Driver,Mode,Getenv('BGI'));
  ...
End.

To make it work you have to enter the line "SET BGI=C:\BP\BGI"
(insert the correct path) at the Dos prompt or - better - put it into
your Autoexec.Bat.

Of course any user of your program would have to do the same - and of
course they must have the Bgi files. So you have to give the Bgi files
away together with your program. (Btw, you're allowed to do that
according to Borland's license contract!)

My suggestion works best if you know all the users of your programs.
(In my case: some programmers who had installed BP in different
directories but wanted to exchange their programs easily.)
It also works the better the more programmers do it like this. So as
this is a newsgroup I'm asking all who do Bgi programming:
Do you consider using env-vars?
Other suggestions?

Frank



Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors

Quote:

> I wrote a program with pascal that puts the moniter in vga mode, the
>only problem was that the program looked for the .bgi file in a certain
>directory on my hard disk! so anyone who runs the program and doesn't
>have the bgi file it wont work! Is there some way to make it so that it
>doesn't need and external driver?  please help. I am very young and
>frustrated. I am 14 and I am totally bald!

What you need to do, is BINOBJ the BGI files you wish to use.

EG:   binobj egavga.bgi egavga.obj egavgadriver

(Full instruction supplied with TP7)
Then in you program, you need to define your .BGI procedures as
follows:
Procedure(EgaVgaDriver);External;
{$L EgaVga.OBJ};

and then register you BGI driver like this :


When you Compile the program, you have that .BGI driver included in
the EXE.

Hope this helps



Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors
Look at the programs BGILINK, BGIDEMO etc somewhere in your TP directory.
They demonstrate how it is possible to link the BGI code directly inside
your programs, so no external file is needed.

        -Ben Jones-


Quote:
>>>  Come visit the WaistWear homepage!   <<<
> at http://www.compulink.co.uk/~waistwear/ <



Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors


Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors
Hello Gerbrand!



 GR> Is there anyone who can help me with this matter? I'd like to use 256
 GR> colors in my graphical application. But I'm stuck with 16 colors and
 GR> can't find the right mode for 256 colors. I thought it was 8 bits who were
 GR> used for the 256 colors, but if I uses a number greater than 16 my pc
 GR> reduce it to a number in the range [0 - 15].
 GR> Thanks in advance!

begin
asm
  mov ax,13h
  int 10h
end;
  fillchar(mem[$a000:0],64000,15);
{white screen}
readln;
asm
  mov ax,3h
  int 10h
end;
end.

 GR>  + Origin: University of Ghent, Belgium (2:236/501.1)

Regards Mikkel Breiler Cosysop Renoz BBS, Vinyl/Intuition




Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors


Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors
:  I wrote a program with pascal that puts the moniter in vga mode, the
: only problem was that the program looked for the .bgi file in a certain
: directory on my hard disk! so anyone who runs the program and doesn't
: have the bgi file it wont work! Is there some way to make it so that it
: doesn't need and external driver?  please help. I am very young and
: frustrated. I am 14 and I am totally bald!

:                     _______
:                    /       \
:                   ##       ##
:                  (|  o  o  |)
:                   |   ( )  |
:                   \   __   /
:                    \______/

As far as I understand, you must make an object file (using binobj) from
bgi driver and then include it in your program ( {$L} directive ).



Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors


Wed, 18 Jun 1902 08:00:00 GMT  
 Colorscreen mode 256 colors


Quote:

>The only support BGI gives for 256-color mode requires that you hunt down the
>various VESA SVGA .BGI drivers.  If you don't have the initiative, maybe
>you'll have the initiative to do some REAL coding. :)

>procedure setpalette (var pal); assembler;
>(* pal is an array[0..255, 0..2] containing the entire set of color
>** attributes.  you'll want to make sure that the word-align data
>** option is turned on.
>*)
>asm
>  mov dx, 03C8h
>  xor al, al
>  out dx, al
>  inc dx

>  les di, pal
>  mov cx, 384

>  mov ax, es:[di]
>  out dx, al
>  xor ah, al
>  out dx, al

I think you need an 'add di,2' in here.  Btw, I hadn't seen a palette
set quite like this before (ie, this obfuscated).  I approve. ;)

Quote:

>  dec cx

>end;
>Quantum Porcupine    


Project WallyWorld:  BeBox version soon to come (and then merchandising,
a book deal, and hopefully a movie ;).


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Vesa unit for all 256 and 65K color modes (protected,real mode)

2. 256 Color Mode

3. Mouse in 256 color mode PROBLEM

4. 256 color text mode

5. 256 colors - VGA - mode?

6. 256 color mode - HELP!!!

7. HELP: Showing Mouse in SVGA 256 colors mode

8. HELP: Showing Mouse in SVGA 256 colors mode

9. info on 640x480 256 color mode??

10. info on 640x480 256 color mode??

11. Answer to 256 colors SVGA modes.

12. 256 color image on a 16 color screen?

 

 
Powered by phpBB® Forum Software