1267843Sdelphij
2267843Sdelphij#------------------------------------------------------------------------------
3267843Sdelphij# msx:  file(1) magic for the MSX Home Computer
4267843Sdelphij# v1.1
5267843Sdelphij# Fabio R. Schmidlin <sd-snatcher@users.sourceforge.net>
6267843Sdelphij
7267843Sdelphij############## MSX Music file formats ##############
8267843Sdelphij
9267843Sdelphij# Gigamix MGSDRV music file
10267843Sdelphij0	string		MGS	MSX Gigamix MGSDRV3 music file, 
11267843Sdelphij>6	ubeshort	0x0D0A
12267843Sdelphij>>3	byte		x	\bv%c
13267843Sdelphij>>4	byte		x	\b.%c
14267843Sdelphij>>5	byte		x	\b%c
15267843Sdelphij>>8	string		>\0	\b, title: %s
16267843Sdelphij
17267843Sdelphij1	string		mgs2\ 	MSX Gigamix MGSDRV2 music file
18267843Sdelphij>6	uleshort	0x80
19267843Sdelphij>>0x2E	uleshort	0
20267843Sdelphij>>>0x30	string		>\0	\b, title: %s
21267843Sdelphij
22267843Sdelphij# KSS music file
23267843Sdelphij0	string		KSCC	KSS music file v1.03
24267843Sdelphij>0xE	byte		0
25267843Sdelphij>>0xF	byte&0x02	0	\b, soundchips: AY-3-8910, SCC(+)
26267843Sdelphij>>0xF	byte&0x02	2	\b, soundchip(s): SN76489
27267843Sdelphij>>>0xF	byte&0x04	4	stereo
28267843Sdelphij>>0xF	byte&0x01	1	\b, YM2413
29267843Sdelphij>>0xF	byte&0x08	8	\b, Y8950
30267843Sdelphij
31267843Sdelphij0	string		KSSX	KSS music file v1.20
32267843Sdelphij>0xE	byte&0xEF	0
33267843Sdelphij>>0xF	byte&0x40	0x00	\b, 60Hz
34267843Sdelphij>>0xF	byte&0x40	0x40	\b, 50Hz
35267843Sdelphij>>0xF	byte&0x02	0	\b, soundchips: AY-3-8910, SCC(+)
36267843Sdelphij>>0xF	byte&0x02	0x02	\b, soundchips: SN76489
37267843Sdelphij>>>0xF	byte&0x04	0x04	stereo
38267843Sdelphij>>0xF	byte&0x01	0x01	\b, 
39267843Sdelphij>>>0xF	byte&0x18	0x00	\bYM2413
40267843Sdelphij>>>0xF	byte&0x18	0x08	\bYM2413, Y8950
41267843Sdelphij>>>0xF	byte&0x18	0x18	\bYM2413+Y8950 pseudostereo
42267843Sdelphij>>0xF	byte&0x18	0x10	\b, Majyutsushi DAC
43267843Sdelphij
44267843Sdelphij# Moonblaster for Moonsound
45267843Sdelphij0	string		MBMS
46267843Sdelphij>4	byte		0x10	MSX Moonblaster for MoonSound music
47267843Sdelphij
48267843Sdelphij# Music Player K-kaz
49267843Sdelphij0	string		MPK	MSX Music Player K-kaz song
50267843Sdelphij>6	ubeshort	0x0D0A
51267843Sdelphij>>3	byte		x	v%c
52267843Sdelphij>>4	byte		x	\b.%c
53267843Sdelphij>>5	byte		x	\b%c
54267843Sdelphij
55267843Sdelphij# I don't know why these don't work
56267843Sdelphij#0	search/0xFFFF	\r\n.FM9
57267843Sdelphij#>0	search/0xFFFF	\r\n#FORMAT	MSX Music Player K-kaz source MML file
58267843Sdelphij#0	search/0xFFFF	\r\nFM1\ \=
59267843Sdelphij#>0	search/0xFFFF	\r\nPSG1\=
60267843Sdelphij#>>0	search/0xFFFF	\r\nSCC1\=		MSX MuSiCa MML source file
61267843Sdelphij
62267843Sdelphij# OPX Music file
63267843Sdelphij0x35	beshort		0x0d0a
64267843Sdelphij>0x7B	beshort		0x0d0a
65267843Sdelphij>>0x7D	byte		0x1a
66267843Sdelphij>>>0x87	uleshort	0		MSX OPX Music file
67267843Sdelphij>>>>0x86	byte		0		v1.5
68267843Sdelphij>>>>>0	string		>\32		\b, title: %s
69267843Sdelphij>>>>0x86	byte		1		v2.4
70267843Sdelphij>>>>>0	string		>\32		\b, title: %s
71267843Sdelphij
72267843Sdelphij# SCMD music file
73267843Sdelphij0x8B	string		SCMD
74267843Sdelphij>0xCE	uleshort	0	MSX SCMD Music file
75267843Sdelphij#>>-2	uleshort	0x6a71	; The file must end with this value. How to code this here?
76267843Sdelphij>>0x8F	string		>\0		\b, title: %s
77267843Sdelphij
78267843Sdelphij0	search/0xFFFF	\r\n@title
79267843Sdelphij>&0	search/0xFFFF	\r\n@m=[	MSX SCMD source MML file
80267843Sdelphij
81267843Sdelphij
82267843Sdelphij############## MSX image file formats ##############
83267843Sdelphij
84267843Sdelphij# MSX raw VRAM dump
85267843Sdelphij0	ubyte		0xFE
86267843Sdelphij>1	uleshort	0
87267843Sdelphij>>5	uleshort	0
88267843Sdelphij>>>3	uleshort	0x37FF		MSX SC2/GRP raw image
89267843Sdelphij>>>3	uleshort	0x6A00		MSX Graph Saurus SR5 raw image
90267843Sdelphij>>>3	uleshort	>0x769E
91267843Sdelphij>>>>3	uleshort	<0x8000		MSX GE5/GE6 raw image
92267843Sdelphij>>>>>3	uleshort	0x7FFF		\b, with sprite patterns
93267843Sdelphij>>>3	uleshort	0xD3FF		MSX screen 7-12 raw image
94267843Sdelphij>>>3	uleshort	0xD400		MSX Graph Saurus SR7/SR8/SRS raw image
95267843Sdelphij
96267843Sdelphij# Graph Saurus compressed images
97267843Sdelphij0	ubyte		0xFD
98267843Sdelphij>1	uleshort	0
99267843Sdelphij>>5	uleshort	0
100267843Sdelphij>>>3	uleshort	>0x013D		MSX Graph Saurus compressed image
101267843Sdelphij
102267843Sdelphij# Maki-chan Graphic format
103267843Sdelphij0	string		MAKI02\ \ 	Maki-chan image,
104267843Sdelphij>8	byte		x		system ID: %c
105267843Sdelphij>9	byte		x		\b%c
106267843Sdelphij>10	byte		x		\b%c
107267843Sdelphij>11	byte		x		\b%c,
108267843Sdelphij>13	search/0x200	\x1A
109267843Sdelphij# >>&3	ubyte		0		, video mode: PC-98 400 lines, 16 analog colors
110267843Sdelphij# >>&3	ubyte		1		, video mode: MSX SC7, 16 analog colors
111267843Sdelphij# >>&3	ubyte		2		, video mode: VM-98 400 lines, 8 analog colors
112267843Sdelphij# >>&3	ubyte		3		, video mode: PC-88 analog, 200 lines, 8 analog colors
113267843Sdelphij# >>&3	ubyte		4		, video mode: 400 lines, 16 digital colors
114267843Sdelphij# >>&3	ubyte		5		, video mode: 200 lines, 16 digital colors
115267843Sdelphij# >>&3	ubyte		6		, video mode: old PC-98 digital 400 lines, 8 colors
116267843Sdelphij# >>&3	ubyte		7		, video mode: PC-88 400 lines, 8 digital colors
117267843Sdelphij>>&8	uleshort+1	x		%dx
118267843Sdelphij>>&10	uleshort+1	x		\b%d,
119267843Sdelphij>>&3	ubyte&0x82	0x80		256 colors
120267843Sdelphij>>&3	ubyte&0x82	0x00		16 colors
121267843Sdelphij>>&3	ubyte&0x82	0x01		8 colors
122267843Sdelphij>>&3	ubyte&0x04	4		digital
123267843Sdelphij>>&3	ubyte&0x04	0		analog
124267843Sdelphij>>&3	ubyte&0x01	1		\b, 2:1 dot aspect ratio
125267843Sdelphij
126267843Sdelphij# Japanese PIC file
127267843Sdelphij0	string		PIC\x1A
128267843Sdelphij>4	lelong		0		Japanese PIC image file
129267843Sdelphij
130267843Sdelphij# MSX G9B image file
131267843Sdelphij0	string		G9B
132267843Sdelphij>1	uleshort	11
133267843Sdelphij>>3	uleshort	>10
134267843Sdelphij>>>5	ubyte		>0		MSX G9B image, depth=%d
135267843Sdelphij>>>>8	uleshort	x		\b, %dx
136267843Sdelphij>>>>10	uleshort	x		\b%d
137267843Sdelphij>>>>5	ubyte		<9
138267843Sdelphij>>>>>6	ubyte		0
139267843Sdelphij>>>>>>7	ubyte		x		\b, codec=%d RGB color palettes
140267843Sdelphij>>>>>6	ubyte		64		\b, codec=RGB fixed color
141267843Sdelphij>>>>>6	ubyte		128		\b, codec=YJK
142267843Sdelphij>>>>>6	ubyte		192		\b, codec=YUV
143267843Sdelphij>>>>5	ubyte		>8		codec=RGB fixed color
144267843Sdelphij>>>>12	ubyte		0		\b, raw
145267843Sdelphij>>>>12	ubyte		1		\b, bitbuster compression
146267843Sdelphij
147267843Sdelphij############## Other MSX file formats ##############
148267843Sdelphij
149267843Sdelphij# MSX ROMs
150267843Sdelphij0	string		AB
151267843Sdelphij>2	uleshort	0x0010			MSX ROM
152267843Sdelphij>>2	uleshort	x			\b, init=0x%4x
153267843Sdelphij>>4	uleshort	>0			\b, stat=0x%4x
154267843Sdelphij>>6	uleshort	>0			\b, dev=0x%4x
155267843Sdelphij>>8	uleshort	>0			\b, bas=0x%4x
156267843Sdelphij>2	uleshort	0x4010			MSX ROM
157267843Sdelphij>>2	uleshort	x			\b, init=0x%04x
158267843Sdelphij>>4	uleshort	>0			\b, stat=0x%04x
159267843Sdelphij>>6	uleshort	>0			\b, dev=0x%04x
160267843Sdelphij>>8	uleshort	>0			\b, bas=0x%04x
161267843Sdelphij>2	uleshort	0x8010			MSX ROM
162267843Sdelphij>>2	uleshort	x			\b, init=0x%04x
163267843Sdelphij>>4	uleshort	>0			\b, stat=0x%04x
164267843Sdelphij>>6	uleshort	>0			\b, dev=0x%04x
165267843Sdelphij>>8	uleshort	>0			\b, bas=0x%04x
166267843Sdelphij
167267843Sdelphij0	string		AB
168267843Sdelphij#>2	string		5JSuperLAYDOCK		MSX Super Laydock ROM
169267843Sdelphij#>3	string		@HYDLIDE3MSX		MSX Hydlide-3 ROM
170267843Sdelphij#>3	string		@3\x80IA862		Golvellius MSX1 ROM
171267843Sdelphij>2	uleshort	>10
172267843Sdelphij>>10	string		\0\0\0\0\0\0		MSX ROM
173267843Sdelphij>>>0x10	string		YZ\0\0\0\0		Konami Game Master 2 MSX ROM
174267843Sdelphij>>>0x10	string		CD			\b, Konami RC-
175267843Sdelphij>>>>0x12	ubyte		x			\b%d
176267843Sdelphij>>>>0x13	ubyte/16	x			\b%d
177267843Sdelphij>>>>0x13	ubyte&0xF	x			\b%d
178267843Sdelphij>>>0x10	string		EF			\b, Konami RC-
179267843Sdelphij>>>>0x12	ubyte		x			\b%d
180267843Sdelphij>>>>0x13	ubyte/16	x			\b%d
181267843Sdelphij>>>>0x13	ubyte&0xF	x			\b%d
182267843Sdelphij>>>2	uleshort	x			\b, init=0x%04x
183267843Sdelphij>>>4	uleshort	>0			\b, stat=0x%04x
184267843Sdelphij>>>6	uleshort	>0			\b, dev=0x%04x
185267843Sdelphij>>>8	uleshort	>0			\b, bas=0x%04x
186267843Sdelphij>2	uleshort	0
187267843Sdelphij>>4	uleshort	0
188267843Sdelphij>>>6	uleshort	0
189267843Sdelphij>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=0x%04x
190267843Sdelphij
191267843Sdelphij0x4000	string		AB
192267843Sdelphij>0x4002	uleshort	>0x4010
193267843Sdelphij>>0x400A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
194267843Sdelphij>>0x4002	uleshort	x			\b, init=0x%04x
195267843Sdelphij>>0x4004	uleshort	>0			\b, stat=0x%04x
196267843Sdelphij>>0x4006	uleshort	>0			\b, dev=0x%04x
197267843Sdelphij>>0x4008	uleshort	>0			\b, bas=0x%04x
198267843Sdelphij
199267843Sdelphij0x8000	string		AB
200267843Sdelphij>0x8002	uleshort	>0x4010
201267843Sdelphij>>0x800A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
202267843Sdelphij>>0x8002	uleshort	x			\b, init=0x%04x
203267843Sdelphij>>0x8004	uleshort	>0			\b, stat=0x%04x
204267843Sdelphij>>0x8006	uleshort	>0			\b, dev=0x%04x
205267843Sdelphij>>0x8008	uleshort	>0			\b, bas=0x%04x
206267843Sdelphij
207267843Sdelphij
208267843Sdelphij0x3C000	string		AB
209267843Sdelphij>0x3C008	string		\0\0\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
210267843Sdelphij>>0x3C002	uleshort	x			\b, init=0x%04x
211267843Sdelphij>>0x3C004	uleshort	>0			\b, stat=0x%04x
212267843Sdelphij>>0x3C006	uleshort	>0			\b, dev=0x%04x
213267843Sdelphij>>0x3C008	uleshort	>0			\b, bas=0x%04x
214267843Sdelphij
215267843Sdelphij# MSX BIN file
216267843Sdelphij#0	byte		0xFE
217267843Sdelphij#>1	uleshort	>0x8000
218267843Sdelphij#>>3	uleshort	>0x8004
219267843Sdelphij#>>>5	uleshort	>0x8000			MSX BIN file
220267843Sdelphij
221267843Sdelphij# MSX-BASIC file
222267843Sdelphij0	byte		0xFF
223267843Sdelphij>3	uleshort	0x000A
224267843Sdelphij>>1	uleshort	>0x8000			MSX-BASIC program
225267843Sdelphij
226267843Sdelphij# MSX .CAS file
227267843Sdelphij0	string	\x1F\xA6\xDE\xBA\xCC\x13\x7D\x74	MSX cassette archive
228267843Sdelphij
229267843Sdelphij# Mega-Assembler file
230267843Sdelphij0	byte		0xFE
231267843Sdelphij>1	uleshort	0x0001
232267843Sdelphij>>5	uleshort	0xffff
233267843Sdelphij>>>6	byte		0x0A		MSX Mega-Assembler source
234267843Sdelphij
235267843Sdelphij# Execrom Patchfile
236267843Sdelphij0	string		ExecROM\ patchfile\x1A	MSX ExecROM patchfile
237267843Sdelphij>0x12	ubyte/16	x		v%d
238267843Sdelphij>0x12	ubyte&0xF	x		\b.%d
239267843Sdelphij>0x13	ubyte		x		\b, contains %d patches
240267843Sdelphij
241267843Sdelphij# Konami's King's Valley-2 custom stage (ELG file)
242267843Sdelphij4	uleshort	0x0900
243267843Sdelphij>0xF	byte		1
244267843Sdelphij>>0x14	byte		0
245267843Sdelphij>>>0x1E	string		\ \ \ 
246267843Sdelphij>>>>0x23	byte	1
247267843Sdelphij>>>>>0x25	byte	0
248267843Sdelphij>>>>>>0x15	string	>\x30
249267843Sdelphij>>>>>>>0x15	string	<\x5A		Konami King's Valley-2 custom stage, title: "%-8.8s"
250267843Sdelphij>>>>>>>>0x1D	byte	<32	\b, theme: %d
251267843Sdelphij
252267843Sdelphij# Metal Gear 1 savegame
253267843Sdelphij#0x4F	string	\x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
254267843Sdelphij#>>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
255267843Sdelphij#>>>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
256