1b6cee71dSXin LI 2b6cee71dSXin LI#------------------------------------------------------------------------------ 3*ae316d1dSXin LI# $File: msx,v 1.12 2024/08/30 17:29:28 christos Exp $ 4b6cee71dSXin LI# msx: file(1) magic for the MSX Home Computer 5282e23f0SXin LI# v1.3 6b6cee71dSXin LI# Fabio R. Schmidlin <sd-snatcher@users.sourceforge.net> 7b6cee71dSXin LI 8b6cee71dSXin LI############## MSX Music file formats ############## 9b6cee71dSXin LI 10b6cee71dSXin LI# Gigamix MGSDRV music file 113e41d09dSXin LI0 string/b MGS MSX Gigamix MGSDRV3 music file, 12b6cee71dSXin LI>6 ubeshort 0x0D0A 13b6cee71dSXin LI>>3 byte x \bv%c 14b6cee71dSXin LI>>4 byte x \b.%c 15b6cee71dSXin LI>>5 byte x \b%c 16b6cee71dSXin LI>>8 string >\0 \b, title: %s 17b6cee71dSXin LI 183e41d09dSXin LI1 string/b mgs2\ MSX Gigamix MGSDRV2 music file 19b6cee71dSXin LI>6 uleshort 0x80 20b6cee71dSXin LI>>0x2E uleshort 0 21b6cee71dSXin LI>>>0x30 string >\0 \b, title: %s 22b6cee71dSXin LI 23b6cee71dSXin LI# KSS music file 243e41d09dSXin LI0 string/b KSCC KSS music file v1.03 25b6cee71dSXin LI>0xE byte 0 26b6cee71dSXin LI>>0xF byte&0x02 0 \b, soundchips: AY-3-8910, SCC(+) 27b6cee71dSXin LI>>0xF byte&0x02 2 \b, soundchip(s): SN76489 28b6cee71dSXin LI>>>0xF byte&0x04 4 stereo 29b6cee71dSXin LI>>0xF byte&0x01 1 \b, YM2413 30b6cee71dSXin LI>>0xF byte&0x08 8 \b, Y8950 31b6cee71dSXin LI 323e41d09dSXin LI0 string/b KSSX KSS music file v1.20 33b6cee71dSXin LI>0xE byte&0xEF 0 34b6cee71dSXin LI>>0xF byte&0x40 0x00 \b, 60Hz 35b6cee71dSXin LI>>0xF byte&0x40 0x40 \b, 50Hz 36b6cee71dSXin LI>>0xF byte&0x02 0 \b, soundchips: AY-3-8910, SCC(+) 37b6cee71dSXin LI>>0xF byte&0x02 0x02 \b, soundchips: SN76489 38b6cee71dSXin LI>>>0xF byte&0x04 0x04 stereo 39b6cee71dSXin LI>>0xF byte&0x01 0x01 \b, 40b6cee71dSXin LI>>>0xF byte&0x18 0x00 \bYM2413 41b6cee71dSXin LI>>>0xF byte&0x18 0x08 \bYM2413, Y8950 42b6cee71dSXin LI>>>0xF byte&0x18 0x18 \bYM2413+Y8950 pseudostereo 43b6cee71dSXin LI>>0xF byte&0x18 0x10 \b, Majyutsushi DAC 44b6cee71dSXin LI 45b6cee71dSXin LI# Moonblaster for Moonsound 463e41d09dSXin LI0 string/b MBMS 47b6cee71dSXin LI>4 byte 0x10 MSX Moonblaster for MoonSound music 48b6cee71dSXin LI 49b6cee71dSXin LI# Music Player K-kaz 503e41d09dSXin LI0 string/b MPK MSX Music Player K-kaz song 51b6cee71dSXin LI>6 ubeshort 0x0D0A 52b6cee71dSXin LI>>3 byte x v%c 53b6cee71dSXin LI>>4 byte x \b.%c 54b6cee71dSXin LI>>5 byte x \b%c 55b6cee71dSXin LI 56b6cee71dSXin LI# I don't know why these don't work 57b6cee71dSXin LI#0 search/0xFFFF \r\n.FM9 58b6cee71dSXin LI#>0 search/0xFFFF \r\n#FORMAT MSX Music Player K-kaz source MML file 59b6cee71dSXin LI#0 search/0xFFFF \r\nFM1\ \= 60b6cee71dSXin LI#>0 search/0xFFFF \r\nPSG1\= 61b6cee71dSXin LI#>>0 search/0xFFFF \r\nSCC1\= MSX MuSiCa MML source file 62b6cee71dSXin LI 63b6cee71dSXin LI# OPX Music file 64b6cee71dSXin LI0x35 beshort 0x0d0a 65b6cee71dSXin LI>0x7B beshort 0x0d0a 66b6cee71dSXin LI>>0x7D byte 0x1a 67b6cee71dSXin LI>>>0x87 uleshort 0 MSX OPX Music file 68b6cee71dSXin LI>>>>0x86 byte 0 v1.5 69b6cee71dSXin LI>>>>>0 string >\32 \b, title: %s 70b6cee71dSXin LI>>>>0x86 byte 1 v2.4 71b6cee71dSXin LI>>>>>0 string >\32 \b, title: %s 72b6cee71dSXin LI 73b6cee71dSXin LI# SCMD music file 743e41d09dSXin LI0x8B string/b SCMD 75b6cee71dSXin LI>0xCE uleshort 0 MSX SCMD Music file 76b6cee71dSXin LI#>>-2 uleshort 0x6a71 ; The file must end with this value. How to code this here? 77b6cee71dSXin LI>>0x8F string >\0 \b, title: %s 78b6cee71dSXin LI 79b6cee71dSXin LI0 search/0xFFFF \r\n@title 80b6cee71dSXin LI>&0 search/0xFFFF \r\n@m=[ MSX SCMD source MML file 81b6cee71dSXin LI 82b6cee71dSXin LI 83b6cee71dSXin LI############## MSX image file formats ############## 84b6cee71dSXin LI 85b6cee71dSXin LI# MSX raw VRAM dump 86b6cee71dSXin LI0 ubyte 0xFE 87b6cee71dSXin LI>1 uleshort 0 88b6cee71dSXin LI>>5 uleshort 0 89b6cee71dSXin LI>>>3 uleshort 0x37FF MSX SC2/GRP raw image 90b6cee71dSXin LI>>>3 uleshort 0x6A00 MSX Graph Saurus SR5 raw image 91b6cee71dSXin LI>>>3 uleshort >0x769E 92b6cee71dSXin LI>>>>3 uleshort <0x8000 MSX GE5/GE6 raw image 93b6cee71dSXin LI>>>>>3 uleshort 0x7FFF \b, with sprite patterns 94b6cee71dSXin LI>>>3 uleshort 0xD3FF MSX screen 7-12 raw image 95b6cee71dSXin LI>>>3 uleshort 0xD400 MSX Graph Saurus SR7/SR8/SRS raw image 96b6cee71dSXin LI 97b6cee71dSXin LI# Graph Saurus compressed images 98b6cee71dSXin LI0 ubyte 0xFD 99b6cee71dSXin LI>1 uleshort 0 100b6cee71dSXin LI>>5 uleshort 0 101b6cee71dSXin LI>>>3 uleshort >0x013D MSX Graph Saurus compressed image 102b6cee71dSXin LI 103b6cee71dSXin LI# MSX G9B image file 1043e41d09dSXin LI0 string/b G9B 105b6cee71dSXin LI>1 uleshort 11 106b6cee71dSXin LI>>3 uleshort >10 107b6cee71dSXin LI>>>5 ubyte >0 MSX G9B image, depth=%d 108b6cee71dSXin LI>>>>8 uleshort x \b, %dx 109b6cee71dSXin LI>>>>10 uleshort x \b%d 110b6cee71dSXin LI>>>>5 ubyte <9 111b6cee71dSXin LI>>>>>6 ubyte 0 112b6cee71dSXin LI>>>>>>7 ubyte x \b, codec=%d RGB color palettes 113b6cee71dSXin LI>>>>>6 ubyte 64 \b, codec=RGB fixed color 114b6cee71dSXin LI>>>>>6 ubyte 128 \b, codec=YJK 115b6cee71dSXin LI>>>>>6 ubyte 192 \b, codec=YUV 116b6cee71dSXin LI>>>>5 ubyte >8 codec=RGB fixed color 117b6cee71dSXin LI>>>>12 ubyte 0 \b, raw 118b6cee71dSXin LI>>>>12 ubyte 1 \b, bitbuster compression 119b6cee71dSXin LI 120b6cee71dSXin LI############## Other MSX file formats ############## 121b6cee71dSXin LI 122282e23f0SXin LI# MSX internal ROMs 123282e23f0SXin LI0 ubeshort 0xF3C3 124282e23f0SXin LI>2 uleshort <0x4000 125282e23f0SXin LI>>8 ubyte 0xC3 126282e23f0SXin LI>>>9 uleshort <0x4000 127282e23f0SXin LI>>>>0x0B ubeshort 0x00C3 128282e23f0SXin LI>>>>>0x0D uleshort <0x4000 129282e23f0SXin LI>>>>>>0x0F ubeshort 0x00C3 130282e23f0SXin LI>>>>>>>0x11 uleshort <0x4000 131282e23f0SXin LI>>>>>>>>0x13 ubeshort 0x00C3 132282e23f0SXin LI>>>>>>>>>0x15 uleshort <0x4000 133282e23f0SXin LI>>>>>>>>>>0x50 ubyte 0xC3 134282e23f0SXin LI>>>>>>>>>>>0x51 uleshort <0x4000 135282e23f0SXin LI>>>>>>>>>>>>(9.s) ubyte 0xC3 136282e23f0SXin LI>>>>>>>>>>>>>&0 uleshort >0x4000 137282e23f0SXin LI>>>>>>>>>>>>>>&0 ubyte 0xC3 MSX BIOS+BASIC 138282e23f0SXin LI>>>>>>>>>>>>>>>0x002D ubyte+1 <3 \b. version=MSX%d 139282e23f0SXin LI>>>>>>>>>>>>>>>0x002D ubyte 2 \b, version=MSX2+ 140282e23f0SXin LI>>>>>>>>>>>>>>>0x002D ubyte 3 \b, version=MSX Turbo-R 141282e23f0SXin LI>>>>>>>>>>>>>>>0x002D ubyte >3 \b, version=Unknown MSX %d version 14243a5ec4eSXin LI>>>>>>>>>>>>>>>0x0006 ubyte x \b, VDP.DR=%#2x 14343a5ec4eSXin LI>>>>>>>>>>>>>>>0x0007 ubyte x \b, VDP.DW=%#2x 144282e23f0SXin LI>>>>>>>>>>>>>>>0x002B ubyte&0xF 0 \b, charset=Japanese 145282e23f0SXin LI>>>>>>>>>>>>>>>0x002B ubyte&0xF 1 \b, charset=International 146282e23f0SXin LI>>>>>>>>>>>>>>>0x002B ubyte&0xF 2 \b, charset=Korean 147282e23f0SXin LI>>>>>>>>>>>>>>>0x002B ubyte&0xF >2 \b, charset=Unknown id:%d 148282e23f0SXin LI>>>>>>>>>>>>>>>0x002B ubyte&0x70 0x00 \b, date format=Y-M-D 149282e23f0SXin LI>>>>>>>>>>>>>>>0x002B ubyte&0x70 0x10 \b, date format=M-D-Y 150282e23f0SXin LI>>>>>>>>>>>>>>>0x002B ubyte&0x70 0x20 \b, date format=D-M-Y 151282e23f0SXin LI>>>>>>>>>>>>>>>0x002B ubyte&0x80 0x00 \b, vfreq=60Hz 152282e23f0SXin LI>>>>>>>>>>>>>>>0x002B ubyte&0x80 0x80 \b, vfreq=50Hz 153282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0x0F 0 \b, keyboard=Japanese 154282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0x0F 1 \b, keyboard=International 155282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0x0F 2 \b, keyboard=French 156282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0x0F 3 \b, keyboard=UK 157282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0x0F 4 \b, keyboard=German 158282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0x0F 5 \b, keyboard=Unknown id:%d 159282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0x0F 6 \b, keyboard=Spanish 160282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0x0F >6 \b, keyboard=Unknown id:%d 161282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0xF0 0x00 \b, basic=Japanese 162282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0xF0 0x10 \b, basic=International 163282e23f0SXin LI>>>>>>>>>>>>>>>0x002C ubyte&0xF0 >0x10 \b, basic=Unknown id:%d 164282e23f0SXin LI>>>>>>>>>>>>>>>0x002E ubyte&1 1 \b, built-in MIDI 165282e23f0SXin LI 166282e23f0SXin LI 167282e23f0SXin LI0 string/b CD 168282e23f0SXin LI>2 uleshort >0x10 169282e23f0SXin LI>>2 uleshort <0x4000 170282e23f0SXin LI>>>4 uleshort <0x4000 171282e23f0SXin LI>>>>6 uleshort <0x4000 172282e23f0SXin LI>>>>>8 ubyte 0xC3 173282e23f0SXin LI>>>>>>9 uleshort <0x4000 174282e23f0SXin LI>>>>>>>0x10 ubyte 0xC3 175282e23f0SXin LI>>>>>>>>0x11 uleshort <0x4000 176282e23f0SXin LI>>>>>>>>>0x14 ubyte 0xC3 177282e23f0SXin LI>>>>>>>>>>0x15 uleshort <0x4000 MSX2/2+/TR SubROM 178282e23f0SXin LI 179282e23f0SXin LI0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 180282e23f0SXin LI>0x5F0 ubequad 0x8282828244380000 181282e23f0SXin LI>>0x150 ubyte 0x38 182282e23f0SXin LI>>>0x170 string \20\20\20 183282e23f0SXin LI>>>>0x1E32 string ()) 184282e23f0SXin LI>>>>>0x2130 ubequad 0xA5A5594924231807 185282e23f0SXin LI>>>>>0x2138 ubequad 0x4A4A3424488830C0 MSX Kanji Font 186282e23f0SXin LI 187282e23f0SXin LI 188282e23f0SXin LI 189282e23f0SXin LI# MSX extension ROMs 1903e41d09dSXin LI0 string/b AB 191b6cee71dSXin LI>2 uleshort 0x0010 MSX ROM 19243a5ec4eSXin LI>>2 uleshort x \b, init=%#4x 19343a5ec4eSXin LI>>4 uleshort >0 \b, stahdl=%#4x 19443a5ec4eSXin LI>>6 uleshort >0 \b, devhdl=%#4x 19543a5ec4eSXin LI>>8 uleshort >0 \b, bas=%#4x 196b6cee71dSXin LI>2 uleshort 0x4010 MSX ROM 19743a5ec4eSXin LI>>2 uleshort x \b, init=%#04x 19843a5ec4eSXin LI>>4 uleshort >0 \b, stahdl=%#04x 19943a5ec4eSXin LI>>6 uleshort >0 \b, devhdl=%#04x 20043a5ec4eSXin LI>>8 uleshort >0 \b, bas=%#04x 201b6cee71dSXin LI>2 uleshort 0x8010 MSX ROM 20243a5ec4eSXin LI>>2 uleshort x \b, init=%#04x 20343a5ec4eSXin LI>>4 uleshort >0 \b, stahdl=%#04x 20443a5ec4eSXin LI>>6 uleshort >0 \b, devhdl=%#04x 20543a5ec4eSXin LI>>8 uleshort >0 \b, bas=%#04x 206b6cee71dSXin LI#>2 string 5JSuperLAYDOCK MSX Super Laydock ROM 207b6cee71dSXin LI#>3 string @HYDLIDE3MSX MSX Hydlide-3 ROM 208b6cee71dSXin LI#>3 string @3\x80IA862 Golvellius MSX1 ROM 209282e23f0SXin LI>2 uleshort >15 210282e23f0SXin LI>>2 uleshort <0xC000 211282e23f0SXin LI>>>8 string \0\0\0\0\0\0\0\0 212282e23f0SXin LI>>>>(2.s&0x3FFF) uleshort >0 MSX ROM 213282e23f0SXin LI>>>>>0x10 string YZ\0\0\0\0 Konami Game Master 2 MSX ROM 214282e23f0SXin LI>>>>>0x10 string CD \b, Konami RC- 215282e23f0SXin LI>>>>>>0x12 ubyte x \b%d 216282e23f0SXin LI>>>>>>0x13 ubyte/16 x \b%d 217282e23f0SXin LI>>>>>>0x13 ubyte&0xF x \b%d 218282e23f0SXin LI>>>>>0x10 string EF \b, Konami RC- 219282e23f0SXin LI>>>>>>0x12 ubyte x \b%d 220282e23f0SXin LI>>>>>>0x13 ubyte/16 x \b%d 221282e23f0SXin LI>>>>>>0x13 ubyte&0xF x \b%d 22243a5ec4eSXin LI>>>>>2 uleshort x \b, init=%#04x 22343a5ec4eSXin LI>>>>>4 uleshort >0 \b, stahdl=%#04x 22443a5ec4eSXin LI>>>>>6 uleshort >0 \b, devhdl=%#04x 22543a5ec4eSXin LI>>>>>8 uleshort >0 \b, bas=%#04x 226282e23f0SXin LI>>>2 uleshort 0 227282e23f0SXin LI>>>>4 uleshort 0 228282e23f0SXin LI>>>>>6 uleshort 0 22943a5ec4eSXin LI>>>>>>8 uleshort >0 MSX BASIC program in ROM, bas=%#04x 230b6cee71dSXin LI 231*ae316d1dSXin LI0 string/b AB\0\0 232*ae316d1dSXin LI>6 uleshort 0 233*ae316d1dSXin LI>>4 uleshort >0x400F MSX-BASIC extension ROM 234*ae316d1dSXin LI>>>4 uleshort >0 \b, stahdl=%#04x 235*ae316d1dSXin LI>>>6 uleshort >0 \b, devhdl=%#04x 236*ae316d1dSXin LI>>>0x1C string OPLL \b, MSX-Music 237*ae316d1dSXin LI>>>>0x18 string PAC2 \b (external) 238*ae316d1dSXin LI>>>>0x18 string APRL \b (internal) 239*ae316d1dSXin LI 240*ae316d1dSXin LI0 string/b AB\0\0\0\0 241*ae316d1dSXin LI>6 uleshort >0x400F MSX device BIOS 242*ae316d1dSXin LI>>6 uleshort >0 \b, devhdl=%#04x 243*ae316d1dSXin LI 244*ae316d1dSXin LI 245*ae316d1dSXin LI 2463e41d09dSXin LI0x4000 string/b AB 247282e23f0SXin LI>0x4002 uleshort >0x400F 248282e23f0SXin LI>>0x400A string \0\0\0\0\0\0 MSX ROM with nonstandard page order 24943a5ec4eSXin LI>>>0x4002 uleshort x \b, init=%#04x 25043a5ec4eSXin LI>>>0x4004 uleshort >0 \b, stahdl=%#04x 25143a5ec4eSXin LI>>>0x4006 uleshort >0 \b, devhdl=%#04x 25243a5ec4eSXin LI>>>0x4008 uleshort >0 \b, bas=%#04x 253b6cee71dSXin LI 2543e41d09dSXin LI0x8000 string/b AB 255282e23f0SXin LI>0x8002 uleshort >0x400F 256282e23f0SXin LI>>0x800A string \0\0\0\0\0\0 MSX ROM with nonstandard page order 25743a5ec4eSXin LI>>>0x8002 uleshort x \b, init=%#04x 25843a5ec4eSXin LI>>>0x8004 uleshort >0 \b, stahdl=%#04x 25943a5ec4eSXin LI>>>0x8006 uleshort >0 \b, devhdl=%#04x 26043a5ec4eSXin LI>>>0x8008 uleshort >0 \b, bas=%#04x 261b6cee71dSXin LI 262b6cee71dSXin LI 263282e23f0SXin LI0x3C000 string/b AB 264282e23f0SXin LI>0x3C008 string \0\0\0\0\0\0\0\0 MSX MegaROM with nonstandard page order 26543a5ec4eSXin LI>>0x3C002 uleshort x \b, init=%#04x 26643a5ec4eSXin LI>>0x3C004 uleshort >0 \b, stahdl=%#04x 26743a5ec4eSXin LI>>0x3C006 uleshort >0 \b, devhdl=%#04x 26843a5ec4eSXin LI>>0x3C008 uleshort >0 \b, bas=%#04x 269b6cee71dSXin LI 270b6cee71dSXin LI# MSX BIN file 271b6cee71dSXin LI#0 byte 0xFE 272b6cee71dSXin LI#>1 uleshort >0x8000 273b6cee71dSXin LI#>>3 uleshort >0x8004 274b6cee71dSXin LI#>>>5 uleshort >0x8000 MSX BIN file 275b6cee71dSXin LI 276b6cee71dSXin LI# MSX-BASIC file 277b6cee71dSXin LI0 byte 0xFF 278b6cee71dSXin LI>3 uleshort 0x000A 279b6cee71dSXin LI>>1 uleshort >0x8000 MSX-BASIC program 280b6cee71dSXin LI 281b6cee71dSXin LI# MSX .CAS file 282282e23f0SXin LI0 string/b \x1F\xA6\xDE\xBA\xCC\x13\x7D\x74 MSX cassette archive 283b6cee71dSXin LI 284b6cee71dSXin LI# Mega-Assembler file 285b6cee71dSXin LI0 byte 0xFE 286b6cee71dSXin LI>1 uleshort 0x0001 287b6cee71dSXin LI>>5 uleshort 0xffff 288b6cee71dSXin LI>>>6 byte 0x0A MSX Mega-Assembler source 289b6cee71dSXin LI 290b6cee71dSXin LI# Execrom Patchfile 291b6cee71dSXin LI0 string ExecROM\ patchfile\x1A MSX ExecROM patchfile 292b6cee71dSXin LI>0x12 ubyte/16 x v%d 293b6cee71dSXin LI>0x12 ubyte&0xF x \b.%d 294b6cee71dSXin LI>0x13 ubyte x \b, contains %d patches 295b6cee71dSXin LI 296b6cee71dSXin LI# Konami's King's Valley-2 custom stage (ELG file) 297b6cee71dSXin LI4 uleshort 0x0900 298b6cee71dSXin LI>0xF byte 1 299b6cee71dSXin LI>>0x14 byte 0 30040427ccaSGordon Tetlow>>>0x1E string \040\040\040 301b6cee71dSXin LI>>>>0x23 byte 1 302b6cee71dSXin LI>>>>>0x25 byte 0 303b6cee71dSXin LI>>>>>>0x15 string >\x30 304b6cee71dSXin LI>>>>>>>0x15 string <\x5A Konami King's Valley-2 custom stage, title: "%-8.8s" 305b6cee71dSXin LI>>>>>>>>0x1D byte <32 \b, theme: %d 306b6cee71dSXin LI 307b6cee71dSXin LI# Metal Gear 1 savegame 308b6cee71dSXin LI#0x4F string \x00\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF 309b6cee71dSXin LI#>>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 310b6cee71dSXin LI#>>>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