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