flat assembler
Message board for the users of flat assembler.
Index
> Main > indexed image. |
Author |
|
edfed 18 Jan 2010, 13:06
hello!
i have a problem wiht indexed palette. i create images with gimp, it will be defined as a Cheader. then, i modify a little this header, and use it for asm. in the header, we have: palette bitmap but, i have my palette defined. then, i want this bitmap to be transposed in my palette. it gives me this problem: define a color in the palette. if this color is still in palette then, transpose all reference to this new color code. if color is not in palette then if no free color entry then, seek for the nearest palette value. else, add this color directlly in a free palette location and relocate every reference to this palette. the palette is very interresting. in hardware it is 3*256 6bits bytes in Cheaders, it is 3*256 bytes. in my fashion, it is 4*256 bytes. then, the fourth byte can be used for axample as a counter or a alpha channel. for the moment, it is used as alignment. each frame refresh( vrtical retrace) i update screen and palette. palette is then buffered too. and then, modifiable in "real time" without any I/O operation on VGA registers. a note about palette update and vertical retrace. if you change the palette in an other place in code (for example, 10 ms after vertical retrace, it will be horrible. then, solution for palette update is: Code: refresh: .call=0 .c=4 .pal=8 .r=0 .g=1 .b=2 .a=3 mov dx,3dah @@: in al,dx test al,08h je @b mov bl,[esi+.c] mov bh,bl shl ebx,16 mov bl,[esi+.c] mov bh,bl xor edi,edi @@: mov eax,[fs:edi*4];+320*8] mov [fs:edi*4],ebx mov [es:edi*4],eax inc edi cmp edi,320*50;-320*4 jl @b .palette: mov edi,[esi+.pal] mov dx,3c8h mov al,0 out dx,al mov dx,3c9h mov cl,0 @@: mov al,[edi+.r] shr al,2 out dx,al mov al,[edi+.g] shr al,2 out dx,al mov al,[edi+.b] shr al,2 out dx,al add edi,4 dec cl jne @b .timer: push dword 0 dword[int8.ticks] pop dword[int8.inc] dword[int8.ticks] ret put palette code before frame buffer code have various effect on your screen. it is not the same for CRT and LCD. and then, the bitmap to display:
|
|||||||||||
18 Jan 2010, 13:06 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.