GrafX2 2.9.3227
The ultimate 256-color painting program

MODE2 : 256x192 Support for the MSX pictures. More...

+ Collaboration diagram for MSX picture formats:

Functions

static int Check_MSX_BSAVE_format (FILE *file, word *begin, word *end, word *exec)
 Check if the file is in the MSX BSAVE format. More...
 
void Test_MSX (T_IO_Context *context, FILE *file)
 
void Load_MSX (T_IO_Context *context)
 Load a MSX Screen 2 picture. More...
 
void Save_MSX (T_IO_Context *context)
 Save MSX .SC2 file. More...
 

Detailed Description

MODE2 : 256x192 Support for the MSX pictures.

Function Documentation

◆ Check_MSX_BSAVE_format()

static int Check_MSX_BSAVE_format ( FILE *  file,
word begin,
word end,
word exec 
)
static

Check if the file is in the MSX BSAVE format.

Reads 7 bytes.

Parameters
file
beginload address
endend address
execexecution address for BLOAD ,R
Returns
0 if the file is not in BSAVE format

References NULL, Read_byte(), and Read_word_le().

Referenced by Load_MSX(), and Test_MSX().

◆ Test_MSX()

void Test_MSX ( T_IO_Context context,
FILE *  file 
)

◆ Load_MSX()

void Load_MSX ( T_IO_Context context)

Load a MSX Screen 2 picture.

TMS9918 Mode II VRAM layout :

  • 0000-17FF : Pattern table
  • 1800-1AFF : Name table
  • 1B00-1B7F : Sprite attributes
  • 1B80-1FFF : UNUSED (1B80-1BAF = Palette)
  • 2000-37FF : Color table
  • 3800-3FFF : Sprite patterns

References Check_MSX_BSAVE_format(), T_Config::Clear_palette, Config, File_error, File_length_file(), FORMAT_MSX, GFX2_DEBUG, GFX2_Log(), MSX_set_palette(), Open_file_read(), T_IO_Context::Palette, PIXEL_SIMPLE, Pre_load(), Read_bytes(), Set_loading_layer(), Set_pixel(), and T_IO_Context::Transparent_color.

◆ Save_MSX()

void Save_MSX ( T_IO_Context context)

Save MSX .SC2 file.

Uses the BSAVE/BLOAD file format. equivalent to BSAVE "FILE.SC2",&H0,&H37FF,S

The MSX pictures are 256x192 pixels with a 15 colors fixed palette. Color #0 is transparent.

See also
https://www.msx.org/wiki/BSAVE
https://lospec.com/palette-list/msx
Todo:
save sprites

References File_error, Get_pixel(), GFX2_Log(), GFX2_WARNING, NULL, Open_file_write(), Write_byte(), Write_bytes(), and Write_word_le().