Introduction
A .mag file is a Maki-chan Graphics picture. The decoder RECOIL lists the
format for the MSX2, the NEC PC-80, PC-88, PC-88 VA and PC-98, and the Sharp
X68000.
Structure
The file starts with the 8-byte signature MAKI02 followed by two spaces,
then four characters naming a computer or program and a comment in Shift-JIS that ends
with the byte $1A. The first zero byte after it begins the header, and offsets count from
there. Numbers are little-endian.
| Offset | Bytes | Field |
|---|---|---|
| 0 | 1 | zero |
| 1 | 1 | computer model code |
| 2 | 1 | flags that depend on the model |
| 3 | 1 | screen mode |
| 4 | 8 | left, top, right and bottom edge, two bytes each, right and bottom inclusive |
| 12 | 4 | offset of the first flag stream, A |
| 16 | 4 | offset of the second flag stream, B |
| 20 | 4 | size of flag stream B |
| 24 | 4 | offset of the pixel stream |
| 28 | 4 | size of the pixel stream |
| 32 | up to 768 | palette of up to 256 colours, each stored as green, red, blue |
The picture has 16 colours, or 256 when the top bit of the screen mode is set. It is compressed in units of 16-bit words. The bits of stream A say when to take the next four-bit value from stream B, which is combined by exclusive OR with a row of stored action codes carried over from earlier lines. An action of 0 takes a new word from the pixel stream; actions 1 to 15 copy a word already decoded, from a few words to the left or from up to 16 lines above.
Not described
Known, not yet covered
- Reference: the table of copy positions, the model codes and screen modes, the scaling of palette values and the YJK colour modes of the MSX2+ are not yet described.
- Viewer: the site has no viewer for MAG pictures.
Links
Software
Reference
- MAKIchan graphics formats – description of the MAG header, streams and decompression