head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC4:1.1.1.5
	netbsd-11-0-RC3:1.1.1.5
	netbsd-11-0-RC2:1.1.1.5
	netbsd-11-0-RC1:1.1.1.5
	perseant-exfatfs-base-20250801:1.1.1.5
	netbsd-11:1.1.1.5.0.6
	netbsd-11-base:1.1.1.5
	netbsd-10-1-RELEASE:1.1.1.5
	perseant-exfatfs-base-20240630:1.1.1.5
	perseant-exfatfs:1.1.1.5.0.4
	perseant-exfatfs-base:1.1.1.5
	netbsd-8-3-RELEASE:1.1.1.4
	netbsd-9-4-RELEASE:1.1.1.4
	netbsd-10-0-RELEASE:1.1.1.5
	netbsd-10-0-RC6:1.1.1.5
	netbsd-10-0-RC5:1.1.1.5
	netbsd-10-0-RC4:1.1.1.5
	netbsd-10-0-RC3:1.1.1.5
	netbsd-10-0-RC2:1.1.1.5
	netbsd-10-0-RC1:1.1.1.5
	FILE5_45:1.1.1.5
	netbsd-10:1.1.1.5.0.2
	netbsd-10-base:1.1.1.5
	FILE5_43:1.1.1.5
	netbsd-9-3-RELEASE:1.1.1.4
	cjep_sun2x-base1:1.1.1.4
	cjep_sun2x:1.1.1.4.0.18
	cjep_sun2x-base:1.1.1.4
	cjep_staticlib_x-base1:1.1.1.4
	netbsd-9-2-RELEASE:1.1.1.4
	cjep_staticlib_x:1.1.1.4.0.16
	cjep_staticlib_x-base:1.1.1.4
	FILE5_40:1.1.1.4
	netbsd-9-1-RELEASE:1.1.1.4
	FILE5_39:1.1.1.4
	phil-wifi-20200421:1.1.1.4
	phil-wifi-20200411:1.1.1.4
	is-mlppp:1.1.1.4.0.14
	is-mlppp-base:1.1.1.4
	phil-wifi-20200406:1.1.1.4
	netbsd-8-2-RELEASE:1.1.1.4
	netbsd-9-0-RELEASE:1.1.1.4
	netbsd-9-0-RC2:1.1.1.4
	FILE5_38:1.1.1.4
	netbsd-9-0-RC1:1.1.1.4
	phil-wifi-20191119:1.1.1.4
	netbsd-9:1.1.1.4.0.12
	netbsd-9-base:1.1.1.4
	phil-wifi-20190609:1.1.1.4
	netbsd-8-1-RELEASE:1.1.1.4
	FILE5_37:1.1.1.4
	netbsd-8-1-RC1:1.1.1.4
	pgoyette-compat-merge-20190127:1.1.1.4
	pgoyette-compat-20190127:1.1.1.4
	pgoyette-compat-20190118:1.1.1.4
	pgoyette-compat-1226:1.1.1.4
	pgoyette-compat-1126:1.1.1.4
	pgoyette-compat-1020:1.1.1.4
	FILE5_35:1.1.1.4
	pgoyette-compat-0930:1.1.1.4
	pgoyette-compat-0906:1.1.1.4
	netbsd-7-2-RELEASE:1.1.1.2
	pgoyette-compat-0728:1.1.1.4
	netbsd-8-0-RELEASE:1.1.1.4
	phil-wifi:1.1.1.4.0.10
	phil-wifi-base:1.1.1.4
	pgoyette-compat-0625:1.1.1.4
	netbsd-8-0-RC2:1.1.1.4
	pgoyette-compat-0521:1.1.1.4
	pgoyette-compat-0502:1.1.1.4
	pgoyette-compat-0422:1.1.1.4
	netbsd-8-0-RC1:1.1.1.4
	FILE5_33:1.1.1.4
	pgoyette-compat-0415:1.1.1.4
	pgoyette-compat-0407:1.1.1.4
	pgoyette-compat-0330:1.1.1.4
	pgoyette-compat-0322:1.1.1.4
	pgoyette-compat-0315:1.1.1.4
	netbsd-7-1-2-RELEASE:1.1.1.2
	pgoyette-compat:1.1.1.4.0.8
	pgoyette-compat-base:1.1.1.4
	netbsd-7-1-1-RELEASE:1.1.1.2
	matt-nb8-mediatek:1.1.1.4.0.6
	matt-nb8-mediatek-base:1.1.1.4
	FILE5_32:1.1.1.4
	perseant-stdc-iso10646:1.1.1.4.0.4
	perseant-stdc-iso10646-base:1.1.1.4
	netbsd-8:1.1.1.4.0.2
	netbsd-8-base:1.1.1.4
	FILE5_31:1.1.1.4
	prg-localcount2-base3:1.1.1.3
	prg-localcount2-base2:1.1.1.3
	prg-localcount2-base1:1.1.1.3
	prg-localcount2:1.1.1.3.0.2
	prg-localcount2-base:1.1.1.3
	pgoyette-localcount-20170426:1.1.1.3
	bouyer-socketcan-base1:1.1.1.3
	pgoyette-localcount-20170320:1.1.1.3
	netbsd-7-1:1.1.1.2.0.14
	netbsd-7-1-RELEASE:1.1.1.2
	netbsd-7-1-RC2:1.1.1.2
	FILE5_30:1.1.1.3
	netbsd-7-nhusb-base-20170116:1.1.1.2
	bouyer-socketcan:1.1.1.2.0.12
	bouyer-socketcan-base:1.1.1.2
	pgoyette-localcount-20170107:1.1.1.2
	netbsd-7-1-RC1:1.1.1.2
	pgoyette-localcount-20161104:1.1.1.2
	netbsd-7-0-2-RELEASE:1.1.1.2
	localcount-20160914:1.1.1.2
	netbsd-7-nhusb:1.1.1.2.0.10
	netbsd-7-nhusb-base:1.1.1.2
	pgoyette-localcount-20160806:1.1.1.2
	pgoyette-localcount-20160726:1.1.1.2
	pgoyette-localcount:1.1.1.2.0.8
	pgoyette-localcount-base:1.1.1.2
	netbsd-7-0-1-RELEASE:1.1.1.2
	netbsd-7-0:1.1.1.2.0.6
	netbsd-7-0-RELEASE:1.1.1.2
	netbsd-7-0-RC3:1.1.1.2
	netbsd-7-0-RC2:1.1.1.2
	netbsd-7-0-RC1:1.1.1.2
	FILE5_22:1.1.1.2
	FILE5_20:1.1.1.2
	tls-maxphys-base:1.1.1.2
	tls-maxphys:1.1.1.2.0.4
	netbsd-7:1.1.1.2.0.2
	netbsd-7-base:1.1.1.2
	FILE5_19:1.1.1.2
	yamt-pagecache:1.1.1.1.0.4
	yamt-pagecache-base9:1.1.1.1
	tls-earlyentropy:1.1.1.1.0.2
	tls-earlyentropy-base:1.1.1.2
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.1
	riastradh-drm2-base3:1.1.1.1
	FILE5_16:1.1.1.1
	CHRISTOS:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2013.12.01.19.28.19;	author christos;	state Exp;
branches
	1.1.1.1;
next	;
commitid	RVQIxe3FpM3lSsfx;

1.1.1.1
date	2013.12.01.19.28.19;	author christos;	state Exp;
branches
	1.1.1.1.2.1
	1.1.1.1.4.1;
next	1.1.1.2;
commitid	RVQIxe3FpM3lSsfx;

1.1.1.2
date	2014.06.13.01.48.25;	author christos;	state Exp;
branches
	1.1.1.2.4.1
	1.1.1.2.8.1
	1.1.1.2.12.1;
next	1.1.1.3;
commitid	jtTYsE5FmJU6MiEx;

1.1.1.3
date	2017.02.10.17.42.59;	author christos;	state Exp;
branches;
next	1.1.1.4;
commitid	HAP3kn9Hn6ovMqFz;

1.1.1.4
date	2017.05.24.23.59.57;	author christos;	state Exp;
branches;
next	1.1.1.5;
commitid	WbyOU2LBE5qOyHSz;

1.1.1.5
date	2022.09.24.20.07.54;	author christos;	state Exp;
branches;
next	;
commitid	Nf6F9kcpc0EPC9VD;

1.1.1.1.2.1
date	2014.08.10.07.07.10;	author tls;	state Exp;
branches;
next	;
commitid	b1wUlsZGswrdGMLx;

1.1.1.1.4.1
date	2013.12.01.19.28.19;	author yamt;	state dead;
branches;
next	1.1.1.1.4.2;
commitid	tYJXbWAuFvTh7yBx;

1.1.1.1.4.2
date	2014.05.22.15.44.59;	author yamt;	state Exp;
branches;
next	;
commitid	tYJXbWAuFvTh7yBx;

1.1.1.2.4.1
date	2014.06.13.01.48.25;	author tls;	state dead;
branches;
next	1.1.1.2.4.2;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.2.4.2
date	2014.08.19.23.46.47;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.2.8.1
date	2017.03.20.06.52.20;	author pgoyette;	state Exp;
branches;
next	;
commitid	jjw7cAwgyKq7RfKz;

1.1.1.2.12.1
date	2017.04.21.16.51.24;	author bouyer;	state Exp;
branches;
next	;
commitid	dUG7nkTKALCadqOz;


desc
@@


1.1
log
@Initial revision
@
text
@
#------------------------------------------------------------------------------
# msx:  file(1) magic for the MSX Home Computer
# v1.1
# Fábio R. Schmidlin <sd-snatcher@@users.sourceforge.net>

############## MSX Music file formats ##############

# Gigamix MGSDRV music file
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
>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
>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
>4	byte		0x10	MSX Moonblaster for MoonSound music

# Music Player K-kaz
0	string		MPK	MSX Music Player K-kaz song
>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\n#FORMAT	MSX Music Player K-kaz source MML file
#0	search/0xFFFF	\r\nFM1\ \=
#>0	search/0xFFFF	\r\nPSG1\=
#>>0	search/0xFFFF	\r\nSCC1\=		MSX MuSiCa MML source file

# OPX Music file
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
>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 image file formats ##############

# 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

# Graph Saurus compressed images
0	ubyte		0xFD
>1	uleshort	0
>>5	uleshort	0
>>>3	uleshort	>0x013D		MSX Graph Saurus compressed image

# Maki-chan Graphic format
0	string		MAKI02\ \ 	Maki-chan image,
>8	byte		x		system ID: %c
>9	byte		x		\b%c
>10	byte		x		\b%c
>11	byte		x		\b%c,
>13	search/0x200	\x1A
# >>&3	ubyte		0		, video mode: PC-98 400 lines, 16 analog colors
# >>&3	ubyte		1		, video mode: MSX SC7, 16 analog colors
# >>&3	ubyte		2		, video mode: VM-98 400 lines, 8 analog colors
# >>&3	ubyte		3		, video mode: PC-88 analog, 200 lines, 8 analog colors
# >>&3	ubyte		4		, video mode: 400 lines, 16 digital colors
# >>&3	ubyte		5		, video mode: 200 lines, 16 digital colors
# >>&3	ubyte		6		, video mode: old PC-98 digital 400 lines, 8 colors
# >>&3	ubyte		7		, video mode: PC-88 400 lines, 8 digital colors
>>&8	uleshort+1	x		%dx
>>&10	uleshort+1	x		\b%d,
>>&3	ubyte&0x82	0x80		256 colors
>>&3	ubyte&0x82	0x00		16 colors
>>&3	ubyte&0x82	0x01		8 colors
>>&3	ubyte&0x04	4		digital
>>&3	ubyte&0x04	0		analog
>>&3	ubyte&0x01	1		\b, 2:1 dot aspect ratio

# Japanese PIC file
0	string		PIC\x1A
>4	lelong		0		Japanese PIC image file

# MSX G9B image file
0	string		G9B
>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 ##############

# MSX ROMs
0	string		AB
>2	uleshort	0x0010			MSX ROM
>>2	uleshort	x			\b, init=0x%4x
>>4	uleshort	>0			\b, stat=0x%4x
>>6	uleshort	>0			\b, dev=0x%4x
>>8	uleshort	>0			\b, bas=0x%4x
>2	uleshort	0x4010			MSX ROM
>>2	uleshort	x			\b, init=0x%04x
>>4	uleshort	>0			\b, stat=0x%04x
>>6	uleshort	>0			\b, dev=0x%04x
>>8	uleshort	>0			\b, bas=0x%04x
>2	uleshort	0x8010			MSX ROM
>>2	uleshort	x			\b, init=0x%04x
>>4	uleshort	>0			\b, stat=0x%04x
>>6	uleshort	>0			\b, dev=0x%04x
>>8	uleshort	>0			\b, bas=0x%04x

0	string		AB
#>2	string		5JSuperLAYDOCK		MSX Super Laydock ROM
#>3	string		@@HYDLIDE3MSX		MSX Hydlide-3 ROM
#>3	string		@@3\x80IA862		Golvellius MSX1 ROM
>2	uleshort	>10
>>10	string		\0\0\0\0\0\0		MSX ROM
>>>0x10	string		YZ\0\0\0\0		Konami Game Master 2 MSX ROM
>>>0x10	string		CD			\b, Konami RC-
>>>>0x12	ubyte		x			\b%d
>>>>0x13	ubyte/16	x			\b%d
>>>>0x13	ubyte&0xF	x			\b%d
>>>0x10	string		EF			\b, Konami RC-
>>>>0x12	ubyte		x			\b%d
>>>>0x13	ubyte/16	x			\b%d
>>>>0x13	ubyte&0xF	x			\b%d
>>>2	uleshort	x			\b, init=0x%04x
>>>4	uleshort	>0			\b, stat=0x%04x
>>>6	uleshort	>0			\b, dev=0x%04x
>>>8	uleshort	>0			\b, bas=0x%04x
>2	uleshort	0
>>4	uleshort	0
>>>6	uleshort	0
>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=0x%04x

0x4000	string		AB
>0x4002	uleshort	>0x4010
>>0x400A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
>>0x4002	uleshort	x			\b, init=0x%04x
>>0x4004	uleshort	>0			\b, stat=0x%04x
>>0x4006	uleshort	>0			\b, dev=0x%04x
>>0x4008	uleshort	>0			\b, bas=0x%04x

0x8000	string		AB
>0x8002	uleshort	>0x4010
>>0x800A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
>>0x8002	uleshort	x			\b, init=0x%04x
>>0x8004	uleshort	>0			\b, stat=0x%04x
>>0x8006	uleshort	>0			\b, dev=0x%04x
>>0x8008	uleshort	>0			\b, bas=0x%04x


0x3C000	string		AB
>0x3C008	string		\0\0\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
>>0x3C002	uleshort	x			\b, init=0x%04x
>>0x3C004	uleshort	>0			\b, stat=0x%04x
>>0x3C006	uleshort	>0			\b, dev=0x%04x
>>0x3C008	uleshort	>0			\b, bas=0x%04x

# MSX BIN file
#0	byte		0xFE
#>1	uleshort	>0x8000
#>>3	uleshort	>0x8004
#>>>5	uleshort	>0x8000			MSX BIN file

# MSX-BASIC file
0	byte		0xFF
>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
>>5	uleshort	0xffff
>>>6	byte		0x0A		MSX Mega-Assembler source

# Execrom Patchfile
0	string		ExecROM\ patchfile\x1A	MSX ExecROM patchfile
>0x12	ubyte/16	x		v%d
>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
@


1.1.1.1
log
@from ftp.astron.com, this is a bug fix release:
       * always leave magic file loaded, don't unload for magic_check, etc.
       * fix default encoding to binary instead of unknown which broke recently
       * handle empty and one byte files, less specially so that
         --mime-encoding does not break completely.
       * fix erroneous non-zero exit code from non-existant file and message
       * add CDF MSI file detection (Guy Helmer)
@
text
@@


1.1.1.1.2.1
log
@Rebase.
@
text
@d5 1
a5 1
# Fabio R. Schmidlin <sd-snatcher@@users.sourceforge.net>
@


1.1.1.2
log
@import file-5.19

2014-06-09   9:04  Christos Zoulas <christos@@zoulas.com>

	* Misc buffer overruns and missing buffer size tests in cdf parsing
	  (Francisco Alonso, Jan Kaluza)

2014-06-02  14:50  Christos Zoulas <christos@@zoulas.com>

	* Enforce limit of 8K on regex searches that have no limits
	* Allow the l modifier for regex to mean line count. Default
	  to byte count. If line count is specified, assume a max
	  of 80 characters per line to limit the byte count.
	* Don't allow conversions to be used for dates, allowing
	  the mask field to be used as an offset.

2014-05-30  12:51  Christos Zoulas <christos@@zoulas.com>

	* Make the range operator limit the length of the
	  regex search.

2014-05-14  19:23  Christos Zoulas <christos@@zoulas.com>

	* PR/347: Windows fixes
	* PR/352: Hangul word processor recognition
	* PR/354: Encoding irregularities in text files

2014-05-06  6:12  Christos Zoulas <christos@@zoulas.com>

	* Fix uninitialized title in CDF files (Jan Kaluza)

2014-05-04  14:55  Christos Zoulas <christos@@zoulas.com>

	* PR/351: Fix compilation of empty files

2014-04-30  17:39  Christos Zoulas <christos@@zoulas.com>

	* Fix integer formats: We don't specify 'l' or
	  'h' and 'hh' specifiers anymore, only 'll' for
	  quads and nothing for the rest. This is so that
	  magic writing is simpler.

2014-04-01  15:25  Christos Zoulas <christos@@zoulas.com>

	* PR/341: Jan Kaluza, fix memory leak
	* PR/342: Jan Kaluza, fix out of bounds read

2014-03-28  15:25  Christos Zoulas <christos@@zoulas.com>

	* Fix issue with long formats not matching fmtcheck
@
text
@d5 1
a5 1
# Fabio R. Schmidlin <sd-snatcher@@users.sourceforge.net>
@


1.1.1.2.12.1
log
@Sync with HEAD
@
text
@d4 1
a4 1
# v1.3
d10 1
a10 1
0	string/b		MGS	MSX Gigamix MGSDRV3 music file, 
d17 1
a17 1
1	string/b		mgs2\ 	MSX Gigamix MGSDRV2 music file
d23 1
a23 1
0	string/b		KSCC	KSS music file v1.03
d31 1
a31 1
0	string/b		KSSX	KSS music file v1.20
d45 1
a45 1
0	string/b		MBMS
d49 1
a49 1
0	string/b		MPK	MSX Music Player K-kaz song
d73 1
a73 1
0x8B	string/b		SCMD
d102 28
d131 1
a131 1
0	string/b		G9B
d149 2
a150 69
# MSX internal ROMs
0		ubeshort	0xF3C3
>2		uleshort	<0x4000
>>8		ubyte		0xC3
>>>9		uleshort	<0x4000
>>>>0x0B	ubeshort	0x00C3
>>>>>0x0D	uleshort	<0x4000
>>>>>>0x0F	ubeshort	0x00C3
>>>>>>>0x11	uleshort	<0x4000
>>>>>>>>0x13	ubeshort	0x00C3
>>>>>>>>>0x15	uleshort	<0x4000
>>>>>>>>>>0x50	ubyte		0xC3
>>>>>>>>>>>0x51	uleshort	<0x4000
>>>>>>>>>>>>(9.s)	ubyte	0xC3
>>>>>>>>>>>>>&0	uleshort	>0x4000
>>>>>>>>>>>>>>&0	ubyte	0xC3		MSX BIOS+BASIC
>>>>>>>>>>>>>>>0x002D	ubyte+1	<3		\b. version=MSX%d
>>>>>>>>>>>>>>>0x002D	ubyte	2		\b, version=MSX2+
>>>>>>>>>>>>>>>0x002D	ubyte	3		\b, version=MSX Turbo-R
>>>>>>>>>>>>>>>0x002D	ubyte	>3		\b, version=Unknown MSX %d version
>>>>>>>>>>>>>>>0x0006	ubyte	x		\b, VDP.DR=0x%2x
>>>>>>>>>>>>>>>0x0007	ubyte	x		\b, VDP.DW=0x%2x
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	0		\b, charset=Japanese
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	1		\b, charset=International
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	2		\b, charset=Korean
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	>2		\b, charset=Unknown id:%d
>>>>>>>>>>>>>>>0x002B	ubyte&0x70	0x00		\b, date format=Y-M-D
>>>>>>>>>>>>>>>0x002B	ubyte&0x70	0x10		\b, date format=M-D-Y
>>>>>>>>>>>>>>>0x002B	ubyte&0x70	0x20		\b, date format=D-M-Y
>>>>>>>>>>>>>>>0x002B	ubyte&0x80	0x00		\b, vfreq=60Hz
>>>>>>>>>>>>>>>0x002B	ubyte&0x80	0x80		\b, vfreq=50Hz
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	0		\b, keyboard=Japanese
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	1		\b, keyboard=International
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	2		\b, keyboard=French
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	3		\b, keyboard=UK
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	4		\b, keyboard=German
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	5		\b, keyboard=Unknown id:%d
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	6		\b, keyboard=Spanish
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	>6		\b, keyboard=Unknown id:%d
>>>>>>>>>>>>>>>0x002C	ubyte&0xF0	0x00		\b, basic=Japanese
>>>>>>>>>>>>>>>0x002C	ubyte&0xF0	0x10		\b, basic=International
>>>>>>>>>>>>>>>0x002C	ubyte&0xF0	>0x10		\b, basic=Unknown id:%d
>>>>>>>>>>>>>>>0x002E	ubyte&1		1		\b, built-in MIDI


0		string/b		CD
>2		uleshort	>0x10
>>2		uleshort	<0x4000
>>>4		uleshort	<0x4000
>>>>6		uleshort	<0x4000
>>>>>8		ubyte		0xC3
>>>>>>9		uleshort	<0x4000
>>>>>>>0x10	ubyte		0xC3
>>>>>>>>0x11	uleshort	<0x4000
>>>>>>>>>0x14	ubyte		0xC3
>>>>>>>>>>0x15	uleshort	<0x4000		MSX2/2+/TR SubROM

0		string		\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
>0x5F0		ubequad		0x8282828244380000
>>0x150		ubyte		0x38
>>>0x170	string		\20\20\20
>>>>0x1E32	string		())
>>>>>0x2130	ubequad		0xA5A5594924231807
>>>>>0x2138	ubequad		0x4A4A3424488830C0	MSX Kanji Font



# MSX extension ROMs
0	string/b		AB
d153 2
a154 2
>>4	uleshort	>0			\b, stahdl=0x%4x
>>6	uleshort	>0			\b, devhdl=0x%4x
d158 2
a159 2
>>4	uleshort	>0			\b, stahdl=0x%04x
>>6	uleshort	>0			\b, devhdl=0x%04x
d163 2
a164 2
>>4	uleshort	>0			\b, stahdl=0x%04x
>>6	uleshort	>0			\b, devhdl=0x%04x
a165 13
0	string/b		AB\0\0
>6	uleshort	0
>>4	uleshort	>0x400F			MSX-BASIC extension ROM
>>>4	uleshort	>0			\b, stahdl=0x%04x
>>>6	uleshort	>0			\b, devhdl=0x%04x
>>>0x1C		string		OPLL			\b, MSX-Music
>>>>0x18	string		PAC2			\b (external)
>>>>0x18	string		APRL			\b (internal)

0	string/b		AB\0\0\0\0
>6	uleshort	>0x400F			MSX device BIOS
>>6	uleshort	>0			\b, devhdl=0x%04x

d167 1
a167 1
0	string/b		AB
d171 35
a205 37
>2	uleshort	>15
>>2	uleshort	<0xC000
>>>8	string		\0\0\0\0\0\0\0\0
>>>>(2.s&0x3FFF)	uleshort	>0		MSX ROM
>>>>>0x10	string		YZ\0\0\0\0		Konami Game Master 2 MSX ROM
>>>>>0x10	string		CD			\b, Konami RC-
>>>>>>0x12	ubyte		x			\b%d
>>>>>>0x13	ubyte/16	x			\b%d
>>>>>>0x13	ubyte&0xF	x			\b%d
>>>>>0x10	string		EF			\b, Konami RC-
>>>>>>0x12	ubyte		x			\b%d
>>>>>>0x13	ubyte/16	x			\b%d
>>>>>>0x13	ubyte&0xF	x			\b%d
>>>>>2	uleshort	x			\b, init=0x%04x
>>>>>4	uleshort	>0			\b, stahdl=0x%04x
>>>>>6	uleshort	>0			\b, devhdl=0x%04x
>>>>>8	uleshort	>0			\b, bas=0x%04x
>>>2	uleshort	0
>>>>4	uleshort	0
>>>>>6	uleshort	0
>>>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=0x%04x

0x4000	string/b		AB
>0x4002	uleshort	>0x400F
>>0x400A	string		\0\0\0\0\0\0	MSX ROM with nonstandard page order
>>>0x4002	uleshort	x			\b, init=0x%04x
>>>0x4004	uleshort	>0			\b, stahdl=0x%04x
>>>0x4006	uleshort	>0			\b, devhdl=0x%04x
>>>0x4008	uleshort	>0			\b, bas=0x%04x

0x8000	string/b		AB
>0x8002	uleshort	>0x400F
>>0x800A	string		\0\0\0\0\0\0	MSX ROM with nonstandard page order
>>>0x8002	uleshort	x			\b, init=0x%04x
>>>0x8004	uleshort	>0			\b, stahdl=0x%04x
>>>0x8006	uleshort	>0			\b, devhdl=0x%04x
>>>0x8008	uleshort	>0			\b, bas=0x%04x
d208 1
a208 1
0x3C000	string/b		AB
d211 2
a212 2
>>0x3C004	uleshort	>0			\b, stahdl=0x%04x
>>0x3C006	uleshort	>0			\b, devhdl=0x%04x
d227 1
a227 1
0	string/b	\x1F\xA6\xDE\xBA\xCC\x13\x7D\x74	MSX cassette archive
@


1.1.1.2.8.1
log
@Sync with HEAD
@
text
@d4 1
a4 1
# v1.3
d10 1
a10 1
0	string/b		MGS	MSX Gigamix MGSDRV3 music file, 
d17 1
a17 1
1	string/b		mgs2\ 	MSX Gigamix MGSDRV2 music file
d23 1
a23 1
0	string/b		KSCC	KSS music file v1.03
d31 1
a31 1
0	string/b		KSSX	KSS music file v1.20
d45 1
a45 1
0	string/b		MBMS
d49 1
a49 1
0	string/b		MPK	MSX Music Player K-kaz song
d73 1
a73 1
0x8B	string/b		SCMD
d102 28
d131 1
a131 1
0	string/b		G9B
d149 2
a150 69
# MSX internal ROMs
0		ubeshort	0xF3C3
>2		uleshort	<0x4000
>>8		ubyte		0xC3
>>>9		uleshort	<0x4000
>>>>0x0B	ubeshort	0x00C3
>>>>>0x0D	uleshort	<0x4000
>>>>>>0x0F	ubeshort	0x00C3
>>>>>>>0x11	uleshort	<0x4000
>>>>>>>>0x13	ubeshort	0x00C3
>>>>>>>>>0x15	uleshort	<0x4000
>>>>>>>>>>0x50	ubyte		0xC3
>>>>>>>>>>>0x51	uleshort	<0x4000
>>>>>>>>>>>>(9.s)	ubyte	0xC3
>>>>>>>>>>>>>&0	uleshort	>0x4000
>>>>>>>>>>>>>>&0	ubyte	0xC3		MSX BIOS+BASIC
>>>>>>>>>>>>>>>0x002D	ubyte+1	<3		\b. version=MSX%d
>>>>>>>>>>>>>>>0x002D	ubyte	2		\b, version=MSX2+
>>>>>>>>>>>>>>>0x002D	ubyte	3		\b, version=MSX Turbo-R
>>>>>>>>>>>>>>>0x002D	ubyte	>3		\b, version=Unknown MSX %d version
>>>>>>>>>>>>>>>0x0006	ubyte	x		\b, VDP.DR=0x%2x
>>>>>>>>>>>>>>>0x0007	ubyte	x		\b, VDP.DW=0x%2x
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	0		\b, charset=Japanese
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	1		\b, charset=International
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	2		\b, charset=Korean
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	>2		\b, charset=Unknown id:%d
>>>>>>>>>>>>>>>0x002B	ubyte&0x70	0x00		\b, date format=Y-M-D
>>>>>>>>>>>>>>>0x002B	ubyte&0x70	0x10		\b, date format=M-D-Y
>>>>>>>>>>>>>>>0x002B	ubyte&0x70	0x20		\b, date format=D-M-Y
>>>>>>>>>>>>>>>0x002B	ubyte&0x80	0x00		\b, vfreq=60Hz
>>>>>>>>>>>>>>>0x002B	ubyte&0x80	0x80		\b, vfreq=50Hz
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	0		\b, keyboard=Japanese
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	1		\b, keyboard=International
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	2		\b, keyboard=French
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	3		\b, keyboard=UK
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	4		\b, keyboard=German
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	5		\b, keyboard=Unknown id:%d
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	6		\b, keyboard=Spanish
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	>6		\b, keyboard=Unknown id:%d
>>>>>>>>>>>>>>>0x002C	ubyte&0xF0	0x00		\b, basic=Japanese
>>>>>>>>>>>>>>>0x002C	ubyte&0xF0	0x10		\b, basic=International
>>>>>>>>>>>>>>>0x002C	ubyte&0xF0	>0x10		\b, basic=Unknown id:%d
>>>>>>>>>>>>>>>0x002E	ubyte&1		1		\b, built-in MIDI


0		string/b		CD
>2		uleshort	>0x10
>>2		uleshort	<0x4000
>>>4		uleshort	<0x4000
>>>>6		uleshort	<0x4000
>>>>>8		ubyte		0xC3
>>>>>>9		uleshort	<0x4000
>>>>>>>0x10	ubyte		0xC3
>>>>>>>>0x11	uleshort	<0x4000
>>>>>>>>>0x14	ubyte		0xC3
>>>>>>>>>>0x15	uleshort	<0x4000		MSX2/2+/TR SubROM

0		string		\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
>0x5F0		ubequad		0x8282828244380000
>>0x150		ubyte		0x38
>>>0x170	string		\20\20\20
>>>>0x1E32	string		())
>>>>>0x2130	ubequad		0xA5A5594924231807
>>>>>0x2138	ubequad		0x4A4A3424488830C0	MSX Kanji Font



# MSX extension ROMs
0	string/b		AB
d153 2
a154 2
>>4	uleshort	>0			\b, stahdl=0x%4x
>>6	uleshort	>0			\b, devhdl=0x%4x
d158 2
a159 2
>>4	uleshort	>0			\b, stahdl=0x%04x
>>6	uleshort	>0			\b, devhdl=0x%04x
d163 2
a164 2
>>4	uleshort	>0			\b, stahdl=0x%04x
>>6	uleshort	>0			\b, devhdl=0x%04x
a165 13
0	string/b		AB\0\0
>6	uleshort	0
>>4	uleshort	>0x400F			MSX-BASIC extension ROM
>>>4	uleshort	>0			\b, stahdl=0x%04x
>>>6	uleshort	>0			\b, devhdl=0x%04x
>>>0x1C		string		OPLL			\b, MSX-Music
>>>>0x18	string		PAC2			\b (external)
>>>>0x18	string		APRL			\b (internal)

0	string/b		AB\0\0\0\0
>6	uleshort	>0x400F			MSX device BIOS
>>6	uleshort	>0			\b, devhdl=0x%04x

d167 1
a167 1
0	string/b		AB
d171 35
a205 37
>2	uleshort	>15
>>2	uleshort	<0xC000
>>>8	string		\0\0\0\0\0\0\0\0
>>>>(2.s&0x3FFF)	uleshort	>0		MSX ROM
>>>>>0x10	string		YZ\0\0\0\0		Konami Game Master 2 MSX ROM
>>>>>0x10	string		CD			\b, Konami RC-
>>>>>>0x12	ubyte		x			\b%d
>>>>>>0x13	ubyte/16	x			\b%d
>>>>>>0x13	ubyte&0xF	x			\b%d
>>>>>0x10	string		EF			\b, Konami RC-
>>>>>>0x12	ubyte		x			\b%d
>>>>>>0x13	ubyte/16	x			\b%d
>>>>>>0x13	ubyte&0xF	x			\b%d
>>>>>2	uleshort	x			\b, init=0x%04x
>>>>>4	uleshort	>0			\b, stahdl=0x%04x
>>>>>6	uleshort	>0			\b, devhdl=0x%04x
>>>>>8	uleshort	>0			\b, bas=0x%04x
>>>2	uleshort	0
>>>>4	uleshort	0
>>>>>6	uleshort	0
>>>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=0x%04x

0x4000	string/b		AB
>0x4002	uleshort	>0x400F
>>0x400A	string		\0\0\0\0\0\0	MSX ROM with nonstandard page order
>>>0x4002	uleshort	x			\b, init=0x%04x
>>>0x4004	uleshort	>0			\b, stahdl=0x%04x
>>>0x4006	uleshort	>0			\b, devhdl=0x%04x
>>>0x4008	uleshort	>0			\b, bas=0x%04x

0x8000	string/b		AB
>0x8002	uleshort	>0x400F
>>0x800A	string		\0\0\0\0\0\0	MSX ROM with nonstandard page order
>>>0x8002	uleshort	x			\b, init=0x%04x
>>>0x8004	uleshort	>0			\b, stahdl=0x%04x
>>>0x8006	uleshort	>0			\b, devhdl=0x%04x
>>>0x8008	uleshort	>0			\b, bas=0x%04x
d208 1
a208 1
0x3C000	string/b		AB
d211 2
a212 2
>>0x3C004	uleshort	>0			\b, stahdl=0x%04x
>>0x3C006	uleshort	>0			\b, devhdl=0x%04x
d227 1
a227 1
0	string/b	\x1F\xA6\xDE\xBA\xCC\x13\x7D\x74	MSX cassette archive
@


1.1.1.3
log
@2017-02-10  12:24  Christos Zoulas <christos@@zoulas.com>

	* release 5.30

2017-02-07  23:27  Christos Zoulas <christos@@zoulas.com>

	* If we exceeded the offset in a search return no match
	  (Christoph Biedl)
	* Be more lenient on corrupt CDF files (Christoph Biedl)

2017-02-04  16:46  Christos Zoulas <christos@@zoulas.com>

	* pacify ubsan sign extension (oss-fuzz/524)

2017-02-01  12:42  Christos Zoulas <christos@@zoulas.com>

	* off by one in cdf parsing (PR/593)
	* report debugging sections in elf (PR/591)

2016-11-06  10:52  Christos Zoulas <christos@@zoulas.com>

	* Allow @@@@@@ in extensions
	* Add missing overflow check in der magic (Jonas Wagner)

2016-10-25  10:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.29

2016-10-24  11:20  Christos Zoulas <christos@@zoulas.com>

	* der getlength overflow (Jonas Wagner)
	* multiple magic file load failure (Christoph Biedl)

2016-10-17  11:26  Christos Zoulas <christos@@zoulas.com>

	* CDF parsing improvements (Guy Helmer)

2016-07-20   7:26  Christos Zoulas <christos@@zoulas.com>

	* Add support for signed indirect offsets

2016-07-18   7:41  Christos Zoulas <christos@@zoulas.com>

	* cat /dev/null | file - should print empty (Christoph Biedl)

2016-07-05  15:20  Christos Zoulas <christos@@zoulas.com>

	* Bump string size from 64 to 96.

2016-06-13  20:20  Christos Zoulas <christos@@zoulas.com>

	* PR/556: Fix separators on annotations.

2016-06-13  19:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.28
	* fix leak on allocation failure

2016-06-01   1:20  Christos Zoulas <christos@@zoulas.com>

	* PR/555: Avoid overflow for offset > nbytes
	* PR/550: Segv on DER parsing:
	    - use the correct variable for length
	    - set offset to 0 on failure.

2016-05-13  12:00  Christos Zoulas <christos@@zoulas.com>

	* release 5.27

2016-04-18   9:35  Christos Zoulas <christos@@zoulas.com>

	* Errors comparing DER entries or computing offsets
	  are just indications of malformed non-DER files.
	  Don't print them.
	* Offset comparison was off-by-one.
	* Fix compression code (Werner Fink)
	* Put new bytes constant in the right file (not the generated one)

2016-04-16  18:34  Christos Zoulas <christos@@zoulas.com>

	* release 5.26

2016-03-31  13:50  Christos Zoulas <christos@@zoulas.com>

	* make the number of bytes read from files configurable.

2016-03-21  13:40  Christos Zoulas <christos@@zoulas.com>

	* Add bounds checks for DER code (discovered by Thomas Jarosch)
	* Change indirect recursion limit to indirect use count and
	  bump from 15 to 50 to prevent abuse.

2016-03-13  20:39  Christos Zoulas <christos@@zoulas.com>

	* Add -00 which prints filename\0description\0

2016-03-01  13:28  Christos Zoulas <christos@@zoulas.com>

	* Fix ID3 indirect parsing

2016-01-19  10:18  Christos Zoulas <christos@@zoulas.com>

	* add DER parsing capability

2015-11-13  10:35  Christos Zoulas <christos@@zoulas.com>

	* provide dprintf(3) for the OS's that don't have it.

2015-11-11  16:25  Christos Zoulas <christos@@zoulas.com>

	* redo the compression code report decompression errors

2015-11-10  23:25  Christos Zoulas <christos@@zoulas.com>

	* REG_STARTEND code is not working as expected, delete it.

2015-11-09  16:05  Christos Zoulas <christos@@zoulas.com>

	* Add zlib support if we have it.

2015-11-05  11:22  Christos Zoulas <christos@@zoulas.com>

	* PR/492: compression forking was broken with magic_buffer.

2015-09-16   9:50  Christos Zoulas <christos@@zoulas.com>

	* release 5.25

2015-09-11  13:25  Christos Zoulas <christos@@zoulas.com>

	* add a limit to the length of regex searches

2015-09-08   9:50  Christos Zoulas <christos@@zoulas.com>

	* fix problems with --parameter (Christoph Biedl)

2015-07-11  10:35  Christos Zoulas <christos@@zoulas.com>

	* Windows fixes PR/466 (Jason Hood)

2015-07-09  10:35  Christos Zoulas <christos@@zoulas.com>

	* release 5.24

2015-06-11   8:52  Christos Zoulas <christos@@zoulas.com>

	* redo long option encoding to fix off-by-one in 5.23

2015-06-10  13:50  Christos Zoulas <christos@@zoulas.com>

	* release 5.23

2015-06-09  16:10  Christos Zoulas <christos@@zoulas.com>

	* Fix issue with regex range for magic with offset
	* Always return true from mget with USE (success to mget not match
	  indication). Fixes mime evaluation after USE magic
	* PR/459: Don't insert magic entries to the list if there are parsing
	  errors for them.

2015-06-03  16:00  Christos Zoulas <christos@@zoulas.com>

	* PR/455: Add utf-7 encoding

2015-06-03  14:30  Christos Zoulas <christos@@zoulas.com>

	* PR/455: Implement -Z, look inside, but don't report on compression
	* PR/454: Fix allocation error on bad magic.

2015-05-29  10:30  Christos Zoulas <christos@@zoulas.com>

	* handle MAGIC_CONTINUE everywhere, not just in softmagic

2015-05-21  14:30  Christos Zoulas <christos@@zoulas.com>

	* don't print descriptions for NAME types when mime.

2015-04-09  15:59  Christos Zoulas <christos@@zoulas.com>

	* Add --extension to list the known extensions for this file type
	  Idea by Andrew J Roazen

2015-02-14  12:23  Christos Zoulas <christos@@zoulas.com>

	* Bump file search buffer size to 1M.

2015-01-09  14:35  Christos Zoulas <christos@@zoulas.com>

	* Fix multiple issues with date formats reported by Christoph Biedl:
		- T_LOCAL meaning was reversed
		- Arithmetic did not work
	  Also stop adjusting daylight savings for gmt printing.

2015-01-05  13:00  Christos Zoulas <christos@@zoulas.com>

	* PR/411: Fix memory corruption from corrupt cdf file.
@
text
@d4 1
a4 1
# v1.3
d10 1
a10 1
0	string/b		MGS	MSX Gigamix MGSDRV3 music file, 
d17 1
a17 1
1	string/b		mgs2\ 	MSX Gigamix MGSDRV2 music file
d23 1
a23 1
0	string/b		KSCC	KSS music file v1.03
d31 1
a31 1
0	string/b		KSSX	KSS music file v1.20
d45 1
a45 1
0	string/b		MBMS
d49 1
a49 1
0	string/b		MPK	MSX Music Player K-kaz song
d73 1
a73 1
0x8B	string/b		SCMD
d102 28
d131 1
a131 1
0	string/b		G9B
d149 2
a150 69
# MSX internal ROMs
0		ubeshort	0xF3C3
>2		uleshort	<0x4000
>>8		ubyte		0xC3
>>>9		uleshort	<0x4000
>>>>0x0B	ubeshort	0x00C3
>>>>>0x0D	uleshort	<0x4000
>>>>>>0x0F	ubeshort	0x00C3
>>>>>>>0x11	uleshort	<0x4000
>>>>>>>>0x13	ubeshort	0x00C3
>>>>>>>>>0x15	uleshort	<0x4000
>>>>>>>>>>0x50	ubyte		0xC3
>>>>>>>>>>>0x51	uleshort	<0x4000
>>>>>>>>>>>>(9.s)	ubyte	0xC3
>>>>>>>>>>>>>&0	uleshort	>0x4000
>>>>>>>>>>>>>>&0	ubyte	0xC3		MSX BIOS+BASIC
>>>>>>>>>>>>>>>0x002D	ubyte+1	<3		\b. version=MSX%d
>>>>>>>>>>>>>>>0x002D	ubyte	2		\b, version=MSX2+
>>>>>>>>>>>>>>>0x002D	ubyte	3		\b, version=MSX Turbo-R
>>>>>>>>>>>>>>>0x002D	ubyte	>3		\b, version=Unknown MSX %d version
>>>>>>>>>>>>>>>0x0006	ubyte	x		\b, VDP.DR=0x%2x
>>>>>>>>>>>>>>>0x0007	ubyte	x		\b, VDP.DW=0x%2x
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	0		\b, charset=Japanese
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	1		\b, charset=International
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	2		\b, charset=Korean
>>>>>>>>>>>>>>>0x002B	ubyte&0xF	>2		\b, charset=Unknown id:%d
>>>>>>>>>>>>>>>0x002B	ubyte&0x70	0x00		\b, date format=Y-M-D
>>>>>>>>>>>>>>>0x002B	ubyte&0x70	0x10		\b, date format=M-D-Y
>>>>>>>>>>>>>>>0x002B	ubyte&0x70	0x20		\b, date format=D-M-Y
>>>>>>>>>>>>>>>0x002B	ubyte&0x80	0x00		\b, vfreq=60Hz
>>>>>>>>>>>>>>>0x002B	ubyte&0x80	0x80		\b, vfreq=50Hz
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	0		\b, keyboard=Japanese
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	1		\b, keyboard=International
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	2		\b, keyboard=French
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	3		\b, keyboard=UK
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	4		\b, keyboard=German
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	5		\b, keyboard=Unknown id:%d
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	6		\b, keyboard=Spanish
>>>>>>>>>>>>>>>0x002C	ubyte&0x0F	>6		\b, keyboard=Unknown id:%d
>>>>>>>>>>>>>>>0x002C	ubyte&0xF0	0x00		\b, basic=Japanese
>>>>>>>>>>>>>>>0x002C	ubyte&0xF0	0x10		\b, basic=International
>>>>>>>>>>>>>>>0x002C	ubyte&0xF0	>0x10		\b, basic=Unknown id:%d
>>>>>>>>>>>>>>>0x002E	ubyte&1		1		\b, built-in MIDI


0		string/b		CD
>2		uleshort	>0x10
>>2		uleshort	<0x4000
>>>4		uleshort	<0x4000
>>>>6		uleshort	<0x4000
>>>>>8		ubyte		0xC3
>>>>>>9		uleshort	<0x4000
>>>>>>>0x10	ubyte		0xC3
>>>>>>>>0x11	uleshort	<0x4000
>>>>>>>>>0x14	ubyte		0xC3
>>>>>>>>>>0x15	uleshort	<0x4000		MSX2/2+/TR SubROM

0		string		\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
>0x5F0		ubequad		0x8282828244380000
>>0x150		ubyte		0x38
>>>0x170	string		\20\20\20
>>>>0x1E32	string		())
>>>>>0x2130	ubequad		0xA5A5594924231807
>>>>>0x2138	ubequad		0x4A4A3424488830C0	MSX Kanji Font



# MSX extension ROMs
0	string/b		AB
d153 2
a154 2
>>4	uleshort	>0			\b, stahdl=0x%4x
>>6	uleshort	>0			\b, devhdl=0x%4x
d158 2
a159 2
>>4	uleshort	>0			\b, stahdl=0x%04x
>>6	uleshort	>0			\b, devhdl=0x%04x
d163 2
a164 2
>>4	uleshort	>0			\b, stahdl=0x%04x
>>6	uleshort	>0			\b, devhdl=0x%04x
a165 13
0	string/b		AB\0\0
>6	uleshort	0
>>4	uleshort	>0x400F			MSX-BASIC extension ROM
>>>4	uleshort	>0			\b, stahdl=0x%04x
>>>6	uleshort	>0			\b, devhdl=0x%04x
>>>0x1C		string		OPLL			\b, MSX-Music
>>>>0x18	string		PAC2			\b (external)
>>>>0x18	string		APRL			\b (internal)

0	string/b		AB\0\0\0\0
>6	uleshort	>0x400F			MSX device BIOS
>>6	uleshort	>0			\b, devhdl=0x%04x

d167 1
a167 1
0	string/b		AB
d171 35
a205 37
>2	uleshort	>15
>>2	uleshort	<0xC000
>>>8	string		\0\0\0\0\0\0\0\0
>>>>(2.s&0x3FFF)	uleshort	>0		MSX ROM
>>>>>0x10	string		YZ\0\0\0\0		Konami Game Master 2 MSX ROM
>>>>>0x10	string		CD			\b, Konami RC-
>>>>>>0x12	ubyte		x			\b%d
>>>>>>0x13	ubyte/16	x			\b%d
>>>>>>0x13	ubyte&0xF	x			\b%d
>>>>>0x10	string		EF			\b, Konami RC-
>>>>>>0x12	ubyte		x			\b%d
>>>>>>0x13	ubyte/16	x			\b%d
>>>>>>0x13	ubyte&0xF	x			\b%d
>>>>>2	uleshort	x			\b, init=0x%04x
>>>>>4	uleshort	>0			\b, stahdl=0x%04x
>>>>>6	uleshort	>0			\b, devhdl=0x%04x
>>>>>8	uleshort	>0			\b, bas=0x%04x
>>>2	uleshort	0
>>>>4	uleshort	0
>>>>>6	uleshort	0
>>>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=0x%04x

0x4000	string/b		AB
>0x4002	uleshort	>0x400F
>>0x400A	string		\0\0\0\0\0\0	MSX ROM with nonstandard page order
>>>0x4002	uleshort	x			\b, init=0x%04x
>>>0x4004	uleshort	>0			\b, stahdl=0x%04x
>>>0x4006	uleshort	>0			\b, devhdl=0x%04x
>>>0x4008	uleshort	>0			\b, bas=0x%04x

0x8000	string/b		AB
>0x8002	uleshort	>0x400F
>>0x800A	string		\0\0\0\0\0\0	MSX ROM with nonstandard page order
>>>0x8002	uleshort	x			\b, init=0x%04x
>>>0x8004	uleshort	>0			\b, stahdl=0x%04x
>>>0x8006	uleshort	>0			\b, devhdl=0x%04x
>>>0x8008	uleshort	>0			\b, bas=0x%04x
d208 1
a208 1
0x3C000	string/b		AB
d211 2
a212 2
>>0x3C004	uleshort	>0			\b, stahdl=0x%04x
>>0x3C006	uleshort	>0			\b, devhdl=0x%04x
d227 1
a227 1
0	string/b	\x1F\xA6\xDE\xBA\xCC\x13\x7D\x74	MSX cassette archive
@


1.1.1.4
log
@Import file-5.31; mostly oss-fuzz found bugs.
@
text
@d10 1
a10 1
0	string/b		MGS	MSX Gigamix MGSDRV3 music file,
d38 1
a38 1
>>0xF	byte&0x01	0x01	\b,
d299 1
a299 1
>>>0x1E	string		\040\040\040
@


1.1.1.5
log
@Import file-5.43+; last was file-5.40

2022-09-20  17:12  Christos Zoulas <christos@@zoulas.com>

	* fixed various clustefuzz issues

2022-09-19  15:54  Christos Zoulas <christos@@zoulas.com>

	* Fix error detection for decompression code (Vincent Mihalkovic)

2022-09-15  13:50  Christos Zoulas <christos@@zoulas.com>

	* Add MAGIC_NO_COMPRESS_FORK and use it to produce a more
	  meaningful error message if we are sandboxing.

2022-09-15  10:45  Christos Zoulas <christos@@zoulas.com>

	* Add built-in lzip decompression support (Michal Gorny)

2022-09-14  10:35  Christos Zoulas <christos@@zoulas.com>

	* Add built-in zstd decompression support (Martin Rodriguez Reboredo)

2022-09-13  14:55  Christos Zoulas <christos@@zoulas.com>

	* release 5.43

2022-09-10   9:17  Christos Zoulas <christos@@zoulas.com>

	* Add octal indirect magic (Michal Gorny)

2022-08-17  11:43  Christos Zoulas <christos@@zoulas.com>

	* PR/374: avoid infinite loop in non-wide code (piru)
	* PR/373: Obey MAGIC_CONTINUE with multiple magic files (vismarli)

2022-07-26  11:10  Christos Zoulas <christos@@zoulas.com>

	* Fix bug with large flist (Florian Weimer)

2022-07-07  13:21  Christos Zoulas <christos@@zoulas.com>

        * PR/364: Detect non-nul-terminated core filenames from QEMU
	  (mam-ableton)

2022-07-04  15:45  Christos Zoulas <christos@@zoulas.com>

	* PR/359: Add support for http://ndjson.org/ (darose)
	* PR/362: Fix wide printing (ro-ee)
	* PR/358: Fix width for -f - (jpalus)
	* PR/356: Fix JSON constant parsing (davewhite)

2022-06-10   9:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.42

2022-05-31  14:50   Christos Zoulas <christos@@zoulas.com>

	* PR/348: add missing cases to prevent file from aborting on
	  random magic files.

2022-05-27  21:05   Christos Zoulas <christos@@zoulas.com>

	* PR/351: octalify filenames when not raw before printing.

2022-04-18  17:51   Christos Zoulas <christos@@zoulas.com>

	* fix regex cacheing bug (Dirk Mueller)
	* merge file_regcomp and file_regerror() to simplify the code
	  and reduce memory requirements for storing regexes (Dirk Mueller)

2022-03-19  12:56   Christos Zoulas <christos@@zoulas.com>

	* cache regex (Dirk Mueller)
	* detect filesystem full by flushing output (Dirk Mueller)

2021-11-19  12:36   Christos Zoulas <christos@@zoulas.com>

	* implement running decompressor programs using
	  posix_spawnp(2) instead of vfork(2)

2021-10-24  11:51   Christos Zoulas <christos@@zoulas.com>

	* Add support for msdos dates and times

2021-10-20   9:55   Christos Zoulas <christos@@zoulas.com>

	* use the system byte swapping functions if available (Werner Fink)

2021-10-18  11:57  Christos Zoulas <christos@@zoulas.com>

	* release 5.41

2021-09-23  03:51  Christos Zoulas <christos@@zoulas.com>

	* Avinash Sonawane: Fix tzname detection

2021-09-03  09:17  Christos Zoulas <christos@@zoulas.com>

	* Fix relationship tests with "search" magic, don't short circuit
	  logic

2021-07-13  01:06  Christos Zoulas <christos@@zoulas.com>

	* Fix memory leak in compile mode

2021-07-01  03:51  Christos Zoulas <christos@@zoulas.com>

	* PR/272: kiefermat: Only set returnval = 1 when we printed something
	  (in all cases print or !print). This simplifies the logic and fixes
	  the issue in the PR with -k and --mime-type there was no continuation
	  printed before the default case.

2021-06-30  13:07  Christos Zoulas <christos@@zoulas.com>

	* PR/270: Don't translate unprintable characters in %s magic formats
	  when -r
	* PR/269: Avoid undefined behavior with clang (adding offset to NULL)

2021-05-09  18:38  Christos Zoulas <christos@@zoulas.com>

	* Add a new flag (f) that requires that the match is a full word,
	   not a partial word match.
	* Add varint types (unused)

2021-04-19  17:17  Christos Zoulas <christos@@zoulas.com>

	* PR/256: mutableVoid: If the file is less than 3 bytes, use the file
	  length to determine type
	* PR/259: aleksandr.v.novichkov: mime printing through indirect magic
	  is not taken into account, use match directly so that it does.

2021-04-04  17:02  Christos Zoulas <christos@@zoulas.com>

	* count the total bytes found not the total byte positions
	  in order to determine encoding (Anatol Belski)
@
text
@d141 2
a142 2
>>>>>>>>>>>>>>>0x0006	ubyte	x		\b, VDP.DR=%#2x
>>>>>>>>>>>>>>>0x0007	ubyte	x		\b, VDP.DW=%#2x
d191 4
a194 4
>>2	uleshort	x			\b, init=%#4x
>>4	uleshort	>0			\b, stahdl=%#4x
>>6	uleshort	>0			\b, devhdl=%#4x
>>8	uleshort	>0			\b, bas=%#4x
d196 4
a199 4
>>2	uleshort	x			\b, init=%#04x
>>4	uleshort	>0			\b, stahdl=%#04x
>>6	uleshort	>0			\b, devhdl=%#04x
>>8	uleshort	>0			\b, bas=%#04x
d201 4
a204 4
>>2	uleshort	x			\b, init=%#04x
>>4	uleshort	>0			\b, stahdl=%#04x
>>6	uleshort	>0			\b, devhdl=%#04x
>>8	uleshort	>0			\b, bas=%#04x
d208 2
a209 2
>>>4	uleshort	>0			\b, stahdl=%#04x
>>>6	uleshort	>0			\b, devhdl=%#04x
d216 1
a216 1
>>6	uleshort	>0			\b, devhdl=%#04x
d236 4
a239 4
>>>>>2	uleshort	x			\b, init=%#04x
>>>>>4	uleshort	>0			\b, stahdl=%#04x
>>>>>6	uleshort	>0			\b, devhdl=%#04x
>>>>>8	uleshort	>0			\b, bas=%#04x
d243 1
a243 1
>>>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=%#04x
d248 4
a251 4
>>>0x4002	uleshort	x			\b, init=%#04x
>>>0x4004	uleshort	>0			\b, stahdl=%#04x
>>>0x4006	uleshort	>0			\b, devhdl=%#04x
>>>0x4008	uleshort	>0			\b, bas=%#04x
d256 4
a259 4
>>>0x8002	uleshort	x			\b, init=%#04x
>>>0x8004	uleshort	>0			\b, stahdl=%#04x
>>>0x8006	uleshort	>0			\b, devhdl=%#04x
>>>0x8008	uleshort	>0			\b, bas=%#04x
d264 4
a267 4
>>0x3C002	uleshort	x			\b, init=%#04x
>>0x3C004	uleshort	>0			\b, stahdl=%#04x
>>0x3C006	uleshort	>0			\b, devhdl=%#04x
>>0x3C008	uleshort	>0			\b, bas=%#04x
@


1.1.1.2.4.1
log
@file msx was added on branch tls-maxphys on 2014-08-19 23:46:47 +0000
@
text
@d1 255
@


1.1.1.2.4.2
log
@Rebase to HEAD as of a few days ago.
@
text
@a0 255

#------------------------------------------------------------------------------
# msx:  file(1) magic for the MSX Home Computer
# v1.1
# Fabio R. Schmidlin <sd-snatcher@@users.sourceforge.net>

############## MSX Music file formats ##############

# Gigamix MGSDRV music file
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
>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
>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
>4	byte		0x10	MSX Moonblaster for MoonSound music

# Music Player K-kaz
0	string		MPK	MSX Music Player K-kaz song
>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\n#FORMAT	MSX Music Player K-kaz source MML file
#0	search/0xFFFF	\r\nFM1\ \=
#>0	search/0xFFFF	\r\nPSG1\=
#>>0	search/0xFFFF	\r\nSCC1\=		MSX MuSiCa MML source file

# OPX Music file
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
>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 image file formats ##############

# 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

# Graph Saurus compressed images
0	ubyte		0xFD
>1	uleshort	0
>>5	uleshort	0
>>>3	uleshort	>0x013D		MSX Graph Saurus compressed image

# Maki-chan Graphic format
0	string		MAKI02\ \ 	Maki-chan image,
>8	byte		x		system ID: %c
>9	byte		x		\b%c
>10	byte		x		\b%c
>11	byte		x		\b%c,
>13	search/0x200	\x1A
# >>&3	ubyte		0		, video mode: PC-98 400 lines, 16 analog colors
# >>&3	ubyte		1		, video mode: MSX SC7, 16 analog colors
# >>&3	ubyte		2		, video mode: VM-98 400 lines, 8 analog colors
# >>&3	ubyte		3		, video mode: PC-88 analog, 200 lines, 8 analog colors
# >>&3	ubyte		4		, video mode: 400 lines, 16 digital colors
# >>&3	ubyte		5		, video mode: 200 lines, 16 digital colors
# >>&3	ubyte		6		, video mode: old PC-98 digital 400 lines, 8 colors
# >>&3	ubyte		7		, video mode: PC-88 400 lines, 8 digital colors
>>&8	uleshort+1	x		%dx
>>&10	uleshort+1	x		\b%d,
>>&3	ubyte&0x82	0x80		256 colors
>>&3	ubyte&0x82	0x00		16 colors
>>&3	ubyte&0x82	0x01		8 colors
>>&3	ubyte&0x04	4		digital
>>&3	ubyte&0x04	0		analog
>>&3	ubyte&0x01	1		\b, 2:1 dot aspect ratio

# Japanese PIC file
0	string		PIC\x1A
>4	lelong		0		Japanese PIC image file

# MSX G9B image file
0	string		G9B
>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 ##############

# MSX ROMs
0	string		AB
>2	uleshort	0x0010			MSX ROM
>>2	uleshort	x			\b, init=0x%4x
>>4	uleshort	>0			\b, stat=0x%4x
>>6	uleshort	>0			\b, dev=0x%4x
>>8	uleshort	>0			\b, bas=0x%4x
>2	uleshort	0x4010			MSX ROM
>>2	uleshort	x			\b, init=0x%04x
>>4	uleshort	>0			\b, stat=0x%04x
>>6	uleshort	>0			\b, dev=0x%04x
>>8	uleshort	>0			\b, bas=0x%04x
>2	uleshort	0x8010			MSX ROM
>>2	uleshort	x			\b, init=0x%04x
>>4	uleshort	>0			\b, stat=0x%04x
>>6	uleshort	>0			\b, dev=0x%04x
>>8	uleshort	>0			\b, bas=0x%04x

0	string		AB
#>2	string		5JSuperLAYDOCK		MSX Super Laydock ROM
#>3	string		@@HYDLIDE3MSX		MSX Hydlide-3 ROM
#>3	string		@@3\x80IA862		Golvellius MSX1 ROM
>2	uleshort	>10
>>10	string		\0\0\0\0\0\0		MSX ROM
>>>0x10	string		YZ\0\0\0\0		Konami Game Master 2 MSX ROM
>>>0x10	string		CD			\b, Konami RC-
>>>>0x12	ubyte		x			\b%d
>>>>0x13	ubyte/16	x			\b%d
>>>>0x13	ubyte&0xF	x			\b%d
>>>0x10	string		EF			\b, Konami RC-
>>>>0x12	ubyte		x			\b%d
>>>>0x13	ubyte/16	x			\b%d
>>>>0x13	ubyte&0xF	x			\b%d
>>>2	uleshort	x			\b, init=0x%04x
>>>4	uleshort	>0			\b, stat=0x%04x
>>>6	uleshort	>0			\b, dev=0x%04x
>>>8	uleshort	>0			\b, bas=0x%04x
>2	uleshort	0
>>4	uleshort	0
>>>6	uleshort	0
>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=0x%04x

0x4000	string		AB
>0x4002	uleshort	>0x4010
>>0x400A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
>>0x4002	uleshort	x			\b, init=0x%04x
>>0x4004	uleshort	>0			\b, stat=0x%04x
>>0x4006	uleshort	>0			\b, dev=0x%04x
>>0x4008	uleshort	>0			\b, bas=0x%04x

0x8000	string		AB
>0x8002	uleshort	>0x4010
>>0x800A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
>>0x8002	uleshort	x			\b, init=0x%04x
>>0x8004	uleshort	>0			\b, stat=0x%04x
>>0x8006	uleshort	>0			\b, dev=0x%04x
>>0x8008	uleshort	>0			\b, bas=0x%04x


0x3C000	string		AB
>0x3C008	string		\0\0\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
>>0x3C002	uleshort	x			\b, init=0x%04x
>>0x3C004	uleshort	>0			\b, stat=0x%04x
>>0x3C006	uleshort	>0			\b, dev=0x%04x
>>0x3C008	uleshort	>0			\b, bas=0x%04x

# MSX BIN file
#0	byte		0xFE
#>1	uleshort	>0x8000
#>>3	uleshort	>0x8004
#>>>5	uleshort	>0x8000			MSX BIN file

# MSX-BASIC file
0	byte		0xFF
>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
>>5	uleshort	0xffff
>>>6	byte		0x0A		MSX Mega-Assembler source

# Execrom Patchfile
0	string		ExecROM\ patchfile\x1A	MSX ExecROM patchfile
>0x12	ubyte/16	x		v%d
>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
@


1.1.1.1.4.1
log
@file msx was added on branch yamt-pagecache on 2014-05-22 15:44:59 +0000
@
text
@d1 255
@


1.1.1.1.4.2
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@a0 255

#------------------------------------------------------------------------------
# msx:  file(1) magic for the MSX Home Computer
# v1.1
# Fábio R. Schmidlin <sd-snatcher@@users.sourceforge.net>

############## MSX Music file formats ##############

# Gigamix MGSDRV music file
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
>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
>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
>4	byte		0x10	MSX Moonblaster for MoonSound music

# Music Player K-kaz
0	string		MPK	MSX Music Player K-kaz song
>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\n#FORMAT	MSX Music Player K-kaz source MML file
#0	search/0xFFFF	\r\nFM1\ \=
#>0	search/0xFFFF	\r\nPSG1\=
#>>0	search/0xFFFF	\r\nSCC1\=		MSX MuSiCa MML source file

# OPX Music file
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
>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 image file formats ##############

# 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

# Graph Saurus compressed images
0	ubyte		0xFD
>1	uleshort	0
>>5	uleshort	0
>>>3	uleshort	>0x013D		MSX Graph Saurus compressed image

# Maki-chan Graphic format
0	string		MAKI02\ \ 	Maki-chan image,
>8	byte		x		system ID: %c
>9	byte		x		\b%c
>10	byte		x		\b%c
>11	byte		x		\b%c,
>13	search/0x200	\x1A
# >>&3	ubyte		0		, video mode: PC-98 400 lines, 16 analog colors
# >>&3	ubyte		1		, video mode: MSX SC7, 16 analog colors
# >>&3	ubyte		2		, video mode: VM-98 400 lines, 8 analog colors
# >>&3	ubyte		3		, video mode: PC-88 analog, 200 lines, 8 analog colors
# >>&3	ubyte		4		, video mode: 400 lines, 16 digital colors
# >>&3	ubyte		5		, video mode: 200 lines, 16 digital colors
# >>&3	ubyte		6		, video mode: old PC-98 digital 400 lines, 8 colors
# >>&3	ubyte		7		, video mode: PC-88 400 lines, 8 digital colors
>>&8	uleshort+1	x		%dx
>>&10	uleshort+1	x		\b%d,
>>&3	ubyte&0x82	0x80		256 colors
>>&3	ubyte&0x82	0x00		16 colors
>>&3	ubyte&0x82	0x01		8 colors
>>&3	ubyte&0x04	4		digital
>>&3	ubyte&0x04	0		analog
>>&3	ubyte&0x01	1		\b, 2:1 dot aspect ratio

# Japanese PIC file
0	string		PIC\x1A
>4	lelong		0		Japanese PIC image file

# MSX G9B image file
0	string		G9B
>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 ##############

# MSX ROMs
0	string		AB
>2	uleshort	0x0010			MSX ROM
>>2	uleshort	x			\b, init=0x%4x
>>4	uleshort	>0			\b, stat=0x%4x
>>6	uleshort	>0			\b, dev=0x%4x
>>8	uleshort	>0			\b, bas=0x%4x
>2	uleshort	0x4010			MSX ROM
>>2	uleshort	x			\b, init=0x%04x
>>4	uleshort	>0			\b, stat=0x%04x
>>6	uleshort	>0			\b, dev=0x%04x
>>8	uleshort	>0			\b, bas=0x%04x
>2	uleshort	0x8010			MSX ROM
>>2	uleshort	x			\b, init=0x%04x
>>4	uleshort	>0			\b, stat=0x%04x
>>6	uleshort	>0			\b, dev=0x%04x
>>8	uleshort	>0			\b, bas=0x%04x

0	string		AB
#>2	string		5JSuperLAYDOCK		MSX Super Laydock ROM
#>3	string		@@HYDLIDE3MSX		MSX Hydlide-3 ROM
#>3	string		@@3\x80IA862		Golvellius MSX1 ROM
>2	uleshort	>10
>>10	string		\0\0\0\0\0\0		MSX ROM
>>>0x10	string		YZ\0\0\0\0		Konami Game Master 2 MSX ROM
>>>0x10	string		CD			\b, Konami RC-
>>>>0x12	ubyte		x			\b%d
>>>>0x13	ubyte/16	x			\b%d
>>>>0x13	ubyte&0xF	x			\b%d
>>>0x10	string		EF			\b, Konami RC-
>>>>0x12	ubyte		x			\b%d
>>>>0x13	ubyte/16	x			\b%d
>>>>0x13	ubyte&0xF	x			\b%d
>>>2	uleshort	x			\b, init=0x%04x
>>>4	uleshort	>0			\b, stat=0x%04x
>>>6	uleshort	>0			\b, dev=0x%04x
>>>8	uleshort	>0			\b, bas=0x%04x
>2	uleshort	0
>>4	uleshort	0
>>>6	uleshort	0
>>>>8	uleshort	>0			MSX BASIC program in ROM, bas=0x%04x

0x4000	string		AB
>0x4002	uleshort	>0x4010
>>0x400A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
>>0x4002	uleshort	x			\b, init=0x%04x
>>0x4004	uleshort	>0			\b, stat=0x%04x
>>0x4006	uleshort	>0			\b, dev=0x%04x
>>0x4008	uleshort	>0			\b, bas=0x%04x

0x8000	string		AB
>0x8002	uleshort	>0x4010
>>0x800A	string		\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
>>0x8002	uleshort	x			\b, init=0x%04x
>>0x8004	uleshort	>0			\b, stat=0x%04x
>>0x8006	uleshort	>0			\b, dev=0x%04x
>>0x8008	uleshort	>0			\b, bas=0x%04x


0x3C000	string		AB
>0x3C008	string		\0\0\0\0\0\0\0\0	MSX MegaROM with nonstandard page order
>>0x3C002	uleshort	x			\b, init=0x%04x
>>0x3C004	uleshort	>0			\b, stat=0x%04x
>>0x3C006	uleshort	>0			\b, dev=0x%04x
>>0x3C008	uleshort	>0			\b, bas=0x%04x

# MSX BIN file
#0	byte		0xFE
#>1	uleshort	>0x8000
#>>3	uleshort	>0x8004
#>>>5	uleshort	>0x8000			MSX BIN file

# MSX-BASIC file
0	byte		0xFF
>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
>>5	uleshort	0xffff
>>>6	byte		0x0A		MSX Mega-Assembler source

# Execrom Patchfile
0	string		ExecROM\ patchfile\x1A	MSX ExecROM patchfile
>0x12	ubyte/16	x		v%d
>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
@


