Set default CPC palette

This commit is contained in:
Thomas Bernard 2018-11-22 13:45:35 +01:00
parent ab5d26897f
commit 119a5afbf6
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C
3 changed files with 64 additions and 39 deletions

View File

@ -309,12 +309,14 @@ void Button_Constraint_menu(void)
ZX_Spectrum_set_palette(Main.palette);
break;
//case IMAGE_MODE_THOMSON:
// ask TO7/70, MO5 or MO6 / TO8/TO9
/// @todo set palette for Thomson.
/// ask TO7/70, MO5 or MO6 / TO8/TO9
case IMAGE_MODE_EGX:
case IMAGE_MODE_EGX2:
case IMAGE_MODE_MODE5:
case IMAGE_MODE_RASTER:
// TODO : CPC
CPC_set_HW_palette(Main.palette + 0x40);
CPC_set_default_BASIC_palette(Main.palette);
break;
case IMAGE_MODE_C64HIRES:
case IMAGE_MODE_C64MULTI:

View File

@ -462,8 +462,6 @@ void ZX_Spectrum_set_palette(T_Components * palette)
}
}
void CPC_set_HW_palette(T_Components * palette)
{
static const T_Components CPC_Hw_Palette[] = {
{0x6E, 0x7D, 0x6B}, // 0x40
{0x6E, 0x7B, 0x6B}, // 0x41
@ -501,9 +499,27 @@ void CPC_set_HW_palette(T_Components * palette)
{0x6E, 0x7B, 0xF6}
};
void CPC_set_HW_palette(T_Components * palette)
{
memcpy(palette, CPC_Hw_Palette, sizeof(CPC_Hw_Palette));
}
void CPC_set_default_BASIC_palette(T_Components * palette)
{
static const byte basic_colors[] = {
0x44/*0x50*/, 0x4a, 0x53, 0x4c,
0x4b, 0x54, 0x55, 0x4d,
0x46, 0x5e, 0x5f, 0x47,
0x52, 0x59, 0x4a, 0x47
};
unsigned int i;
for (i = 0; i < sizeof(basic_colors) / sizeof(byte); i++)
memcpy(palette + i,
CPC_Hw_Palette + basic_colors[i] - 0x40,
sizeof(T_Components));
}
int CPC_check_AMSDOS(FILE * file, word * loading_address, unsigned long * file_length)
{
int i;

View File

@ -73,6 +73,13 @@ void ZX_Spectrum_set_palette(T_Components * palette);
*/
void CPC_set_HW_palette(T_Components * palette);
/**
* Set 16 color default Amstrad CPC BASIC palette
*
* @note INK 14 and 15 are blinking on the real hardware.
*/
void CPC_set_default_BASIC_palette(T_Components * palette);
/**
* Check AMSDOS header
*