1
2#------------------------------------------------------------------------------
3# msx:  file(1) magic for the MSX Home Computer
4# v1.3
5# Fabio R. Schmidlin <sd-snatcher@users.sourceforge.net>
6
7############## MSX Music file formats ##############
8
9# Gigamix MGSDRV music file
100         string/b            MGS       MSX Gigamix MGSDRV3 music file,
11>6        ubeshort  0x0D0A
12>>3       byte                x         \bv%c
13>>4       byte                x         \b.%c
14>>5       byte                x         \b%c
15>>8       string              >\0       \b, title: %s
16
171         string/b            mgs2\     MSX Gigamix MGSDRV2 music file
18>6        uleshort  0x80
19>>0x2E    uleshort  0
20>>>0x30   string              >\0       \b, title: %s
21
22# KSS music file
230         string/b            KSCC      KSS music file v1.03
24>0xE      byte                0
25>>0xF     byte&0x02 0         \b, soundchips: AY-3-8910, SCC(+)
26>>0xF     byte&0x02 2         \b, soundchip(s): SN76489
27>>>0xF    byte&0x04 4         stereo
28>>0xF     byte&0x01 1         \b, YM2413
29>>0xF     byte&0x08 8         \b, Y8950
30
310         string/b            KSSX      KSS music file v1.20
32>0xE      byte&0xEF 0
33>>0xF     byte&0x40 0x00      \b, 60Hz
34>>0xF     byte&0x40 0x40      \b, 50Hz
35>>0xF     byte&0x02 0         \b, soundchips: AY-3-8910, SCC(+)
36>>0xF     byte&0x02 0x02      \b, soundchips: SN76489
37>>>0xF    byte&0x04 0x04      stereo
38>>0xF     byte&0x01 0x01      \b,
39>>>0xF    byte&0x18 0x00      \bYM2413
40>>>0xF    byte&0x18 0x08      \bYM2413, Y8950
41>>>0xF    byte&0x18 0x18      \bYM2413+Y8950 pseudostereo
42>>0xF     byte&0x18 0x10      \b, Majyutsushi DAC
43
44# Moonblaster for Moonsound
450         string/b            MBMS
46>4        byte                0x10      MSX Moonblaster for MoonSound music
47
48# Music Player K-kaz
490         string/b            MPK       MSX Music Player K-kaz song
50>6        ubeshort  0x0D0A
51>>3       byte                x         v%c
52>>4       byte                x         \b.%c
53>>5       byte                x         \b%c
54
55# I don't know why these don't work
56#0        search/0xFFFF       \r\n.FM9
57#>0       search/0xFFFF       \r\n#FORMAT         MSX Music Player K-kaz source MML file
58#0        search/0xFFFF       \r\nFM1\ \=
59#>0       search/0xFFFF       \r\nPSG1\=
60#>>0      search/0xFFFF       \r\nSCC1\=                    MSX MuSiCa MML source file
61
62# OPX Music file
630x35      beshort             0x0d0a
64>0x7B     beshort             0x0d0a
65>>0x7D    byte                0x1a
66>>>0x87   uleshort  0                   MSX OPX Music file
67>>>>0x86  byte                0                   v1.5
68>>>>>0    string              >\32                \b, title: %s
69>>>>0x86  byte                1                   v2.4
70>>>>>0    string              >\32                \b, title: %s
71
72# SCMD music file
730x8B      string/b            SCMD
74>0xCE     uleshort  0         MSX SCMD Music file
75#>>-2     uleshort  0x6a71    ; The file must end with this value. How to code this here?
76>>0x8F    string              >\0                 \b, title: %s
77
780         search/0xFFFF       \r\n@title
79>&0       search/0xFFFF       \r\n@m=[  MSX SCMD source MML file
80
81
82############## MSX image file formats ##############
83
84# MSX raw VRAM dump
850         ubyte               0xFE
86>1        uleshort  0
87>>5       uleshort  0
88>>>3      uleshort  0x37FF              MSX SC2/GRP raw image
89>>>3      uleshort  0x6A00              MSX Graph Saurus SR5 raw image
90>>>3      uleshort  >0x769E
91>>>>3     uleshort  <0x8000             MSX GE5/GE6 raw image
92>>>>>3    uleshort  0x7FFF              \b, with sprite patterns
93>>>3      uleshort  0xD3FF              MSX screen 7-12 raw image
94>>>3      uleshort  0xD400              MSX Graph Saurus SR7/SR8/SRS raw image
95
96# Graph Saurus compressed images
970         ubyte               0xFD
98>1        uleshort  0
99>>5       uleshort  0
100>>>3      uleshort  >0x013D             MSX Graph Saurus compressed image
101
102# MSX G9B image file
1030         string/b            G9B
104>1        uleshort  11
105>>3       uleshort  >10
106>>>5      ubyte               >0                  MSX G9B image, depth=%d
107>>>>8     uleshort  x                   \b, %dx
108>>>>10    uleshort  x                   \b%d
109>>>>5     ubyte               <9
110>>>>>6    ubyte               0
111>>>>>>7   ubyte               x                   \b, codec=%d RGB color palettes
112>>>>>6    ubyte               64                  \b, codec=RGB fixed color
113>>>>>6    ubyte               128                 \b, codec=YJK
114>>>>>6    ubyte               192                 \b, codec=YUV
115>>>>5     ubyte               >8                  codec=RGB fixed color
116>>>>12    ubyte               0                   \b, raw
117>>>>12    ubyte               1                   \b, bitbuster compression
118
119############## Other MSX file formats ##############
120
121# MSX internal ROMs
1220                   ubeshort  0xF3C3
123>2                  uleshort  <0x4000
124>>8                 ubyte               0xC3
125>>>9                uleshort  <0x4000
126>>>>0x0B  ubeshort  0x00C3
127>>>>>0x0D uleshort  <0x4000
128>>>>>>0x0F          ubeshort  0x00C3
129>>>>>>>0x11         uleshort  <0x4000
130>>>>>>>>0x13        ubeshort  0x00C3
131>>>>>>>>>0x15       uleshort  <0x4000
132>>>>>>>>>>0x50      ubyte               0xC3
133>>>>>>>>>>>0x51     uleshort  <0x4000
134>>>>>>>>>>>>(9.s)   ubyte     0xC3
135>>>>>>>>>>>>>&0     uleshort  >0x4000
136>>>>>>>>>>>>>>&0    ubyte     0xC3                MSX BIOS+BASIC
137>>>>>>>>>>>>>>>0x002D         ubyte+1   <3                  \b. version=MSX%d
138>>>>>>>>>>>>>>>0x002D         ubyte     2                   \b, version=MSX2+
139>>>>>>>>>>>>>>>0x002D         ubyte     3                   \b, version=MSX Turbo-R
140>>>>>>>>>>>>>>>0x002D         ubyte     >3                  \b, version=Unknown MSX %d version
141>>>>>>>>>>>>>>>0x0006         ubyte     x                   \b, VDP.DR=%#2x
142>>>>>>>>>>>>>>>0x0007         ubyte     x                   \b, VDP.DW=%#2x
143>>>>>>>>>>>>>>>0x002B         ubyte&0xF 0                   \b, charset=Japanese
144>>>>>>>>>>>>>>>0x002B         ubyte&0xF 1                   \b, charset=International
145>>>>>>>>>>>>>>>0x002B         ubyte&0xF 2                   \b, charset=Korean
146>>>>>>>>>>>>>>>0x002B         ubyte&0xF >2                  \b, charset=Unknown id:%d
147>>>>>>>>>>>>>>>0x002B         ubyte&0x70          0x00                \b, date format=Y-M-D
148>>>>>>>>>>>>>>>0x002B         ubyte&0x70          0x10                \b, date format=M-D-Y
149>>>>>>>>>>>>>>>0x002B         ubyte&0x70          0x20                \b, date format=D-M-Y
150>>>>>>>>>>>>>>>0x002B         ubyte&0x80          0x00                \b, vfreq=60Hz
151>>>>>>>>>>>>>>>0x002B         ubyte&0x80          0x80                \b, vfreq=50Hz
152>>>>>>>>>>>>>>>0x002C         ubyte&0x0F          0                   \b, keyboard=Japanese
153>>>>>>>>>>>>>>>0x002C         ubyte&0x0F          1                   \b, keyboard=International
154>>>>>>>>>>>>>>>0x002C         ubyte&0x0F          2                   \b, keyboard=French
155>>>>>>>>>>>>>>>0x002C         ubyte&0x0F          3                   \b, keyboard=UK
156>>>>>>>>>>>>>>>0x002C         ubyte&0x0F          4                   \b, keyboard=German
157>>>>>>>>>>>>>>>0x002C         ubyte&0x0F          5                   \b, keyboard=Unknown id:%d
158>>>>>>>>>>>>>>>0x002C         ubyte&0x0F          6                   \b, keyboard=Spanish
159>>>>>>>>>>>>>>>0x002C         ubyte&0x0F          >6                  \b, keyboard=Unknown id:%d
160>>>>>>>>>>>>>>>0x002C         ubyte&0xF0          0x00                \b, basic=Japanese
161>>>>>>>>>>>>>>>0x002C         ubyte&0xF0          0x10                \b, basic=International
162>>>>>>>>>>>>>>>0x002C         ubyte&0xF0          >0x10               \b, basic=Unknown id:%d
163>>>>>>>>>>>>>>>0x002E         ubyte&1             1                   \b, built-in MIDI
164
165
1660                   string/b            CD
167>2                  uleshort  >0x10
168>>2                 uleshort  <0x4000
169>>>4                uleshort  <0x4000
170>>>>6               uleshort  <0x4000
171>>>>>8              ubyte               0xC3
172>>>>>>9             uleshort  <0x4000
173>>>>>>>0x10         ubyte               0xC3
174>>>>>>>>0x11        uleshort  <0x4000
175>>>>>>>>>0x14       ubyte               0xC3
176>>>>>>>>>>0x15      uleshort  <0x4000             MSX2/2+/TR SubROM
177
1780                   string              \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
179>0x5F0              ubequad             0x8282828244380000
180>>0x150             ubyte               0x38
181>>>0x170  string              \20\20\20
182>>>>0x1E32          string              ())
183>>>>>0x2130         ubequad             0xA5A5594924231807
184>>>>>0x2138         ubequad             0x4A4A3424488830C0  MSX Kanji Font
185
186
187
188# MSX extension ROMs
1890         string/b            AB
190>2        uleshort  0x0010                        MSX ROM
191>>2       uleshort  x                             \b, init=%#4x
192>>4       uleshort  >0                            \b, stahdl=%#4x
193>>6       uleshort  >0                            \b, devhdl=%#4x
194>>8       uleshort  >0                            \b, bas=%#4x
195>2        uleshort  0x4010                        MSX ROM
196>>2       uleshort  x                             \b, init=%#04x
197>>4       uleshort  >0                            \b, stahdl=%#04x
198>>6       uleshort  >0                            \b, devhdl=%#04x
199>>8       uleshort  >0                            \b, bas=%#04x
200>2        uleshort  0x8010                        MSX ROM
201>>2       uleshort  x                             \b, init=%#04x
202>>4       uleshort  >0                            \b, stahdl=%#04x
203>>6       uleshort  >0                            \b, devhdl=%#04x
204>>8       uleshort  >0                            \b, bas=%#04x
2050         string/b            AB\0\0
206>6        uleshort  0
207>>4       uleshort  >0x400F                       MSX-BASIC extension ROM
208>>>4      uleshort  >0                            \b, stahdl=%#04x
209>>>6      uleshort  >0                            \b, devhdl=%#04x
210>>>0x1C             string              OPLL                          \b, MSX-Music
211>>>>0x18  string              PAC2                          \b (external)
212>>>>0x18  string              APRL                          \b (internal)
213
2140         string/b            AB\0\0\0\0
215>6        uleshort  >0x400F                       MSX device BIOS
216>>6       uleshort  >0                            \b, devhdl=%#04x
217
218
2190         string/b            AB
220#>2       string              5JSuperLAYDOCK                MSX Super Laydock ROM
221#>3       string              @HYDLIDE3MSX                  MSX Hydlide-3 ROM
222#>3       string              @3\x80IA862                   Golvellius MSX1 ROM
223>2        uleshort  >15
224>>2       uleshort  <0xC000
225>>>8      string              \0\0\0\0\0\0\0\0
226>>>>(2.s&0x3FFF)    uleshort  >0                  MSX ROM
227>>>>>0x10 string              YZ\0\0\0\0                    Konami Game Master 2 MSX ROM
228>>>>>0x10 string              CD                            \b, Konami RC-
229>>>>>>0x12          ubyte               x                             \b%d
230>>>>>>0x13          ubyte/16  x                             \b%d
231>>>>>>0x13          ubyte&0xF x                             \b%d
232>>>>>0x10 string              EF                            \b, Konami RC-
233>>>>>>0x12          ubyte               x                             \b%d
234>>>>>>0x13          ubyte/16  x                             \b%d
235>>>>>>0x13          ubyte&0xF x                             \b%d
236>>>>>2    uleshort  x                             \b, init=%#04x
237>>>>>4    uleshort  >0                            \b, stahdl=%#04x
238>>>>>6    uleshort  >0                            \b, devhdl=%#04x
239>>>>>8    uleshort  >0                            \b, bas=%#04x
240>>>2      uleshort  0
241>>>>4     uleshort  0
242>>>>>6    uleshort  0
243>>>>>>8   uleshort  >0                            MSX BASIC program in ROM, bas=%#04x
244
2450x4000    string/b            AB
246>0x4002   uleshort  >0x400F
247>>0x400A  string              \0\0\0\0\0\0        MSX ROM with nonstandard page order
248>>>0x4002 uleshort  x                             \b, init=%#04x
249>>>0x4004 uleshort  >0                            \b, stahdl=%#04x
250>>>0x4006 uleshort  >0                            \b, devhdl=%#04x
251>>>0x4008 uleshort  >0                            \b, bas=%#04x
252
2530x8000    string/b            AB
254>0x8002   uleshort  >0x400F
255>>0x800A  string              \0\0\0\0\0\0        MSX ROM with nonstandard page order
256>>>0x8002 uleshort  x                             \b, init=%#04x
257>>>0x8004 uleshort  >0                            \b, stahdl=%#04x
258>>>0x8006 uleshort  >0                            \b, devhdl=%#04x
259>>>0x8008 uleshort  >0                            \b, bas=%#04x
260
261
2620x3C000   string/b            AB
263>0x3C008  string              \0\0\0\0\0\0\0\0    MSX MegaROM with nonstandard page order
264>>0x3C002 uleshort  x                             \b, init=%#04x
265>>0x3C004 uleshort  >0                            \b, stahdl=%#04x
266>>0x3C006 uleshort  >0                            \b, devhdl=%#04x
267>>0x3C008 uleshort  >0                            \b, bas=%#04x
268
269# MSX BIN file
270#0        byte                0xFE
271#>1       uleshort  >0x8000
272#>>3      uleshort  >0x8004
273#>>>5     uleshort  >0x8000                       MSX BIN file
274
275# MSX-BASIC file
2760         byte                0xFF
277>3        uleshort  0x000A
278>>1       uleshort  >0x8000                       MSX-BASIC program
279
280# MSX .CAS file
2810         string/b  \x1F\xA6\xDE\xBA\xCC\x13\x7D\x74        MSX cassette archive
282
283# Mega-Assembler file
2840         byte                0xFE
285>1        uleshort  0x0001
286>>5       uleshort  0xffff
287>>>6      byte                0x0A                MSX Mega-Assembler source
288
289# Execrom Patchfile
2900         string              ExecROM\ patchfile\x1A        MSX ExecROM patchfile
291>0x12     ubyte/16  x                   v%d
292>0x12     ubyte&0xF x                   \b.%d
293>0x13     ubyte               x                   \b, contains %d patches
294
295# Konami's King's Valley-2 custom stage (ELG file)
2964         uleshort  0x0900
297>0xF      byte                1
298>>0x14    byte                0
299>>>0x1E   string              \040\040\040
300>>>>0x23  byte      1
301>>>>>0x25 byte      0
302>>>>>>0x15          string    >\x30
303>>>>>>>0x15         string    <\x5A               Konami King's Valley-2 custom stage, title: "%-8.8s"
304>>>>>>>>0x1D        byte      <32       \b, theme: %d
305
306# Metal Gear 1 savegame
307#0x4F     string    \x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
308#>>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
309#>>>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
310