GrafX2 2.9.3227
The ultimate 256-color painting program
Amstrad CPC

Functions

unsigned char * raw2crtc (T_IO_Context *context, unsigned char mode, unsigned char r9, unsigned long *outSize, unsigned char *r1, unsigned char r12, unsigned char r13)
 
void CPC_set_HW_palette (T_Components *palette)
 Set 32 color HW Amstrad CPC palette. More...
 
int CPC_is_CPC_old_color (T_Components *col)
 Check if the color is likely to be a CPC RGB tri level color. More...
 
void CPC_set_default_BASIC_palette (T_Components *palette)
 Set 16 color default Amstrad CPC BASIC palette. More...
 
int CPC_compare_colors (T_Components *col1, T_Components *col2)
 compare two RGB colors More...
 
byte CPC_Firmware_to_Hardware_color (byte fw_color)
 Convert CPC firmware color to hardware color (Gate Array) More...
 
int CPC_check_AMSDOS (FILE *file, word *loading_address, word *exec_address, unsigned long *file_length)
 Check AMSDOS header. More...
 
int CPC_write_AMSDOS_header (FILE *file, const char *filename, const char *ext, byte type, word load_address, word save_address, word file_length)
 Write AMSDOS header. More...
 

Detailed Description

Function Documentation

◆ raw2crtc()

unsigned char * raw2crtc ( T_IO_Context context,
unsigned char  mode,
unsigned char  r9,
unsigned long *  outSize,
unsigned char *  r1,
unsigned char  r12,
unsigned char  r13 
)

◆ CPC_set_HW_palette()

void CPC_set_HW_palette ( T_Components palette)

Set 32 color HW Amstrad CPC palette.

The palette is in fact 27 colors, with some duplicates. http://www.cpcwiki.eu/index.php/CPC_Palette

References CPC_Hw_Palette.

Referenced by Button_Constraint_menu(), Load_CM5(), Load_GOS(), Load_SCR(), and Save_SCR().

◆ CPC_is_CPC_old_color()

int CPC_is_CPC_old_color ( T_Components col)

Check if the color is likely to be a CPC RGB tri level color.

References T_Components::B, T_Components::G, and T_Components::R.

Referenced by Save_SCR().

◆ CPC_set_default_BASIC_palette()

void CPC_set_default_BASIC_palette ( T_Components palette)

Set 16 color default Amstrad CPC BASIC palette.

Note
INK 14 and 15 are blinking on the real hardware.

in the default CPC Basic palette, INKs 14 and 15 are blinking, so that would be great to include theses in the colorcycling, but I don't see any way to make these blinking colors with the way GrafX2 handles color cycling

References CPC_Hw_Palette.

Referenced by Button_Constraint_menu().

◆ CPC_compare_colors()

int CPC_compare_colors ( T_Components col1,
T_Components col2 
)

compare two RGB colors

The RGB colors are compared in order as if they were converted from CPC (27 color palette), as there are several mapping of the 3 level CPC RGB signals.

Returns
true if the RGB colors map to the same CPC color

The mapping used in this function is :

  • RGB value [0: 85] => CPC level 0
  • RGB value [86:171] => CPC level 1
  • RGB value [172:255] => CPC level 2

References T_Components::B, T_Components::G, and T_Components::R.

Referenced by Save_SCR(), and Test_CPC_compare_colors().

◆ CPC_Firmware_to_Hardware_color()

byte CPC_Firmware_to_Hardware_color ( byte  fw_color)

Convert CPC firmware color to hardware color (Gate Array)

Parameters
fw_colora CPC Firmware color index (from 0 to 26)
Returns
a CPC Hardware color (from 0x40 to 0x5f)

References CPC_Firmware_Colors.

Referenced by Load_SCR().

◆ CPC_check_AMSDOS()

int CPC_check_AMSDOS ( FILE *  file,
word loading_address,
word exec_address,
unsigned long *  file_length 
)

Check AMSDOS header.

see http://www.cpcwiki.eu/index.php/AMSDOS_Header

Parameters
[in]filean open file
[out]loading_addressthe loading address from the header
[out]exec_addressthe execution address from the header
[out]file_lengththe file length written in the header
Returns
0 if the file does not contain a valid AMSDOS header
1 if it does.

References GFX2_DEBUG, GFX2_INFO, GFX2_Log(), and Read_bytes().

Referenced by Load_CM5(), Load_GOS(), Load_SCR(), Test_CM5(), Test_GOS(), and Test_SCR().

◆ CPC_write_AMSDOS_header()

int CPC_write_AMSDOS_header ( FILE *  file,
const char *  filename,
const char *  ext,
byte  type,
word  load_address,
word  save_address,
word  file_length 
)

Write AMSDOS header.

References GFX2_DEBUG, GFX2_LogHexDump(), and Write_bytes().

Referenced by Save_SCR().