Difference between revisions of "Palette"

From veswiki
Jump to: navigation, search
 
Line 9: Line 9:
  
 
<pre>
 
<pre>
 +
 +
; Using the BlitGraphic routine (offsets x and y with 4 pixels)
 
; palette
 
; palette
  
Line 14: Line 16:
 
.byte clear ; color 1
 
.byte clear ; color 1
 
.byte green ; color 2
 
.byte green ; color 2
.byte 125 ; x position
+
.byte 121 ; x position
 
.byte 0 ; y position
 
.byte 0 ; y position
 
.byte 2 ; width
 
.byte 2 ; width
Line 25: Line 27:
 
.byte %00010000
 
.byte %00010000
  
</pre>
 
  
The background colors are coded like this: <br>
+
  ; The background colors are coded like this:
<pre>
+
 
00 black
+
  ;00 black
01 lt. grey
+
  ;01 light grey
10 lt. blue
+
  ;10 light blue
11 lt. green
+
  ;11 light green
 
</pre>
 
</pre>

Latest revision as of 17:29, 23 February 2019

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 blit 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.


	; 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
	.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