1 1.1 christos 2 1.1 christos #------------------------------------------------------------------------------ 3 1.1.1.5 christos # $File: spectrum,v 1.10 2023/05/08 01:33:36 christos Exp $ 4 1.1 christos # spectrum: file(1) magic for Spectrum emulator files. 5 1.1 christos # 6 1.1 christos # John Elliott <jce (a] seasip.demon.co.uk> 7 1.1 christos 8 1.1 christos # 9 1.1 christos # Spectrum +3DOS header 10 1.1 christos # 11 1.1 christos 0 string PLUS3DOS\032 Spectrum +3 data 12 1.1 christos >15 byte 0 - BASIC program 13 1.1 christos >15 byte 1 - number array 14 1.1 christos >15 byte 2 - character array 15 1.1 christos >15 byte 3 - memory block 16 1.1 christos >>16 belong 0x001B0040 (screen) 17 1.1 christos >15 byte 4 - Tasword document 18 1.1 christos >15 string TAPEFILE - ZXT tapefile 19 1.1 christos # 20 1.1 christos # Tape file. This assumes the .TAP starts with a Spectrum-format header, 21 1.1 christos # which nearly all will. 22 1.1 christos # 23 1.1.1.2 christos # Update: Sanity-check string contents to be printable. 24 1.1.1.2 christos # -Adam Buchbinder <adam.buchbinder (a] gmail.com> 25 1.1.1.5 christos # Update: Joerg Jenderek 2023 May 26 1.1.1.5 christos # URL: http://fileformats.archiveteam.org/wiki/TAP_(ZX_Spectrum) 27 1.1.1.5 christos # Reference: http://web.archive.org/web/20110711141601/http://www.zxmodules.de/fileformats/tapformat.html 28 1.1.1.5 christos # http://mark0.net/download/triddefs_xml.7z/defs/t/tap-zx.trid.xml 29 1.1.1.5 christos # Note: called "ZX Spectrum Tape image" by TrID and "TAP (ZX Spectrum)" by DROID via PUID fmt/801 30 1.1.1.5 christos # verified by fuse-emulator-utils `tzxlist EXAMPLES.TAP` 31 1.1.1.2 christos # 32 1.1.1.5 christos # headers length 19=023 and flag byte 0 indicating a standard ROM loading header 33 1.1.1.2 christos 0 string \023\000\000 34 1.1.1.2 christos >4 string >\0 35 1.1.1.5 christos # skip {85CEE8D6-0F90-4492-B484-98E38862B28D}.2.ver0x0000000000000004.db {DDF571F2-BE98-426D-8288-1A9A39C3FDA2}.2.ver0x0000000000000001.db 36 1.1.1.5 christos # inside c:\ProgramData\Microsoft\Windows\Caches according to TrID and DROID 37 1.1.1.5 christos >>23 ubyte =0xFF 38 1.1.1.5 christos # skip DROID fmt-801-signature-id-1166.tap with invalid name \253\253\253\253\253\253\253\253\253\253 39 1.1.1.5 christos # which looks like: "TF COPY II" "screen " "\023\001TF" " 1943 " 40 1.1.1.5 christos >>>4 string <\177 Spectrum .TAP data "%-10.10s" 41 1.1.1.5 christos #!:mime application/octet-stream 42 1.1.1.5 christos !:mime application/x-spectrum-tap 43 1.1.1.5 christos !:ext tap 44 1.1.1.5 christos >>>>3 byte 0 - BASIC program 45 1.1.1.5 christos # autostart line; 0..9999 are valid; 32768 means "no auto-loading" 46 1.1.1.5 christos >>>>>16 uleshort x \b, autostart line %u 47 1.1.1.5 christos # program length; length of BASIC program 48 1.1.1.5 christos >>>>>18 uleshort x \b, program length %u 49 1.1.1.5 christos >>>>3 byte 1 - number array 50 1.1.1.5 christos >>>>3 byte 2 - character array 51 1.1.1.5 christos >>>>3 byte 3 - memory block 52 1.1.1.5 christos # length of the following data 1B00h=6912 and start address 4000h=16384 in case of a SCREEN$ header 53 1.1.1.5 christos >>>>>14 belong 0x001B0040 (screen) 54 1.1.1.5 christos # unused 32768=8000h 55 1.1.1.5 christos >>>>>18 uleshort !32768 \b, unused %u 56 1.1.1.5 christos # zxlength; length of the following data after the header 57 1.1.1.5 christos >>>>14 uleshort x \b, data length %u 58 1.1.1.5 christos #>>14 uleshort x \b, data length %#x 59 1.1.1.5 christos # checksum byte; simply all bytes (including flag byte) XORed 60 1.1.1.5 christos #>>>>20 ubyte x \b, checksum %#x 61 1.1 christos 62 1.1 christos # The following three blocks are from pak21-spectrum (a] srcf.ucam.org 63 1.1 christos # TZX tape images 64 1.1.1.5 christos # Update: Joerg Jenderek 2023 May 65 1.1.1.5 christos # URL: http://fileformats.archiveteam.org/wiki/TZX 66 1.1.1.5 christos # Reference: https://worldofspectrum.net/TZXformat.html 67 1.1.1.5 christos # http://mark0.net/download/triddefs_xml.7z/defs/t/tzx.trid.xml 68 1.1.1.5 christos # Note: called "ZX Spectrum Tape image" by TrID and "TZX Format" by DROID via PUID fmt/1000 69 1.1 christos 0 string ZXTape!\x1a Spectrum .TZX data 70 1.1.1.5 christos #!:mime application/octet-stream 71 1.1.1.5 christos !:mime application/x-spectrum-tzx 72 1.1.1.5 christos # CDT is used for Amstrad tapes 73 1.1.1.5 christos !:ext tzx/cdt 74 1.1 christos >8 byte x version %d 75 1.1 christos >9 byte x \b.%d 76 1.1.1.5 christos # ID of first block 77 1.1.1.5 christos >10 ubyte x \b; ID %#x 78 1.1.1.5 christos # turbo speed data block 79 1.1.1.5 christos >10 ubyte =0x11 (turbo) 80 1.1.1.5 christos # length of PILOT tone (number of pulses) 81 1.1.1.5 christos >>21 uleshort x \b, %u pilot pulses 82 1.1.1.5 christos # length of PILOT pulse 83 1.1.1.5 christos >>11 uleshort x with %u tstates 84 1.1.1.5 christos # length of SYNC first pulse 85 1.1.1.5 christos >>13 uleshort x \b, %u and 86 1.1.1.5 christos # length of SYNC second pulse 87 1.1.1.5 christos >>15 uleshort x %u sync tstates 88 1.1.1.5 christos # length of ZERO bit pulse 89 1.1.1.5 christos >>17 uleshort x \b, %u zero tstates 90 1.1.1.5 christos # length of ONE bit pulse 91 1.1.1.5 christos >>19 uleshort x \b, %u one tstates 92 1.1.1.5 christos # used bits in the last byte 93 1.1.1.5 christos >>23 ubyte x \b, use %u bit 94 1.1.1.5 christos # plural s 95 1.1.1.5 christos >>23 ubyte >1 \bs 96 1.1.1.5 christos # pause after this block in milliseconds 97 1.1.1.5 christos >>24 uleshort x \b, %u ms pause 98 1.1.1.5 christos # BYTE[3]; length of data that follow 99 1.1.1.5 christos >>26 ulelong&0x00FFffFF x \b, %u data bytes 100 1.1.1.5 christos >10 ubyte =0x20 (pause) 101 1.1.1.5 christos # pause duration in milliseconds 102 1.1.1.5 christos >>11 uleshort x %u ms 103 1.1.1.5 christos # text description 104 1.1.1.5 christos >10 ubyte =0x30 (text) 105 1.1.1.5 christos # length of the text description 106 1.1.1.5 christos #>>11 ubyte x L=%u 107 1.1.1.5 christos >>11 pstring x "%s" 108 1.1.1.5 christos # archive text description in ASCII format 109 1.1.1.5 christos >10 ubyte =0x32 (archive info) 110 1.1.1.5 christos # length of archive text 111 1.1.1.5 christos >>11 uleshort x \b, %#x bytes 112 1.1.1.5 christos # number of text strings 113 1.1.1.5 christos >>13 ubyte x with %u (type) text parts 114 1.1.1.5 christos # text type identification byte: 0~title 1~publisher 2~author 3~year 4~language 5~type 6~price 7~protection 8~origin ff~comment 115 1.1.1.5 christos >>14 byte <9 (%d) 116 1.1.1.5 christos >>>14 byte >-2 117 1.1.1.5 christos # length of text string 118 1.1.1.5 christos #>>>>15 ubyte x L=%u 119 1.1.1.5 christos >>>>15 pstring x %s 120 1.1.1.5 christos # 2nd possible text description 121 1.1.1.5 christos >>>>>&0 byte <9 (%d) 122 1.1.1.5 christos >>>>>>&-1 byte >-2 123 1.1.1.5 christos >>>>>>>&0 pstring x %s 124 1.1.1.5 christos # 3rd possible text description 125 1.1.1.5 christos >>>>>>>>&0 byte <9 (%d) 126 1.1.1.5 christos >>>>>>>>>&-1 byte >-2 127 1.1.1.5 christos >>>>>>>>>>&0 pstring x %s 128 1.1.1.5 christos # 4th possible text description 129 1.1.1.5 christos >>>>>>>>>>>&0 byte <9 (%d) 130 1.1.1.5 christos >>>>>>>>>>>>&-1 byte >-2 131 1.1.1.5 christos >>>>>>>>>>>>>&0 pstring x %s 132 1.1.1.5 christos # 5th possible text description 133 1.1.1.5 christos >>>>>>>>>>>>>>&0 byte <9 (%d) 134 1.1.1.5 christos >>>>>>>>>>>>>>>&-1 byte >-2 135 1.1.1.5 christos >>>>>>>>>>>>>>>>&0 pstring x %s 136 1.1.1.5 christos # 6th possible text description 137 1.1.1.5 christos >>>>>>>>>>>>>>>>>&0 byte <9 (%d) 138 1.1.1.5 christos >>>>>>>>>>>>>>>>>>&-1 byte >-2 139 1.1.1.5 christos >>>>>>>>>>>>>>>>>>>&0 pstring x %s 140 1.1.1.5 christos # 7th possible text description 141 1.1.1.5 christos >>>>>>>>>>>>>>>>>>>>&0 byte <9 (%d) 142 1.1.1.5 christos >>>>>>>>>>>>>>>>>>>>>&-1 byte >-2 143 1.1.1.5 christos >>>>>>>>>>>>>>>>>>>>>>&0 pstring x %s 144 1.1 christos 145 1.1 christos # RZX input recording files 146 1.1 christos 0 string RZX! Spectrum .RZX data 147 1.1 christos >4 byte x version %d 148 1.1 christos >5 byte x \b.%d 149 1.1 christos 150 1.1 christos # Floppy disk images 151 1.1 christos 0 string MV\ -\ CPCEMU\ Disk-Fil Amstrad/Spectrum .DSK data 152 1.1 christos 0 string MV\ -\ CPC\ format\ Dis Amstrad/Spectrum DU54 .DSK data 153 1.1 christos 0 string EXTENDED\ CPC\ DSK\ Fil Amstrad/Spectrum Extended .DSK data 154 1.1 christos 0 string SINCLAIR Spectrum .SCL Betadisk image 155 1.1 christos 156 1.1 christos # Hard disk images 157 1.1 christos 0 string RS-IDE\x1a Spectrum .HDF hard disk image 158 1.1.1.4 christos >7 byte x \b, version %#02x 159 1.1.1.3 christos 160 1.1.1.3 christos # SZX snapshots (fuse and spectaculator) 161 1.1.1.3 christos # Martin M. S. Pedersen <martin (a] linux.com> 162 1.1.1.3 christos # http://www.spectaculator.com/docs/zx-state/header.shtml 163 1.1.1.3 christos # 164 1.1.1.3 christos 0 string ZXST zx-state snapshot 165 1.1.1.3 christos >4 byte x version %d 166 1.1.1.3 christos >5 byte x \b.%d 167 1.1.1.3 christos >>6 byte 0 16k ZX Spectrum 168 1.1.1.3 christos >>6 byte 1 48k ZX Spectrum/ZX Spectrum+ 169 1.1.1.3 christos >>6 byte 2 ZX Spectrum 128 170 1.1.1.3 christos >>6 byte 3 ZX Spectrum +2 171 1.1.1.3 christos >>6 byte 4 ZX Spectrum +2A/+2B 172 1.1.1.3 christos >>6 byte 5 ZX Spectrum +3 173 1.1.1.3 christos >>6 byte 6 ZX Spectrum +3e 174 1.1.1.3 christos >>6 byte 7 Pentagon 128 175 1.1.1.3 christos >>6 byte 8 Timex Sinclair TC2048 176 1.1.1.3 christos >>6 byte 9 Timex Sinclair TC2068 177 1.1.1.3 christos >>6 byte 10 Scorpion ZS-256 178 1.1.1.3 christos >>6 byte 11 ZX Spectrum SE 179 1.1.1.3 christos >>6 byte 12 Timex Sinclair TS2068 180 1.1.1.3 christos >>6 byte 13 Pentagon 512 181 1.1.1.3 christos >>6 byte 14 Pentagon 1024 182 1.1.1.3 christos >>6 byte 15 48k ZX Spectrum (NTSC) 183 1.1.1.3 christos >>6 byte 16 ZX Spectrum 12Ke 184 1.1.1.3 christos >>>7 byte 1 (alternate timings) 185