Im trying to make a very simple BMP shower. Should be easy, but i have a problem with the colors.
I use the 13h graphic mode.
I have found out how to load the picture into the memory and how to copy it onto the screen. The picture looks ok, but the colors are all wrong.
I found out that the colors are in the picture offset+54 position(?). The colors are stored in the BMP file as BGRX (X=not used). I copy the colors to the palette as RGB, starting from offset+54 (BGR) into color 0 (RGB), offset+54 into color 1 and so on. But it shows the wrong colors.
What am i doing wrong? Do anybody have an exampel of how to do it?
Does it matter if i use: 24-bit, 256 colors or 16 colors.
My palette routine looks like this (I hope it helps):
mov dx,03c8h ;Port to define color number to change
mov bx, offset picture ;Adr. to get the BGRX information
mov cx,256 ;number of loop
mov al,0 ;Start at color 0
out dx, al ;output to port 03c8H what color to change.
inc al ;Inc the color number
push ax ;Push al to the stack to save the next color number
inc dx ; change dx to 03c8h
inc bx ;inc bx two times to copy colors as RGB from the BGRx-bmp
mov al,cs:[bx] ;Red-out to port. My file is in the same block as the code thats why i use cs:[bx]
dec bx ;dec bx to take the "next" color
mov al,cs:[bx] ;Green
mov al,cs:[bx] ;Blue
dec dx ;dec dx to make it 03c8h again
inc bx ;inc bx four times to make bx point to next BGRX-block in bmp file
pop ax ; get ax from stack to make ready to take next color in palette.
I know this is probably not the coolest way to do it but im only been programming for 5 days. So i have a lot to learn i know....
Hope somebody can help me with my problems.