Palette

From veswiki
Jump to: navigation, search

Two columns of the VRAM is used to set the background color for each row.

The columns 125 and 126 is used for this. That's along the red vertical lines on the right side in the full VRAM screenshot. When using the "plot" and "blit" routines from this wiki you'll be using columns 121 and 122 because the upper left visible corner of the game area in the MESS/MAME emulator are relocated from coordinates (4,4) to coordinate (0,0).

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 copy and paste this data, you can just change the data under gfx.palette.data to edit the palette.


	; Using the BlitGraphic routine (offsets x and y with 4 pixels)
	; palette

gfx.palette.parameters:
	.byte	clear			; color 1
	.byte	green			; color 2
	.byte	121			; x position if using 4 offset adjusted for MESS screen, it's really 125.
	.byte	0			; y position
	.byte	2			; width
	.byte	58			; height
	.word	gfx.palette.data	; address for the graphics

gfx.palette.data:
		.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 light grey
   ;10 light blue
   ;11 light green