rafattouqir / xee

Automatically exported from code.google.com/p/xee
0 stars 0 forks source link

Support for MSX image formats #310

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The MSX home-computer used some standarized graphic file formats:

1) MSX-BASIC Graphic format.
- Extensions: GRP, SCx (x = screen mode used: SC2,SC5,SC6,SC7,SC8,SCC)
- Palette data included on the file for screens 5-7, optional on SC2.
- Simple header:
   ID Byte: FEh
   Word: START. Address on VRAM to start loading
   Word: SIZE. Picture size in bytes
   Word: 0000h
   <raw data on the respective SCREEN format, as described by the V9938 & V9958 datasheets)>

2) Graph-Saurus format:
- Extensions: SR5, SR7, SR8, SRS. External palette set with extension PLx. SRS 
& PLS = screen-12
- May be raw or compressed. Raw format is identical to the MSX-Basic format, 
but the palette isn't included on the file. The compressed file needs some 
reverse engineering, but it's said to be a simple runlenght encoding.

3) G9B format:

The specs for this format and sample files can be found here:
http://www.teambomba.net/gfx9klib.html

If this request gets approved, I'll select and attach some (1) and (2) sample 
files.

Original issue reported on code.google.com by schmid...@gmail.com on 4 Oct 2012 at 2:25

GoogleCodeExporter commented 9 years ago
I'll have to see, once I get through all the other work.

Original comment by paracel...@gmail.com on 4 Oct 2012 at 8:30

GoogleCodeExporter commented 9 years ago
Here it is, a set of MSX images for testing.

Original comment by schmid...@gmail.com on 6 Oct 2012 at 11:40

Attachments:

GoogleCodeExporter commented 9 years ago
Here's some more info on the MSX graphic formats. I hope this helps you to 
implement the viewer.

1) Technical info

http://nocash.emubase.de/portar.htm#videomodesscreens

http://www.msx-plaza.eu/home.php?page=mccm/mccm72/schermen_eng

The palette for the SC2/GRP images is fixed and is available here:
http://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes#Original_M
SX

2) /bin/file magic IDs:

# MSX raw VRAM dump
0       ubyte           0xFE
>1      uleshort                0
>>5     uleshort                0
>>>3    uleshort                0x37FF          MSX SC2/GRP raw image
>>>3    uleshort                0x6A00          MSX Graph Saurus SR5 raw image
>>>3    uleshort                >0x769E
>>>>3   uleshort                <0x8000         MSX GE5/GE6 raw image
>>>>>3  uleshort                0x7FFF          \b, with sprite patterns
>>>3    uleshort                0xD3FF          MSX screen 7-12 raw image
>>>3    uleshort                0xD400          MSX Graph Saurus SR7/SR8/SRS 
raw image

# Graph Saurus compressed images
0       ubyte           0xFD
>1      uleshort                0
>>5     uleshort                0
>>>3    uleshort                >0x013D         MSX Graph Saurus compressed 
image

# MSX G9B image file
0       string          G9B
>3      uleshort        >10
>>5     ubyte           >0              MSX G9B image, depth=%d
>>>8    uleshort        x               \b, %dx
>>>10   uleshort        x               \b%d
>>>5    ubyte           <9
>>>>6   ubyte           0
>>>>>7  ubyte           x               \b, codec=%d RGB color palettes
>>>>6   ubyte           64              \b, codec=RGB fixed color
>>>>6   ubyte           128             \b, codec=YJK
>>>>6   ubyte           192             \b, codec=YUV
>>>5    ubyte           >8              codec=RGB fixed color
>>>12   ubyte           0               \b, raw
>>>12   ubyte           1               \b, bitbuster compression

Original comment by schmid...@gmail.com on 2 Dec 2012 at 5:43

GoogleCodeExporter commented 9 years ago
I forgot to mention: the extension .SCA is used for the MSX2+ screen-10 images.

Original comment by schmid...@gmail.com on 11 Mar 2013 at 3:40

GoogleCodeExporter commented 9 years ago
FYI I figured out the compressed Graph Saurus .SR8 format; it's indeed a simple 
RLE scheme compressed 8-bit indexed image. Image data always starts at offset 7 
and consists of the following byte sequences:

0x00       XX YY  repeat byte YY for XX times (XX=0 means 256 times)
0x01..0x0F XX     repeat byte YY 1 to 16 times
0x10..0xFF        output single byte literally

Indices refer to standard MSX screen 8 palette (0bRRRGGGBB). I haven't looked 
at the other SRx formats but I suspect they are similar.

Original comment by laa...@gmail.com on 12 Aug 2013 at 9:10

GoogleCodeExporter commented 9 years ago
Thanks for your effort and support!  I'll report this finding on the MSX 
community forums.

Original comment by schmid...@gmail.com on 12 Aug 2013 at 10:02

GoogleCodeExporter commented 9 years ago
Some more sample images, including screen-10 (mixed YJK + RGB color system), 
and screen-2 (with and without sprites).

Original comment by schmid...@gmail.com on 6 Oct 2013 at 7:28

Attachments:

GoogleCodeExporter commented 9 years ago
Tip: If present, the palette on a SC2 file will be at the address 1B87h. 
Otherwise this area should contain only zeroes, and the TMS9918 hardcoded 
colors should be used.

Original comment by schmid...@gmail.com on 12 Oct 2013 at 10:08