Paletten-manipulation-m13h-stupid-beginner

Started by
4 comments, last by NexusOrganicus 21 years, 2 months ago
Hi Gurus, sorry for posting all the time nasty beginner ! ok my problem is this f... Palette and i don´t understand a single thing of all that ! Ok i know there is this green red and blue Value struct palette { unsigned char r unsigned char g unsigned char b }; 3 unsinged char values but i don´t know how to get them work i don´t understand the registers ? how can i access them without a lot of asm Is there an easy way to change the palette ? how can i save a palette ? &&&&&&&&&& lot´s of questions next thing : i want to load a saved palette like the one from photoshop and want to set my palette correct ! _____________________________________________________ I would like to post my code here but i don´t know how lol sorry for my bad english thanxs nxo
_______D___
Advertisement
I have look to my source code from 99 and found this
void setpal(uchar *pal);
#pragma aux setpal "*" parm[esi]modify[eax ecx edx esi]

and external asm
setpal PROC
mov ecx,768
mov edx,3c8h
xor al,al
out dx,al
inc edx
rep outsb
ret
setpal endp

That''s mean in esi is the pointer to the RGB[256][3] struct.
ecx is the # of loops 256*3=768 ;-)
if I''m correct this will be without asm in C something like this:

outp(0x3c8,0);
for (i=0;i<768;i++) outp(0x3c9,*(pal+i));

Getting pallete is somethink like setting, but I can''t remember what port was that.

I recommend you to download norton guid and/or sysman. If it still exist ;-). It was great help to work in DOS.

Sorry for my english too.


If you only want to do 2d stuff, in Mode 13h, then try the Allegro API:

http://www.talula.demon.co.uk/allegro/

It has Palette functions that do the routines you require. Otherwise the only way is to write palette code in assembler yourself.

Hi again
thanxs for your replys ,
i m not very wiser yet
I should have a look at all that routines ?lol i am using
can anybody tell me how i can post code here?
thx
nxo
What compiler/IDE are you using? Here''s a Turbo C++ snippet I wrote once.

  #include <dos.h>void rgb(int f ,int r, int g, int b){  REGS rr;  rr.h.ah=0x10;  rr.h.al=0x10;  rr.x.bx=f;  rr.h.ch=g;  rr.h.cl=b;  rr.h.dh=r;  int86(0x10,&rr,&rr);}  


quote:Original post by NexusOrganicus
can anybody tell me how i can post code here?

Check the FAQ. Or just press the "edit" link next to my post and take a look at the source.
"-1 x -1 = +1 is stupid and evil."-- Gene Ray
I am using borland c
i found something but i am still experimenting
can anyone tell me whats that about ?

outp(0x03c8, 0);
outp(0x03c9, red); ==== i mean there are all the same ports
outp(0x03c9, green);==== registers
outp(0x03c9, blue);===== that i change
______________________and only one color changes if i change the value of red or green or blue
thanks for the _code

can any one tell me how i can post some code here ?
thx
nxo
visit www.omnizid.net for some tutorials
i downloaded once
_________________

_______D___

This topic is closed to new replies.

Advertisement