xref: /freebsd/contrib/file/magic/Magdir/c64 (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
1
2#------------------------------------------------------------------------------
3# $File: c64,v 1.14 2023/06/16 19:24:06 christos Exp $
4# c64:  file(1) magic for various commodore 64 related files
5#
6# From: Dirk Jagdmann <doj@cubic.org>
7
80x16500	belong		0x12014100	D64 Image
90x16500	belong		0x12014180	D71 Image
100x61800 belong		0x28034400	D81 Image
110	belong		0x43154164	X64 Image
12
13# C64 (and other CBM) cartridges
14# Extended by David Korth <gerbilsoft@gerbilsoft.com>
15# Reference: https://vice-emu.sourceforge.io/vice_17.html#SEC391
16
170	string		C64\40CARTRIDGE	Commodore 64 cartridge
18>0x20	ubyte	0	\b,
19>0x20	ubyte	!0
20>>0x20	string/T	x	\b: "%.32s",
21>0x16	beshort	0
22>>0x18	beshort	0x0000	16 KB game
23>>0x18	beshort	0x0001	8 KB game
24>>0x18	beshort	0x0100	UltiMax mode
25>>0x18	beshort	0x0101	RAM/disabled
26>0x16	beshort	1	Action Replay
27>0x16	beshort	2	KCS Power Cartridge
28>0x16	beshort	3	Final Cartridge III
29>0x16	beshort	4	Simons' BASIC
30>0x16	beshort	5	Ocean type 1
31>0x16	beshort	6	Expert Cartridge
32>0x16	beshort	7	Fun Play, Power Play
33>0x16	beshort	8	Super Games
34>0x16	beshort	9	Atomic Power
35>0x16	beshort	10	Epyx Fastload
36>0x16	beshort	11	Westermann Learning
37>0x16	beshort	12	Rex Utility
38>0x16	beshort	13	Final Cartridge I
39>0x16	beshort	14	Magic Formel
40>0x16	beshort	15	C64 Game System, System 3
41>0x16	beshort	16	Warp Speed
42>0x16	beshort	17	Dinamic
43>0x16	beshort	18	Zaxxon / Super Zaxxon (Sega)
44>0x16	beshort	19	Magic Desk, Domark, HES Australia
45>0x16	beshort	20	Super Snapshot V5
46>0x16	beshort	21	Comal-80
47>0x16	beshort	22	Structured BASIC
48>0x16	beshort	23	Ross
49>0x16	beshort	24	Dela EP64
50>0x16	beshort	25	Dela EP7x8
51>0x16	beshort	26	Dela EP256
52>0x16	beshort	27	Rex EP256
53>0x16	beshort	28	Mikro Assembler
54>0x16	beshort	29	Final Cartridge Plus
55>0x16	beshort	30	Action Replay 4
56>0x16	beshort	31	Stardos
57>0x16	beshort	32	EasyFlash
58>0x16	beshort	33	EasyFlash Xbank
59>0x16	beshort	34	Capture
60>0x16	beshort	35	Action Replay 3
61>0x16	beshort	36
62>>0x1A	ubyte	1	Nordic Replay
63>>0x1A	ubyte	!1	Retro Replay
64>0x16	beshort	37	MMC64
65>0x16	beshort	38	MMC Replay
66>0x16	beshort	39	IDE64
67>0x16	beshort	40	Super Snapshot V4
68>0x16	beshort	41	IEEE-488
69>0x16	beshort	42	Game Killer
70>0x16	beshort	43	Prophet64
71>0x16	beshort	44	EXOS
72>0x16	beshort	45	Freeze Frame
73>0x16	beshort	46	Freeze Machine
74>0x16	beshort	47	Snapshot64
75>0x16	beshort	48	Super Explode V5.0
76>0x16	beshort	49	Magic Voice
77>0x16	beshort	50	Action Replay 2
78>0x16	beshort	51	MACH 5
79>0x16	beshort	52	Diashow-Maker
80>0x16	beshort	53	Pagefox
81>0x16	beshort	54	Kingsoft
82>0x16	beshort	55	Silverrock 128K Cartridge
83>0x16	beshort	56	Formel 64
84>0x16	beshort	57
85>>0x1A	ubyte	1	Hucky
86>>0x1A	ubyte	!1	RGCD
87>0x16	beshort	58	RR-Net MK3
88>0x16	beshort	59	EasyCalc
89>0x16	beshort	60	GMod2
90>0x16	beshort	61	MAX Basic
91>0x16	beshort	62	GMod3
92>0x16	beshort	63	ZIPP-CODE 48
93>0x16	beshort	64	Blackbox V8
94>0x16	beshort	65	Blackbox V3
95>0x16	beshort	66	Blackbox V4
96>0x16	beshort	67	REX RAM-Floppy
97>0x16	beshort	68	BIS-Plus
98>0x16	beshort	69	SD-BOX
99>0x16	beshort	70	MultiMAX
100>0x16	beshort	71	Blackbox V9
101>0x16	beshort	72	Lt. Kernal Host Adaptor
102>0x16	beshort	73	RAMLink
103>0x16	beshort	74	H.E.R.O.
104>0x16	beshort	75	IEEE Flash! 64
105>0x16	beshort	76	Turtle Graphics II
106>0x16	beshort	77	Freeze Frame MK2
107
1080	string		C128\40CARTRIDGE	Commodore 128 cartridge
109>0x20	ubyte	0	\b,
110>0x20	ubyte	!0
111>>0x20	string/T	x	\b: "%.32s",
112>0x16	beshort	0	generic cartridge
113>0x16	beshort	1	Warpspeed128
114>>0x1A	ubyte	1	\b, REU support
115>>0x1A	ubyte	2	\b, REU support, with I/O and ROM banking
116
1170	string		CBM2\40CARTRIDGE	Commodore CBM-II cartridge
118>0x20	ubyte	!0
119>>0x20	string/T	x	\b: "%.32s"
120
1210	string		VIC20\40CARTRIDGE	Commodore VIC-20 cartridge
122>0x20	ubyte	0	\b,
123>0x20	ubyte	!0
124>>0x20	string/T	x	\b: "%.32s",
125>0x16	beshort	0	generic cartridge
126>0x16	beshort	1	Mega-Cart
127>0x16	beshort	2	Behr Bonz
128>0x16	beshort	3	Vic Flash Plugin
129>0x16	beshort	4	UltiMem
130>0x16	beshort	5	Final Expansion
131
1320	string		PLUS4\40CARTRIDGE	Commodore 16/Plus4 cartridge
133>0x20	ubyte	!0
134>>0x20	string/T	x	\b: "%.32s"
135
136
137# DreamLoad archives see:
138# https://www.lemon64.com/forum/viewtopic.php?t=37415\
139# &sid=494dc2ca91289e05dadf80a7f8a968fe (at the bottom).
140# https://www.c64-wiki.com/wiki/DreamLoad.
141# Example HVSC Commodore 64 music collection:
142# https://kohina.duckdns.org/HVSC/C64Music/10_Years_HVSC.dfi
143
1440	byte	0
145>1	string	DREAMLOAD\40FILE\40ARCHIVE
146>>0x17	byte	0	DFI Image
147>>>0x1a	leshort	x	version: %d.
148>>>0x18	leshort	x	\b%d
149>>>0x1c	lelong	x	tracks: %d
150
1510	string		GCR-1541	GCR Image
152>8	byte		x		version: %i
153>9	byte		x		tracks: %i
154
1559	string		PSUR		ARC archive (c64)
1562	string		-LH1-		LHA archive (c64)
157
1580	string		C64File		PC64 Emulator file
159>8	string		>\0		"%s"
1600	string		C64Image	PC64 Freezer Image
161
1620	beshort		0x38CD		C64 PCLink Image
1630	string		CBM\144\0\0	Power 64 C64 Emulator Snapshot
164
1650	belong		0xFF424CFF	WRAptor packer (c64)
166
1670	string		C64S\x20tape\x20file	T64 tape Image
168>32	leshort		x		Version:%#x
169>36	leshort		!0		Entries:%i
170>40	string		x		Name:%.24s
171
1720	string		C64\x20tape\x20image\x20file\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0	T64 tape Image
173>32	leshort		x		Version:%#x
174>36	leshort		!0		Entries:%i
175>40	string		x		Name:%.24s
176
1770	string		C64S\x20tape\x20image\x20file\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0	T64 tape Image
178>32	leshort		x		Version:%#x
179>36	leshort		!0		Entries:%i
180>40	string		x		Name:%.24s
181
182# Raw tape file format (.tap files)
183# Esa Hyyti <esa@netlab.tkk.fi>
1840	string		C64-TAPE-RAW	C64 Raw Tape File (.tap),
185>0x0c	byte		x		Version:%u,
186>0x10	lelong		x		Length:%u cycles
187
188# magic for Goattracker2, http://covertbitops.c64.org/
189# from Alex Myczko <alex@aiei.ch>
1900	string		GTS5		GoatTracker 2 song
191>4	string		>\0		\b, "%s"
192>36	string		>\0		\b by %s
193>68	string		>\0		\b (C) %s
194>100	byte		>0		\b, %u subsong(s)
195
196# CBM BASIC (cc65 compiled)
197# Summary:	binary executable or Basic program for Commodore C64 computers
198# Update:	Joerg Jenderek
199# URL:		http://fileformats.archiveteam.org/wiki/Commodore_BASIC_tokenized_file
200# Reference:	https://www.c64-wiki.com/wiki/BASIC_token
201#		https://github.com/thezerobit/bastext/blob/master/bastext.doc
202#		http://mark0.net/download/triddefs_xml.7z/defs/p/prg-c64.trid.xml
203# TODO:		unify Commodore BASIC/program sub routines
204# Note:		"PUCrunch archive data" moved from ./archive and merged with c64-exe
2050	leshort		0x0801
206# display Commodore C64 BASIC program (strength=50) after "Lynx archive" (strength=330) handled by ./archive
207#!:strength +0
208# if first token is not SYS this implies BASIC program in most cases
209>6		ubyte		!0x9e
210# but sELF-ExTRACTING-zIP executable unzp6420.prg contains SYS token at end of second BASIC line (at 0x35)
211>>23		search/30	\323ELF-E\330TRACTING-\332IP
212>>>0		use		c64-exe
213>>23		default		x
214>>>0		use		c64-prg
215# if first token is SYS this implies binary executable
216>6		ubyte		=0x9e
217>>0		use		c64-exe
218# display information about C64 binary executable (memory address, line number, token)
2190	name	c64-exe
220>0		uleshort	x	Commodore C64
221# http://a1bert.kapsi.fi/Dev/pucrunch/
222# start address 0801h; next offset 080bh; BASIC line number is 239=00EFh; BASIC instruction is SYS 2061
223# the above combination appartly also occur for other Commodore programs like: gunzip111.c64.prg
224# and there exist PUCrunch archive for other machines like C16 with other magics
225>0		string	\x01\x08\x0b\x08\xef\x00\x9e\x32\x30\x36\x31	program, probably PUCrunch archive data
226!:mime	application/x-compress-pucrunch
227!:ext	prg/pck
228>0		string	!\x01\x08\x0b\x08\xef\x00\x9e\x32\x30\x36\x31	program
229!:mime	application/x-commodore-exec
230!:ext	prg/
231# start address like: 801h
232>0		uleshort	!0x0801	\b, start address %#4.4x
233# 1st BASIC fragment
234>2		use		basic-line
235# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
236>(2.s-0x800)	ubyte		x
237>>&-1		ubyte		!0	\b, no EOL=%#x
238# valid 2nd BASIC fragment found only in sELF-ExTRACTING-zIP executable unzp6420.prg
239>>23		search/30	\323ELF-E\330TRACTING-\332IP
240# jump again from beginning
241>>>(2.s-0x800)	ubyte		x
242>>>>&0		use		basic-line
243# Zero-byte marking the end of the BASIC line
244>-3		ubyte		!0	\b, 3 last bytes %#2.2x
245# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
246>>-2		ubeshort	x	\b%4.4x
247# display information about tokenized C64 BASIC program (memory address, line number, token)
2480	name	c64-prg
249>0		uleshort	x	Commodore C64 BASIC program
250!:mime	application/x-commodore-basic
251# Tokenized BASIC programs were stored by Commodore as file type program "PRG" in separate field in directory structures.
252# So file name can have no suffix like in saveroms; When transferring to other platforms, they are often saved with .prg extensions.
253# BAS suffix is typically used for the BASIC source but also found in program pods.bas
254!:ext	prg/bas/
255# start address like: 801h
256>0		uleshort	!0x0801	\b, start address %#4.4x
257# 1st BASIC fragment
258>2		use		basic-line
259# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
260>(2.s-0x0800)	ubyte		x
261>>&-1		ubyte		!0	\b, no EOL=%#x
262# 2nd BASIC fragment
263>>&0		use		basic-line
264# zero-byte marking the end of the BASIC line
265>-3		ubyte		!0	\b, 3 last bytes %#2.2x
266# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
267>>-2		ubeshort	x	\b%4.4x
268# Summary:	binary executable or Basic program for Commodore C128 computers
269# URL:		https://en.wikipedia.org/wiki/Commodore_128
270# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/prg-c128.trid.xml
271# From:		Joerg Jenderek
272# Note:		Commodore 128 BASIC 7.0 variant; there exist varaints with different start addresses
2730		leshort		0x1C01
274!:strength	+1
275# GRR: line above with strength 51 (50+1) is too generic because it matches SVr3 curses screen image, big-endian with strength (50) handled by ./terminfo
276# probably skip SVr3 curses images with "invalid high" second line offset
277>2		uleshort	<0x1D02
278# skip foo with "invalid low" second line offset
279>>2		uleshort	>0x1C06
280# if first token is not SYS this implies BASIC program
281>>>6		ubyte		!0x9e
282>>>>0			use	c128-prg
283# if first token is SYS this implies binary executable
284>>>6		ubyte		=0x9e
285>>>>0		use		c128-exe
286# Summary:	binary executable or Basic program for Commodore C128 computers
287# Note:		Commodore 128 BASIC 7.1 extension by Rick Simon
288# start adress 132Dh
289#0		leshort		0x132D	THIS_IS_C128_7.1
290#>0			use	c128-prg
291# Summary:	binary executable or Basic program for Commodore C128 computers
292# Note:		Commodore 128 BASIC 7.0 saved with graphics mode enabled
293# start adress 4001h
294#0		leshort		0x4001	THIS_IS_C128_GRAPHIC
295#>0			use	c128-prg
296# display information about tokenized C128 BASIC program (memory address, line number, token)
2970	name	c128-prg
298>0		uleshort	x	Commodore C128 BASIC program
299!:mime	application/x-commodore-basic
300!:ext	prg
301# start address like: 1C01h
302>0		uleshort	!0x1C01	\b, start address %#4.4x
303# 1st BASIC fragment
304>2		use		basic-line
305# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
306>(2.s-0x1C00)	ubyte		x
307>>&-1		ubyte		!0	\b, no EOL=%#x
308# 2nd BASIC fragment
309>>&0		use		basic-line
310# Zero-byte marking the end of the BASIC line
311>-3		ubyte		!0	\b, 3 last bytes %#2.2x
312# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
313>>-2		ubeshort	x	\b%4.4x
314# display information about C128 program (memory address, line number, token)
3150	name	c128-exe
316>0		uleshort	x	Commodore C128 program
317!:mime	application/x-commodore-exec
318!:ext	prg/
319# start address like: 1C01h
320>0		uleshort	!0x1C01	\b, start address %#4.4x
321# 1st BASIC fragment
322>2		use		basic-line
323# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
324>(2.s-0x1C00)	ubyte		x
325>>&-1		ubyte		!0	\b, no EOL=%#x
326# no valid 2nd BASIC fragment in Commodore executables
327#>>&0		use		basic-line
328# Zero-byte marking the end of the BASIC line
329>-3		ubyte		!0	\b, 3 last bytes %#2.2x
330# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
331>>-2		ubeshort	x	\b%4.4x
332# Summary:	binary executable or Basic program for Commodore C16/VIC-20/Plus4 computers
333# URL:		https://en.wikipedia.org/wiki/Commodore_Plus/4
334# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/prg-vic20.trid.xml
335#		defs/p/prg-plus4.trid.xml
336# From:		Joerg Jenderek
337# Note:		there exist VIC-20 variants with different start address
338# GRR: line below is too generic because it matches Novell LANalyzer capture
339# with regular trace header record handled by ./sniffer
3400		leshort		0x1001
341# skip regular Novell LANalyzer capture (novell-2.tr1 novell-lanalyzer.tr1 novell-win10.tr1) with "invalid low" token value 54h
342>6		ubyte		>0x7F
343# skip regular Novell LANalyzer capture (novell-2.tr1 novell-lanalyzer.tr1 novell-win10.tr1) with "invalid low" second line offset 4Ch
344#>>2		uleshort	>0x1006	OFFSET_NOT_TOO_LOW
345# skip foo with "invalid high" second line offset but not for 0x123b (Minefield.prg)
346#>>>2		uleshort	<0x1102	OFFSET_NOT_TOO_HIGH
347# if first token is not SYS this implies BASIC program
348>>6		ubyte		!0x9e
349# valid second end of line separator implies BASIC program
350>>>(2.s-0x1000)		ubyte	=0
351>>>>0			use	c16-prg
352# invalid second end of line separator !=0 implies binary executable like: Minefield.prg
353>>>(2.s-0x1000)		ubyte	!0
354>>>>0			use	c16-exe
355# if first token is SYS this implies binary executable
356>>6		ubyte		=0x9e
357>>>0		use		c16-exe
358# display information about C16 program (memory address, line number, token)
3590	name	c16-exe
360>0		uleshort	x	Commodore C16/VIC-20/Plus4 program
361!:mime	application/x-commodore-exec
362!:ext	prg/
363# start address like: 1001h
364>0		uleshort	!0x1001	\b, start address %#4.4x
365# 1st BASIC fragment
366>2		use		basic-line
367# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
368>(2.s-0x1000)	ubyte		x
369>>&-1		ubyte		!0	\b, no EOL=%#x
370# no valid 2nd BASIC fragment in excutables
371#>>&0		use		basic-line
372# Zero-byte marking the end of the BASIC line
373>-3		ubyte		!0	\b, 3 last bytes %#2.2x
374# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
375>>-2		ubeshort	x	\b%4.4x
376# display information about tokenized C16 BASIC program (memory address, line number, token)
3770	name	c16-prg
378>0		uleshort	x	Commodore C16/VIC-20/Plus4 BASIC program
379!:mime	application/x-commodore-basic
380!:ext	prg
381# start address like: 1001h
382>0		uleshort	!0x1001	\b, start address %#4.4x
383# 1st BASIC fragment
384>2		use		basic-line
385# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
386>(2.s-0x1000)	ubyte		x
387>>&-1		ubyte		!0	\b, no EOL=%#x
388# 2nd BASIC fragment
389>>&0		use		basic-line
390# Zero-byte marking the end of the BASIC line
391>-3		ubyte		!0	\b, 3 last bytes %#2.2x
392# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
393>>-2		ubeshort	x	\b%4.4x
394# Summary:	binary executable or Basic program for Commodore VIC-20 computer with 8K RAM expansion
395# URL:		https://en.wikipedia.org/wiki/VIC-20
396# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/prg-vic20-8k.trid.xml
397# From:		Joerg Jenderek
398# Note:		Basic v2.0 with Basic v4.0 extension (VIC20); there exist VIC-20 variants with different start addresses
399# start adress 1201h
4000		leshort		0x1201
401# if first token is not SYS this implies BASIC program
402>6		ubyte		!0x9e
403>>0		use		vic-prg
404# if first token is SYS this implies binary executable
405>6		ubyte		=0x9e
406>>0		use		vic-exe
407# display information about Commodore VIC-20 BASIC+8K program (memory address, line number, token)
4080	name	vic-prg
409>0		uleshort	x	Commodore VIC-20 +8K BASIC program
410!:mime	application/x-commodore-basic
411!:ext	prg
412# start address like: 1201h
413>0		uleshort	!0x1201	\b, start address %#4.4x
414# 1st BASIC fragment
415>2		use		basic-line
416# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
417>(2.s-0x1200)	ubyte		x
418>>&-1		ubyte		!0	\b, no EOL=%#x
419# 2nd BASIC fragment
420>>&0		use		basic-line
421# Zero-byte marking the end of the BASIC line
422>-3		ubyte		!0	\b, 3 last bytes %#2.2x
423# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
424>>-2		ubeshort	x	\b%4.4x
425# display information about Commodore VIC-20 +8K program (memory address, line number, token)
4260	name	vic-exe
427>0		uleshort	x	Commodore VIC-20 +8K program
428!:mime	application/x-commodore-exec
429!:ext	prg/
430# start address like: 1201h
431>0		uleshort	!0x1201	\b, start address %#4.4x
432# 1st BASIC fragment
433>2		use		basic-line
434# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
435>(2.s-0x0400)	ubyte		x
436>>&-1		ubyte		!0	\b, no EOL=%#x
437# no valid 2nd BASIC fragment in excutables
438#>>&0		use		basic-line
439# Zero-byte marking the end of the BASIC line
440>-3		ubyte		!0	\b, 3 last bytes %#2.2x
441# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
442>>-2		ubeshort	x	\b%4.4x
443# Summary:	binary executable or Basic program for Commodore PET computers
444# URL:		https://en.wikipedia.org/wiki/Commodore_PET
445# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/prg-pet.trid.xml
446# From:		Joerg Jenderek
447# start adress 0401h
4480		leshort		0x0401
449!:strength	+1
450# GRR: line above with strength 51 (50+1) is too generic because it matches TTComp archive data, ASCII, 1K dictionary
451# (strength=48=50-2) handled by ./archive and shared library (strength=50) handled by ./ibm6000
452# skip TTComp archive data, ASCII, 1K dictionary ttcomp-ascii-1k.bin with "invalid high" second line offset 4162h
453>2		uleshort	<0x0502
454# skip foo with "invalid low" second line offset
455#>>2		uleshort	>0x0406	OFFSET_NOT_TOO_LOW
456# skip bar with "invalid end of line"
457#>>>(2.s-0x0400)	ubyte		=0	END_OF_LINE_OK
458# if first token is not SYS this implies BASIC program
459>>6		ubyte		!0x9e
460>>>0		use		pet-prg
461# if first token is SYS this implies binary executable
462>>6		ubyte		=0x9e
463>>>0		use		pet-exe
464# display information about Commodore PET BASIC program (memory address, line number, token)
4650	name	pet-prg
466>0		uleshort	x	Commodore PET BASIC program
467!:mime	application/x-commodore-basic
468!:ext	prg
469# start address like: 0401h
470>0		uleshort	!0x0401	\b, start address %#4.4x
471# 1st BASIC fragment
472>2		use		basic-line
473# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
474>(2.s-0x0400)	ubyte		x
475# 2nd BASIC fragment
476>>&0		use		basic-line
477# zero-byte marking the end of the BASIC line
478>-3		ubyte		!0	\b, 3 last bytes %#2.2x
479# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
480>>-2		ubeshort	x	\b%4.4x
481# display information about Commodore PET program (memory address, line number, token)
4820	name	pet-exe
483>0		uleshort	x	Commodore PET program
484!:mime	application/x-commodore-exec
485!:ext	prg/
486# start address like: 0401h
487>0		uleshort	!0x0401	\b, start address %#4.4x
488# 1st BASIC fragment
489>2		use		basic-line
490# jump to 1 byte before next BASIC fragment; this must be zero-byte marking the end of line
491>(2.s-0x0400)	ubyte		x
492>>&-1		ubyte		!0	\b, no EOL=%#x
493# no valid 2nd BASIC fragment in excutables
494#>>&0		use		basic-line
495# Zero-byte marking the end of the BASIC line
496>-3		ubyte		!0	\b, 3 last bytes %#2.2x
497# Two zero-bytes in place of the pointer to next BASIC line indicates the end of the program
498>>-2		ubeshort	x	\b%4.4x
499# display information about tokenized BASIC line (memory address, line number, Token)
5000	name	basic-line
501# pointer to memory address of beginning of "next" BASIC line
502# greater then previous offset but maximal 100h difference
503>0		uleshort	x	\b, offset %#4.4x
504# offset 0x0000 indicates the end of BASIC program; so bytes afterwards may be some other data
505>0		uleshort	0
506# not line number but first 2 data bytes
507>>2		ubeshort	x	\b, data %#4.4x
508# not token but next 2 data bytes
509>>4		ubeshort	x	\b%4.4x
510# not token arguments but next data bytes
511>>6		ubequad		x 	\b%16.16llx
512>>14		ubequad		x 	\b%16.16llx...
513# like 0x0d20352020204c594e5820495820204259205749 "\r 5   LYNX IX  BY WILL CORLEY" for LyNX archive Darkon.lnx handled by ./archive
514#>>3		string		x 	"%-0.30s"
515>0		uleshort	>0
516# BASIC line number with range from 0 to 65520; practice to increment numbers by some value (5, 10 or 100)
517>>2		uleshort	x	\b, line %u
518# https://www.c64-wiki.com/wiki/BASIC_token
519# The "high-bit" bytes from #128-#254 stood for the various BASIC commands and mathematical operators
520>>4		ubyte		x	\b, token (%#x)
521# https://www.c64-wiki.com/wiki/REM
522>>4		string		\x8f	REM
523# remark string like: ** SYNTHESIZER BY RICOCHET **
524>>>5		string		>\0	%s
525#>>>>&1		uleshort	x	\b, NEXT OFFSET %#4.4x
526# https://www.c64-wiki.com/wiki/PRINT
527>>4		string		\x99	PRINT
528# string like: "Hello world" "\021 \323ELF-E\330TRACTING-\332IP (64 ONLY)\016\231":\2362141
529>>>5		string		x	%s
530#>>>>&0		ubequad		x	AFTER_PRINT=%#16.16llx
531# https://www.c64-wiki.com/wiki/POKE
532>>4		string		\x97	POKE
533# <Memory address>,<number>
534>>>5		regex		\^[0-9,\040]+	%s
535# BASIC command delimiter colon (:=3Ah)
536>>>>&-2		ubyte		=0x3A
537# after BASIC command delimiter colon remaining (<255) other tokenized BASIC commands
538>>>>>&0		string		x		"%s"
539# https://www.c64-wiki.com/wiki/SYS	0x9e=\236
540>>4		string		\x9e	SYS
541# SYS <Address> parameter is a 16-bit unsigned integer; in the range 0 - 65535
542>>>5		regex		\^[0-9]{1,5}	%s
543# maybe followed by spaces, "control-characters" or colon (:) followed by next commnds or in victracker.prg
544# (\302(43)\252256\254\302(44)\25236) /T.L.R/
545#>>>5		string		x	SYS_STRING="%s"
546# https://www.c64-wiki.com/wiki/GOSUB
547>>4		string		\x8d	GOSUB
548# <line>
549>>>5		string		>\0	%s
550