Difference between revisions of "Palette"

From veswiki
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
To change the background color two columns of the VRAM is used to set the background for each row.  
+
Two columns of the VRAM is used to set the background color for each row.  
  
You need to set column 125 and 126, that's along the red vertical lines on the right side in the [http://channelf.se/veswiki/images/1/1b/Videocart5fullscreen.png 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 columns 125 and 126 is used for this. That's along the red vertical lines on the right side in the [https://channelf.se/veswiki/images/1/1b/Videocart5fullscreen.png 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 [[Snippet:Blit|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.<br>
 
The palette can be set using the [[Snippet:Blit|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.<br>
 
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.
 
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.
+
If you copy and paste this data, you can just change the data under gfx.palette.data to edit the palette.
  
 
<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 121 ; x position
+
.byte 121 ; x position if using 4 offset adjusted for MESS screen, it's really 125.
 
.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 13:38, 12 April 2022

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