#------------------------------------------------------------------------------
# msx: file(1) magic for the MSX Home Computer
-# Fábio R. Schmidlin <frs@pop.com.br>
-
-
+# v1.1
+# Fábio R. Schmidlin <sd-snatcher@users.sourceforge.net>
############## MSX Music file formats ##############
-
# Gigamix MGSDRV music file
-0 string MGS MSX Gigamix MGSDRV music file,
->3 byte x \bv%c
->4 byte x \b.%c
->5 byte x \b%c
->8 string >\0 \b, title: %s
+0 string MGS MSX Gigamix MGSDRV3 music file,
+>6 ubeshort 0x0D0A
+>>3 byte x \bv%c
+>>4 byte x \b.%c
+>>5 byte x \b%c
+>>8 string >\0 \b, title: %s
+
+1 string mgs2\ MSX Gigamix MGSDRV2 music file
+>6 uleshort 0x80
+>>0x2E uleshort 0
+>>>0x30 string >\0 \b, title: %s
# KSS music file
0 string KSCC KSS music file v1.03
->0xF byte&0x02 0 \b, soundchips: AY-3-8910, SCC(+)
->0xF byte&0x02 2 \b, soundchip(s): SN76489
->>0xF byte&0x04 4 stereo
->0xF byte&0x01 1 \b, YM2413
->0xF byte&0x08 8 \b, Y8950
+>0xE byte 0
+>>0xF byte&0x02 0 \b, soundchips: AY-3-8910, SCC(+)
+>>0xF byte&0x02 2 \b, soundchip(s): SN76489
+>>>0xF byte&0x04 4 stereo
+>>0xF byte&0x01 1 \b, YM2413
+>>0xF byte&0x08 8 \b, Y8950
0 string KSSX KSS music file v1.20
->0xF byte&0x40 0x00 \b, 60Hz
->0xF byte&0x40 0x40 \b, 50Hz
->0xF byte&0x02 0 \b, soundchips: AY-3-8910, SCC(+)
->0xF byte&0x02 0x02 \b, soundchips: SN76489
->>0xF byte&0x04 0x04 stereo
->0xF byte&0x01 0x01 \b,
->>0xF byte&0x18 0x00 \bYM2413
->>0xF byte&0x18 0x08 \bYM2413, Y8950
->>0xF byte&0x18 0x18 \bYM2413+Y8950 pseudostereo
->0xF byte&0x18 0x10 \b, Majyutsushi DAC
+>0xE byte&0xEF 0
+>>0xF byte&0x40 0x00 \b, 60Hz
+>>0xF byte&0x40 0x40 \b, 50Hz
+>>0xF byte&0x02 0 \b, soundchips: AY-3-8910, SCC(+)
+>>0xF byte&0x02 0x02 \b, soundchips: SN76489
+>>>0xF byte&0x04 0x04 stereo
+>>0xF byte&0x01 0x01 \b,
+>>>0xF byte&0x18 0x00 \bYM2413
+>>>0xF byte&0x18 0x08 \bYM2413, Y8950
+>>>0xF byte&0x18 0x18 \bYM2413+Y8950 pseudostereo
+>>0xF byte&0x18 0x10 \b, Majyutsushi DAC
# Moonblaster for Moonsound
-0 string MBMS MSX Moonblaster for MoonSound music
+0 string MBMS
+>4 byte 0x10 MSX Moonblaster for MoonSound music
# Music Player K-kaz
0 string MPK MSX Music Player K-kaz song
->3 byte x v%c
->4 byte x \b.%c
->5 byte x \b%c
+>6 ubeshort 0x0D0A
+>>3 byte x v%c
+>>4 byte x \b.%c
+>>5 byte x \b%c
# I don't know why these don't work
#0 search/0xFFFF \r\n.FM9
#>0 search/0xFFFF \r\nPSG1\=
#>>0 search/0xFFFF \r\nSCC1\= MSX MuSiCa MML source file
-
# OPX Music file
-0x7B beshort 0x0d0a
->0x7D byte 0x1a MSX OPX Music file
->>0x86 byte 0 v1.5
->>0x86 byte 1 v2.4
->>0 string >\32 \b, title: %s
+0x35 beshort 0x0d0a
+>0x7B beshort 0x0d0a
+>>0x7D byte 0x1a
+>>>0x87 uleshort 0 MSX OPX Music file
+>>>>0x86 byte 0 v1.5
+>>>>>0 string >\32 \b, title: %s
+>>>>0x86 byte 1 v2.4
+>>>>>0 string >\32 \b, title: %s
# SCMD music file
-0x8B string SCMD MSX SCMD Music file
->0x8F string >\0 \b, title: %s
+0x8B string SCMD
+>0xCE uleshort 0 MSX SCMD Music file
+#>>-2 uleshort 0x6a71 ; The file must end with this value. How to code this here?
+>>0x8F string >\0 \b, title: %s
0 search/0xFFFF \r\n@title
>&0 search/0xFFFF \r\n@m=[ MSX SCMD source MML file
# 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
+>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
+>1 uleshort 0
+>>5 uleshort 0
+>>>3 uleshort >0x013D MSX Graph Saurus compressed image
# Maki-chan Graphic format
0 string MAKI02\ \ Maki-chan image,
>>&3 ubyte&0x04 0 analog
>>&3 ubyte&0x01 1 \b, 2:1 dot aspect ratio
-
# Japanese PIC file
-0 string PIC\x1A Japanese PIC image file
+0 string PIC\x1A
+>4 lelong 0 Japanese PIC image file
# 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
-
-
+>1 uleshort 11
+>>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
############## Other MSX file formats ##############
>3 uleshort 0x000A
>>1 uleshort >0x8000 MSX-BASIC program
+# MSX .CAS file
+0 string \x1F\xA6\xDE\xBA\xCC\x13\x7D\x74 MSX cassette archive
+
# Mega-Assembler file
0 byte 0xFE
>1 uleshort 0x0001
>0x12 ubyte&0xF x \b.%d
>0x13 ubyte x \b, contains %d patches
-
+# Konami's King's Valley-2 custom stage (ELG file)
+4 uleshort 0x0900
+>0xF byte 1
+>>0x14 byte 0
+>>>0x1E string \ \ \
+>>>>0x23 byte 1
+>>>>>0x25 byte 0
+>>>>>>0x15 string >\x30
+>>>>>>>0x15 string <\x5A Konami King's Valley-2 custom stage, title: "%-8.8s"
+>>>>>>>>0x1D byte <32 \b, theme: %d
+
+# Metal Gear 1 savegame
+#0x4F string \x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
+#>>0x60 string \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
+#>>>0x7B string \0x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00 Metal Gear 1 savegame