Difference between revisions of "Palette"

From veswiki
Jump to: navigation, search
m (1 revision)
(No difference)

Revision as of 21:23, 16 November 2012

To change the background color two columns of the VRAM is used to set the background for each row.

You need to set column 125 and 126, that's along the red vertical lines on the right side in the full VRAM screenshot when using plot and blir routines from this wiki you'll use columns 121 and 122 as the upper right visible corner of the game area in MESS are relocated to coordinates 0,0 instead of 4,4.

The palette can be set using the BlitGraphic routine, just define a tall box 2x58 pixels at coordinates (121,0). Then you set the color for each row using two bits, one byte sets four rows.
To set the total visible area (in MESS) of 102x58 you need 14,5 bytes, just pad it up to an even 15 bytes with zeroes.

If you cut and paste this data, you can just change the ones and zeroes in the end to change palette.

	; palette

	.byte	clear			; color 1
	.byte	green			; color 2
	.byte	121			; x position
	.byte	0			; y position
	.byte	2			; width
	.byte	58			; height
	.word	gfx.palette.data	; address for the graphics

		.byte	%10101010, %10101010, %00100010, %00100010, %00100010, %00100010, %00100010
		.byte	%00100010, %00001000, %10100001, %00010001, %00010001, %00010001, %00010001
		.byte	%00010000

The background colors are coded like this:

00 black
01 lt. grey
10 lt. blue
11 lt. green