Palettes: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
mNo edit summary
 
mNo edit summary
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
There are 2 banks of 256 palettes of 16 colors made of 16bit RGB definitions available.
[[File:Palmap.png|500px|thumb|Palettes organization.]]
Palettes are located at $400000 in the 68k's memory map and is 16kB in size.
There are 2 banks (one usable at a time) of 256 palettes available. Each palette has 16 [[colors|color entries]], the first being the transparent index ("color 0"), the 15 others are real colors, made of 16-bit RGB definitions.


Only one bank can be used at a time. They can be switched by using register ???
[[Sprites|Sprite]] tiles can use '''any''' of the 256 palettes, while the [[Fix layer|fix]] tiles can '''only use the first 16'''.


Color definition: DrgbRRRRGGGGBBBB, D is the Dark bit. RGB are the MSBs of each components, rgb are the LSBs.
The maximum number of colors on screen without [[timer interrupt]] tricks is: 256 palettes * 15 colors = '''3840''' (out of 2^16 = 65536).


[[Sprites|Sprite]] tiles can use any of the 256 palettes, while [[Fix layer|fix]] tiles can only use the 16 firsts.
=Color format=


Max colors on screen with [[68k interrupts|RLI]] tricks: 256*16=4096 out of 2^16=65536.
See [[colors]].


Palettes are stored in [[Palette RAM]].
=Access=


[[Catégorie:Video system]]
Palettes are located at $400000 in the [[68k memory map]]. They're physically stored in the [[palette RAM]].
 
Byte writes are allowed, but the value will be written to both bytes of the word (/WE pins are tied together).
 
The palettes can be read and written at full speed at any time. During active display, since the CPU has priority over rendering, the color read or written will be displayed during at least one pixel, resulting in noticeable "snow" if multiple colors are updated. A workaround is to update the palettes only during blanking (horizontal or vertical), over multiple frames if necessary.
 
The bank can be set by doing a byte write to registers {{Reg|REG_PALBANK1}} or {{Reg|REG_PALBANK0}}.
 
=Special colors=
 
There are two special colors used:
 
* The first color of the palette bank ($400000) is the [[reference color|'''R'''eference color]] for the video output. It always has to be pure black ($8000) otherwise monitors won't be happy and other colors won't be displayed correctly.
* The last color of the palette bank ($401FFE) is the [[backdrop color|'''B'''ackdrop color]], the color of the backmost [[layer]] on the screen. Caused by line buffers in {{Chipname|NEO-B1}} being cleared to $FFF (referencing the last color of the last palette).
 
[[Category:Video system]]

Latest revision as of 03:46, 12 December 2018

Palettes organization.

There are 2 banks (one usable at a time) of 256 palettes available. Each palette has 16 color entries, the first being the transparent index ("color 0"), the 15 others are real colors, made of 16-bit RGB definitions.

Sprite tiles can use any of the 256 palettes, while the fix tiles can only use the first 16.

The maximum number of colors on screen without timer interrupt tricks is: 256 palettes * 15 colors = 3840 (out of 2^16 = 65536).

Color format

See colors.

Access

Palettes are located at $400000 in the 68k memory map. They're physically stored in the palette RAM.

Byte writes are allowed, but the value will be written to both bytes of the word (/WE pins are tied together).

The palettes can be read and written at full speed at any time. During active display, since the CPU has priority over rendering, the color read or written will be displayed during at least one pixel, resulting in noticeable "snow" if multiple colors are updated. A workaround is to update the palettes only during blanking (horizontal or vertical), over multiple frames if necessary.

The bank can be set by doing a byte write to registers REG_PALBANK1 or REG_PALBANK0.

Special colors

There are two special colors used:

  • The first color of the palette bank ($400000) is the Reference color for the video output. It always has to be pure black ($8000) otherwise monitors won't be happy and other colors won't be displayed correctly.
  • The last color of the palette bank ($401FFE) is the Backdrop color, the color of the backmost layer on the screen. Caused by line buffers in NEO-B1 being cleared to $FFF (referencing the last color of the last palette).