<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://fileformats.archiveteam.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://fileformats.archiveteam.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jonnosan</id>
		<title>Just Solve the File Format Problem - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://fileformats.archiveteam.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jonnosan"/>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Special:Contributions/Jonnosan"/>
		<updated>2026-04-20T10:23:24Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.19.2</generator>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file</id>
		<title>Sinclair BASIC tokenized file</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file"/>
				<updated>2013-05-22T21:54:13Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sinclair BASIC is a dialect of the BASIC programming language created by  by Nine Tiles Networks Ltd and  used in the 8-bit home computers from Sinclair Research and Timex Sinclair.&lt;br /&gt;
&lt;br /&gt;
The original 4KB version was developed for the Sinclair ZX80, followed by an 8KB version for the ZX81 and 16 KB version for ZX Spectrum.&lt;br /&gt;
&lt;br /&gt;
Some unusual features of the Sinclair BASIC:&lt;br /&gt;
* There were keys on the keyboard for each BASIC keyword. For example, pressing P caused the entire command PRINT to appear. Some commands needed multiple keypresses to enter, For example, BEEP  was keyed by pressing CAPS SHIFT plus SYMBOL SHIFT to access extended mode, keeping SYMBOL SHIFT held down and pressing Z. &lt;br /&gt;
* When programs where SAVEd, the file written to disk or tape contained all of BASIC's internal state information, including the values of any defined basic variables, as well as the BASIC tokens. &lt;br /&gt;
&lt;br /&gt;
=== BASIC File  Layout ===&lt;br /&gt;
On a ZX81 , a saved BASIC file is a snapshot of the computer memory from memory location 16393 through to the end of the variable table. There is no header.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Memory Address&amp;quot; | Address&lt;br /&gt;
! title=&amp;quot;Name&amp;quot; | Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|16393||VERSN	||0 Identifies ZX81 BASIC in saved programs.&lt;br /&gt;
|-&lt;br /&gt;
|16394||E_PPC||Number of current line (with program cursor).&lt;br /&gt;
|-&lt;br /&gt;
|16396||D_FILE||Pointer to the start of the 'Display file', i.e. what is being displayed on screen&lt;br /&gt;
|-&lt;br /&gt;
|16398||DF_CC||Address of PRINT position in display file. Can be poked so that PRINT output is sent elsewhere.&lt;br /&gt;
|-&lt;br /&gt;
|16400||VARS||Pointer to start of BASIC Variable table&lt;br /&gt;
|-&lt;br /&gt;
|16402||DEST||Address of variable in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16404||E_LINE||Pointer to line currently being entered&lt;br /&gt;
|-&lt;br /&gt;
|16406||CH_ADD||Address of the next character to be interpreted: the character after the argument of PEEK, or the NEWLINE at the end of a POKE statement.&lt;br /&gt;
|-&lt;br /&gt;
|16408||X_PTR||Address of the character preceding the  marker.&lt;br /&gt;
|-&lt;br /&gt;
|16410||STKBOT||pointer to start (bottom) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16412||STKEND||pointer to end (top) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16414||BERG||Calculator's b register.&lt;br /&gt;
|-&lt;br /&gt;
|16415||MEM||Address of area used for calculator's memory. (Usually MEMBOT, but not always.)&lt;br /&gt;
|-&lt;br /&gt;
|16417|| ||not used	&lt;br /&gt;
|-&lt;br /&gt;
|16418||DF_SZ||The number of lines (including one blank line) in the lower part of the screen.&lt;br /&gt;
|-&lt;br /&gt;
|16419||S_TOP||The number of the top program line in automatic listings.&lt;br /&gt;
|-&lt;br /&gt;
|16421||LAST_K||Shows which keys pressed.&lt;br /&gt;
|- &lt;br /&gt;
|16423|| || Debounce status of keyboard.&lt;br /&gt;
|-&lt;br /&gt;
|16424||MARGIN||Number of blank lines above or below picture: 55 in Britain, 31 in America.&lt;br /&gt;
|-&lt;br /&gt;
|16425||NXTLIN||Address of next program line to be executed.&lt;br /&gt;
|-&lt;br /&gt;
|16427||OLDPPC||Line number of which CONT jumps.&lt;br /&gt;
|-&lt;br /&gt;
|16429||FLAGX||Various flags.&lt;br /&gt;
|-&lt;br /&gt;
|16430||STRLEN||Length of string type destination in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16432||T_ADDR||Address of next item in syntax table (very unlikely to be useful).&lt;br /&gt;
|-&lt;br /&gt;
|16434||SEED||The seed for RND. This is the variable that is set by RAND.&lt;br /&gt;
|-&lt;br /&gt;
16436||FRAMES||Counts the frames displayed on the television. Bit 15 is 1. Bits 0 to 14 are decremented for each frame set to the television. This can be used for timing, but PAUSE also uses it. PAUSE resets to 0 bit 15, &amp;amp; puts in bits 0 to 14 the length of the pause. When these have been counted down to zero, the pause stops. If the pause stops because of a key depression, bit 15 is set to 1 again.&lt;br /&gt;
|-&lt;br /&gt;
|16438||COORDS||x-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16439||		|| y-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16440||PR_CC||Less significant byte of address of next position for LPRINT to print as (in PRBUFF).&lt;br /&gt;
|-&lt;br /&gt;
|16441||S_POSN||Column number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16442||		 ||Line number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16443||CDFLAG||Various flags. Bit 7 is on (1) during compute &amp;amp; display mode.&lt;br /&gt;
|-&lt;br /&gt;
|16444||PRBUFF||Printer buffer (33rd character is NEWLINE).&lt;br /&gt;
|-&lt;br /&gt;
|16477||MEMBOT||Calculator's memory area; used to store numbers that cannot conveniently be put on the calculator stack.&lt;br /&gt;
|-&lt;br /&gt;
|16507|| || not used&lt;br /&gt;
|-&lt;br /&gt;
|16509|| ||            First BASIC line.&lt;br /&gt;
 |}&lt;br /&gt;
  &lt;br /&gt;
Each BASIC line is stored as:&lt;br /&gt;
 &lt;br /&gt;
  2 byte line number (in big-endian format)&lt;br /&gt;
  2 byte length of text including NEWLINE (in little endian format, length &amp;quot;excludes&amp;quot; the line number and length, i.e. to skip between lines you add &amp;quot;length of text&amp;quot; +4 bytes.&lt;br /&gt;
  text (BASIC tokens)&lt;br /&gt;
  NEWLINE (0x76)&lt;br /&gt;
&lt;br /&gt;
When a numeric constant is included in the text of a BASIC line, an ASCII string displaying the constant value will be inserted, followed by the token 0x7E, and the next 5 bytes are the value of the constant in floating point format.&lt;br /&gt;
&lt;br /&gt;
=== BASIC Variables Table ===&lt;br /&gt;
Following the last BASIC line comes the VARIABLEs table. Each entry in this table is of varying length and format. The first byte in each entry is the variable name, of which the upper 3 bits indicate the variable type.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Variable Name&amp;quot; | Variable Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|011nnnnn|| single letter variable name, followed by 5 byte number&lt;br /&gt;
|-&lt;br /&gt;
|101nnnnn ||multi letter variable name (last letter has high bit set), followed by 5 byte number&lt;br /&gt;
|-&lt;br /&gt;
|100nnnnn || array of numbers&lt;br /&gt;
|-&lt;br /&gt;
|111nnnnnn || control variable of a for-next loop&lt;br /&gt;
|-&lt;br /&gt;
|010nnnnn ||single letter variable name - 0x20, 2 byte string length, text of string&lt;br /&gt;
|-&lt;br /&gt;
|110nnnnn || array of characters&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== ZX81 BASIC Tokens ===&lt;br /&gt;
{|&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Token&amp;quot; | Token (Decimal)&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0||&lt;br /&gt;
|-&lt;br /&gt;
|11||&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|12||£&lt;br /&gt;
|-&lt;br /&gt;
|13||$&lt;br /&gt;
|-&lt;br /&gt;
|14||:&lt;br /&gt;
|-&lt;br /&gt;
|15||?&lt;br /&gt;
|-&lt;br /&gt;
|16||(&lt;br /&gt;
|-&lt;br /&gt;
|17||)&lt;br /&gt;
|-&lt;br /&gt;
|18||&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|19||&amp;lt;&lt;br /&gt;
|-&lt;br /&gt;
|20||=&lt;br /&gt;
|-&lt;br /&gt;
|21||+&lt;br /&gt;
|-&lt;br /&gt;
|22||-&lt;br /&gt;
|-&lt;br /&gt;
|23||*&lt;br /&gt;
|-&lt;br /&gt;
|24||/&lt;br /&gt;
|-&lt;br /&gt;
|25||;&lt;br /&gt;
|-&lt;br /&gt;
|26||,&lt;br /&gt;
|-&lt;br /&gt;
|27||.&lt;br /&gt;
|-&lt;br /&gt;
|28||0&lt;br /&gt;
|-&lt;br /&gt;
|29||1&lt;br /&gt;
|-&lt;br /&gt;
|30||2&lt;br /&gt;
|-&lt;br /&gt;
|31||3&lt;br /&gt;
|-&lt;br /&gt;
|32||4&lt;br /&gt;
|-&lt;br /&gt;
|33||5&lt;br /&gt;
|-&lt;br /&gt;
|34||6&lt;br /&gt;
|-&lt;br /&gt;
|35||7&lt;br /&gt;
|-&lt;br /&gt;
|36||8&lt;br /&gt;
|-&lt;br /&gt;
|37||9&lt;br /&gt;
|-&lt;br /&gt;
|38||A&lt;br /&gt;
|-&lt;br /&gt;
|39||B&lt;br /&gt;
|-&lt;br /&gt;
|40||C&lt;br /&gt;
|-&lt;br /&gt;
|41||D&lt;br /&gt;
|-&lt;br /&gt;
|42||E&lt;br /&gt;
|-&lt;br /&gt;
|43||F&lt;br /&gt;
|-&lt;br /&gt;
|44||G&lt;br /&gt;
|-&lt;br /&gt;
|45||H&lt;br /&gt;
|-&lt;br /&gt;
|46||I&lt;br /&gt;
|-&lt;br /&gt;
|47||J&lt;br /&gt;
|-&lt;br /&gt;
|48||K&lt;br /&gt;
|-&lt;br /&gt;
|49||L&lt;br /&gt;
|-&lt;br /&gt;
|50||M&lt;br /&gt;
|-&lt;br /&gt;
|51||N&lt;br /&gt;
|-&lt;br /&gt;
|52||O&lt;br /&gt;
|-&lt;br /&gt;
|53||P&lt;br /&gt;
|-&lt;br /&gt;
|54||Q&lt;br /&gt;
|-&lt;br /&gt;
|55||R&lt;br /&gt;
|-&lt;br /&gt;
|56||S&lt;br /&gt;
|-&lt;br /&gt;
|57||T&lt;br /&gt;
|-&lt;br /&gt;
|58||U&lt;br /&gt;
|-&lt;br /&gt;
|59||V&lt;br /&gt;
|-&lt;br /&gt;
|60||W&lt;br /&gt;
|-&lt;br /&gt;
|61||X&lt;br /&gt;
|-&lt;br /&gt;
|62||Y&lt;br /&gt;
|-&lt;br /&gt;
|63||Z&lt;br /&gt;
|-&lt;br /&gt;
|64||RND&lt;br /&gt;
|-&lt;br /&gt;
|65||INKEY$&lt;br /&gt;
|-&lt;br /&gt;
|66||PI&lt;br /&gt;
|-&lt;br /&gt;
|112||&amp;lt;cursor up&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|113||&amp;lt;cursor down&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|114||&amp;lt;cursor left&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|115||&amp;lt;cursor right&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|116||GRAPHICS&lt;br /&gt;
|-&lt;br /&gt;
|117||EDIT&lt;br /&gt;
|-&lt;br /&gt;
|118||NEWLINE&lt;br /&gt;
|-&lt;br /&gt;
|119||RUBOUT&lt;br /&gt;
|-&lt;br /&gt;
|120||/&lt;br /&gt;
|-&lt;br /&gt;
|121||FUNCTION&lt;br /&gt;
|-&lt;br /&gt;
|127||cursor&lt;br /&gt;
|-&lt;br /&gt;
|128||&lt;br /&gt;
|-&lt;br /&gt;
|139||&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|140||£&lt;br /&gt;
|-&lt;br /&gt;
|141||$&lt;br /&gt;
|-&lt;br /&gt;
|142||:&lt;br /&gt;
|-&lt;br /&gt;
|143||?&lt;br /&gt;
|-&lt;br /&gt;
|144||(&lt;br /&gt;
|-&lt;br /&gt;
|145||)&lt;br /&gt;
|-&lt;br /&gt;
|146||&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|147||&amp;lt;&lt;br /&gt;
|-&lt;br /&gt;
|148||=&lt;br /&gt;
|-&lt;br /&gt;
|149||+&lt;br /&gt;
|-&lt;br /&gt;
|150||-&lt;br /&gt;
|-&lt;br /&gt;
|151||*&lt;br /&gt;
|-&lt;br /&gt;
|152||/&lt;br /&gt;
|-&lt;br /&gt;
|153||;&lt;br /&gt;
|-&lt;br /&gt;
|154|||-&lt;br /&gt;
|-&lt;br /&gt;
|155||.&lt;br /&gt;
|-&lt;br /&gt;
|156||0&lt;br /&gt;
|-&lt;br /&gt;
|157||1&lt;br /&gt;
|-&lt;br /&gt;
|158||2&lt;br /&gt;
|-&lt;br /&gt;
|159||3&lt;br /&gt;
|-&lt;br /&gt;
|160||4&lt;br /&gt;
|-&lt;br /&gt;
|161||5&lt;br /&gt;
|-&lt;br /&gt;
|162||6&lt;br /&gt;
|-&lt;br /&gt;
|163||7&lt;br /&gt;
|-&lt;br /&gt;
|164||8&lt;br /&gt;
|-&lt;br /&gt;
|165||9&lt;br /&gt;
|-&lt;br /&gt;
|166||A&lt;br /&gt;
|-&lt;br /&gt;
|167||B&lt;br /&gt;
|-&lt;br /&gt;
|168||C&lt;br /&gt;
|-&lt;br /&gt;
|169||D&lt;br /&gt;
|-&lt;br /&gt;
|170||E&lt;br /&gt;
|-&lt;br /&gt;
|171||F&lt;br /&gt;
|-&lt;br /&gt;
|172||G&lt;br /&gt;
|-&lt;br /&gt;
|173||H&lt;br /&gt;
|-&lt;br /&gt;
|174||I&lt;br /&gt;
|-&lt;br /&gt;
|175||J&lt;br /&gt;
|-&lt;br /&gt;
|176||K&lt;br /&gt;
|-&lt;br /&gt;
|177||L&lt;br /&gt;
|-&lt;br /&gt;
|178||M&lt;br /&gt;
|-&lt;br /&gt;
|179||N&lt;br /&gt;
|-&lt;br /&gt;
|180||O&lt;br /&gt;
|-&lt;br /&gt;
|181||P&lt;br /&gt;
|-&lt;br /&gt;
|182||Q&lt;br /&gt;
|-&lt;br /&gt;
|183||R&lt;br /&gt;
|-&lt;br /&gt;
|184||S&lt;br /&gt;
|-&lt;br /&gt;
|185||T&lt;br /&gt;
|-&lt;br /&gt;
|186||U&lt;br /&gt;
|-&lt;br /&gt;
|187||V&lt;br /&gt;
|-&lt;br /&gt;
|188||W&lt;br /&gt;
|-&lt;br /&gt;
|189||X&lt;br /&gt;
|-&lt;br /&gt;
|190||Y&lt;br /&gt;
|-&lt;br /&gt;
|191||Z&lt;br /&gt;
|-&lt;br /&gt;
|192||&amp;quot;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|193||AT&lt;br /&gt;
|-&lt;br /&gt;
|194||TAB&lt;br /&gt;
|-&lt;br /&gt;
|195||?&lt;br /&gt;
|-&lt;br /&gt;
|196||CODE&lt;br /&gt;
|-&lt;br /&gt;
|197||VAL&lt;br /&gt;
|-&lt;br /&gt;
|198||LEN&lt;br /&gt;
|-&lt;br /&gt;
|199||SIN&lt;br /&gt;
|-&lt;br /&gt;
|200||COS&lt;br /&gt;
|-&lt;br /&gt;
|201||TAN&lt;br /&gt;
|-&lt;br /&gt;
|202||ASN&lt;br /&gt;
|-&lt;br /&gt;
|203||ACS&lt;br /&gt;
|-&lt;br /&gt;
|204||ATN&lt;br /&gt;
|-&lt;br /&gt;
|205||LN&lt;br /&gt;
|-&lt;br /&gt;
|206||EXP&lt;br /&gt;
|-&lt;br /&gt;
|207||INT&lt;br /&gt;
|-&lt;br /&gt;
|208||SQR&lt;br /&gt;
|-&lt;br /&gt;
|209||SGN&lt;br /&gt;
|-&lt;br /&gt;
|210||ABS&lt;br /&gt;
|-&lt;br /&gt;
|211||PEEK&lt;br /&gt;
|-&lt;br /&gt;
|212||USR&lt;br /&gt;
|-&lt;br /&gt;
|213||STR$&lt;br /&gt;
|-&lt;br /&gt;
|214||CHR$&lt;br /&gt;
|-&lt;br /&gt;
|215||NOT&lt;br /&gt;
|-&lt;br /&gt;
|216||**&lt;br /&gt;
|-&lt;br /&gt;
|217||OR&lt;br /&gt;
|-&lt;br /&gt;
|218||AND&lt;br /&gt;
|-&lt;br /&gt;
|219||&amp;lt;=&lt;br /&gt;
|-&lt;br /&gt;
|220||&amp;gt;=&lt;br /&gt;
|-&lt;br /&gt;
|221||&amp;lt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|222||THEN&lt;br /&gt;
|-&lt;br /&gt;
|223||TO&lt;br /&gt;
|-&lt;br /&gt;
|224||STEP&lt;br /&gt;
|-&lt;br /&gt;
|225||LPRINT&lt;br /&gt;
|-&lt;br /&gt;
|226||LLIST&lt;br /&gt;
|-&lt;br /&gt;
|227||STOP&lt;br /&gt;
|-&lt;br /&gt;
|228||SLOW&lt;br /&gt;
|-&lt;br /&gt;
|229||FAST&lt;br /&gt;
|-&lt;br /&gt;
|230||NEW&lt;br /&gt;
|-&lt;br /&gt;
|231||SCROLL&lt;br /&gt;
|-&lt;br /&gt;
|232||CONT&lt;br /&gt;
|-&lt;br /&gt;
|233||DIM&lt;br /&gt;
|-&lt;br /&gt;
|234||REM&lt;br /&gt;
|-&lt;br /&gt;
|235||FOR&lt;br /&gt;
|-&lt;br /&gt;
|236||GOTO&lt;br /&gt;
|-&lt;br /&gt;
|237||GOSUB&lt;br /&gt;
|-&lt;br /&gt;
|238||INPUT&lt;br /&gt;
|-&lt;br /&gt;
|239||LOAD&lt;br /&gt;
|-&lt;br /&gt;
|240||LIST&lt;br /&gt;
|-&lt;br /&gt;
|241||LET&lt;br /&gt;
|-&lt;br /&gt;
|242||PAUSE&lt;br /&gt;
|-&lt;br /&gt;
|243||NEXT&lt;br /&gt;
|-&lt;br /&gt;
|244||POKE&lt;br /&gt;
|-&lt;br /&gt;
|245||PRINT&lt;br /&gt;
|-&lt;br /&gt;
|246||PLOT&lt;br /&gt;
|-&lt;br /&gt;
|247||RUN&lt;br /&gt;
|-&lt;br /&gt;
|248||SAVE&lt;br /&gt;
|-&lt;br /&gt;
|249||RAND&lt;br /&gt;
|-&lt;br /&gt;
|250||IF&lt;br /&gt;
|-&lt;br /&gt;
|251||CLS&lt;br /&gt;
|-&lt;br /&gt;
|252||UNPLOT&lt;br /&gt;
|-&lt;br /&gt;
|253||CLEAR&lt;br /&gt;
|-&lt;br /&gt;
|254||RETURN&lt;br /&gt;
|-&lt;br /&gt;
|255||COPY&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
[http://www.worldofspectrum.org/ZX81BasicProgramming/ ZX81 BASIC Programming]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file</id>
		<title>Sinclair BASIC tokenized file</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file"/>
				<updated>2013-05-22T21:52:39Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: add BASIC tokens&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sinclair BASIC is a dialect of the BASIC programming language created by  by Nine Tiles Networks Ltd and  used in the 8-bit home computers from Sinclair Research and Timex Sinclair.&lt;br /&gt;
&lt;br /&gt;
The original 4KB version was developed for the Sinclair ZX80, followed by an 8KB version for the ZX81 and 16 KB version for ZX Spectrum.&lt;br /&gt;
&lt;br /&gt;
Some unusual features of the Sinclair BASIC:&lt;br /&gt;
* There were keys on the keyboard for each BASIC keyword. For example, pressing P caused the entire command PRINT to appear. Some commands needed multiple keypresses to enter, For example, BEEP  was keyed by pressing CAPS SHIFT plus SYMBOL SHIFT to access extended mode, keeping SYMBOL SHIFT held down and pressing Z. &lt;br /&gt;
* When programs where SAVEd, the file written to disk or tape contained all of BASIC's internal state information, including the values of any defined basic variables, as well as the BASIC tokens. &lt;br /&gt;
&lt;br /&gt;
=== BASIC File  Layout ===&lt;br /&gt;
On a ZX81 , a saved BASIC file is a snapshot of the computer memory from memory location 16393 through to the end of the variable table. There is no header.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Memory Address&amp;quot; | Address&lt;br /&gt;
! title=&amp;quot;Name&amp;quot; | Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|16393||VERSN	||0 Identifies ZX81 BASIC in saved programs.&lt;br /&gt;
|-&lt;br /&gt;
|16394||E_PPC||Number of current line (with program cursor).&lt;br /&gt;
|-&lt;br /&gt;
|16396||D_FILE||Pointer to the start of the 'Display file', i.e. what is being displayed on screen&lt;br /&gt;
|-&lt;br /&gt;
|16398||DF_CC||Address of PRINT position in display file. Can be poked so that PRINT output is sent elsewhere.&lt;br /&gt;
|-&lt;br /&gt;
|16400||VARS||Pointer to start of BASIC Variable table&lt;br /&gt;
|-&lt;br /&gt;
|16402||DEST||Address of variable in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16404||E_LINE||Pointer to line currently being entered&lt;br /&gt;
|-&lt;br /&gt;
|16406||CH_ADD||Address of the next character to be interpreted: the character after the argument of PEEK, or the NEWLINE at the end of a POKE statement.&lt;br /&gt;
|-&lt;br /&gt;
|16408||X_PTR||Address of the character preceding the  marker.&lt;br /&gt;
|-&lt;br /&gt;
|16410||STKBOT||pointer to start (bottom) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16412||STKEND||pointer to end (top) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16414||BERG||Calculator's b register.&lt;br /&gt;
|-&lt;br /&gt;
|16415||MEM||Address of area used for calculator's memory. (Usually MEMBOT, but not always.)&lt;br /&gt;
|-&lt;br /&gt;
|16417|| ||not used	&lt;br /&gt;
|-&lt;br /&gt;
|16418||DF_SZ||The number of lines (including one blank line) in the lower part of the screen.&lt;br /&gt;
|-&lt;br /&gt;
|16419||S_TOP||The number of the top program line in automatic listings.&lt;br /&gt;
|-&lt;br /&gt;
|16421||LAST_K||Shows which keys pressed.&lt;br /&gt;
|- &lt;br /&gt;
|16423|| || Debounce status of keyboard.&lt;br /&gt;
|-&lt;br /&gt;
|16424||MARGIN||Number of blank lines above or below picture: 55 in Britain, 31 in America.&lt;br /&gt;
|-&lt;br /&gt;
|16425||NXTLIN||Address of next program line to be executed.&lt;br /&gt;
|-&lt;br /&gt;
|16427||OLDPPC||Line number of which CONT jumps.&lt;br /&gt;
|-&lt;br /&gt;
|16429||FLAGX||Various flags.&lt;br /&gt;
|-&lt;br /&gt;
|16430||STRLEN||Length of string type destination in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16432||T_ADDR||Address of next item in syntax table (very unlikely to be useful).&lt;br /&gt;
|-&lt;br /&gt;
|16434||SEED||The seed for RND. This is the variable that is set by RAND.&lt;br /&gt;
|-&lt;br /&gt;
16436||FRAMES||Counts the frames displayed on the television. Bit 15 is 1. Bits 0 to 14 are decremented for each frame set to the television. This can be used for timing, but PAUSE also uses it. PAUSE resets to 0 bit 15, &amp;amp; puts in bits 0 to 14 the length of the pause. When these have been counted down to zero, the pause stops. If the pause stops because of a key depression, bit 15 is set to 1 again.&lt;br /&gt;
|-&lt;br /&gt;
|16438||COORDS||x-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16439||		|| y-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16440||PR_CC||Less significant byte of address of next position for LPRINT to print as (in PRBUFF).&lt;br /&gt;
|-&lt;br /&gt;
|16441||S_POSN||Column number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16442||		 ||Line number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16443||CDFLAG||Various flags. Bit 7 is on (1) during compute &amp;amp; display mode.&lt;br /&gt;
|-&lt;br /&gt;
|16444||PRBUFF||Printer buffer (33rd character is NEWLINE).&lt;br /&gt;
|-&lt;br /&gt;
|16477||MEMBOT||Calculator's memory area; used to store numbers that cannot conveniently be put on the calculator stack.&lt;br /&gt;
|-&lt;br /&gt;
|16507|| || not used&lt;br /&gt;
|-&lt;br /&gt;
|16509|| ||            First BASIC line.&lt;br /&gt;
 |}&lt;br /&gt;
  &lt;br /&gt;
Each BASIC line is stored as:&lt;br /&gt;
 &lt;br /&gt;
  2 byte line number (in big-endian format)&lt;br /&gt;
  2 byte length of text including NEWLINE (in little endian format, length &amp;quot;excludes&amp;quot; the line number and length, i.e. to skip between lines you add &amp;quot;length of text&amp;quot; +4 bytes.&lt;br /&gt;
  text (BASIC tokens)&lt;br /&gt;
  NEWLINE (0x76)&lt;br /&gt;
&lt;br /&gt;
When a numeric constant is included in the text of a BASIC line, an ASCII string displaying the constant value will be inserted, followed by the token 0x7E, and the next 5 bytes are the value of the constant in floating point format.&lt;br /&gt;
&lt;br /&gt;
Following the last BASIC line comes the VARIABLEs table. Each entry in this table is of varying length and format. The first byte in each entry is the variable name, of which the upper 3 bits indicate the variable type.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Variable Name&amp;quot; | Variable Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|011nnnnn|| single letter variable name, followed by 5 byte number&lt;br /&gt;
|-&lt;br /&gt;
|101nnnnn ||multi letter variable name (last letter has high bit set), followed by 5 byte number&lt;br /&gt;
|-&lt;br /&gt;
|100nnnnn || array of numbers&lt;br /&gt;
|-&lt;br /&gt;
|111nnnnnn || control variable of a for-next loop&lt;br /&gt;
|-&lt;br /&gt;
|010nnnnn ||single letter variable name - 0x20, 2 byte string length, text of string&lt;br /&gt;
|-&lt;br /&gt;
|110nnnnn || array of characters&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Token&amp;quot; | Token (Decimal)&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0||&lt;br /&gt;
|-&lt;br /&gt;
|11||&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|12||£&lt;br /&gt;
|-&lt;br /&gt;
|13||$&lt;br /&gt;
|-&lt;br /&gt;
|14||:&lt;br /&gt;
|-&lt;br /&gt;
|15||?&lt;br /&gt;
|-&lt;br /&gt;
|16||(&lt;br /&gt;
|-&lt;br /&gt;
|17||)&lt;br /&gt;
|-&lt;br /&gt;
|18||&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|19||&amp;lt;&lt;br /&gt;
|-&lt;br /&gt;
|20||=&lt;br /&gt;
|-&lt;br /&gt;
|21||+&lt;br /&gt;
|-&lt;br /&gt;
|22||-&lt;br /&gt;
|-&lt;br /&gt;
|23||*&lt;br /&gt;
|-&lt;br /&gt;
|24||/&lt;br /&gt;
|-&lt;br /&gt;
|25||;&lt;br /&gt;
|-&lt;br /&gt;
|26||,&lt;br /&gt;
|-&lt;br /&gt;
|27||.&lt;br /&gt;
|-&lt;br /&gt;
|28||0&lt;br /&gt;
|-&lt;br /&gt;
|29||1&lt;br /&gt;
|-&lt;br /&gt;
|30||2&lt;br /&gt;
|-&lt;br /&gt;
|31||3&lt;br /&gt;
|-&lt;br /&gt;
|32||4&lt;br /&gt;
|-&lt;br /&gt;
|33||5&lt;br /&gt;
|-&lt;br /&gt;
|34||6&lt;br /&gt;
|-&lt;br /&gt;
|35||7&lt;br /&gt;
|-&lt;br /&gt;
|36||8&lt;br /&gt;
|-&lt;br /&gt;
|37||9&lt;br /&gt;
|-&lt;br /&gt;
|38||A&lt;br /&gt;
|-&lt;br /&gt;
|39||B&lt;br /&gt;
|-&lt;br /&gt;
|40||C&lt;br /&gt;
|-&lt;br /&gt;
|41||D&lt;br /&gt;
|-&lt;br /&gt;
|42||E&lt;br /&gt;
|-&lt;br /&gt;
|43||F&lt;br /&gt;
|-&lt;br /&gt;
|44||G&lt;br /&gt;
|-&lt;br /&gt;
|45||H&lt;br /&gt;
|-&lt;br /&gt;
|46||I&lt;br /&gt;
|-&lt;br /&gt;
|47||J&lt;br /&gt;
|-&lt;br /&gt;
|48||K&lt;br /&gt;
|-&lt;br /&gt;
|49||L&lt;br /&gt;
|-&lt;br /&gt;
|50||M&lt;br /&gt;
|-&lt;br /&gt;
|51||N&lt;br /&gt;
|-&lt;br /&gt;
|52||O&lt;br /&gt;
|-&lt;br /&gt;
|53||P&lt;br /&gt;
|-&lt;br /&gt;
|54||Q&lt;br /&gt;
|-&lt;br /&gt;
|55||R&lt;br /&gt;
|-&lt;br /&gt;
|56||S&lt;br /&gt;
|-&lt;br /&gt;
|57||T&lt;br /&gt;
|-&lt;br /&gt;
|58||U&lt;br /&gt;
|-&lt;br /&gt;
|59||V&lt;br /&gt;
|-&lt;br /&gt;
|60||W&lt;br /&gt;
|-&lt;br /&gt;
|61||X&lt;br /&gt;
|-&lt;br /&gt;
|62||Y&lt;br /&gt;
|-&lt;br /&gt;
|63||Z&lt;br /&gt;
|-&lt;br /&gt;
|64||RND&lt;br /&gt;
|-&lt;br /&gt;
|65||INKEY$&lt;br /&gt;
|-&lt;br /&gt;
|66||PI&lt;br /&gt;
|-&lt;br /&gt;
|112||&amp;lt;cursor up&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|113||&amp;lt;cursor down&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|114||&amp;lt;cursor left&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|115||&amp;lt;cursor right&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|116||GRAPHICS&lt;br /&gt;
|-&lt;br /&gt;
|117||EDIT&lt;br /&gt;
|-&lt;br /&gt;
|118||NEWLINE&lt;br /&gt;
|-&lt;br /&gt;
|119||RUBOUT&lt;br /&gt;
|-&lt;br /&gt;
|120||/&lt;br /&gt;
|-&lt;br /&gt;
|121||FUNCTION&lt;br /&gt;
|-&lt;br /&gt;
|127||cursor&lt;br /&gt;
|-&lt;br /&gt;
|128||&lt;br /&gt;
|-&lt;br /&gt;
|139||&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|140||£&lt;br /&gt;
|-&lt;br /&gt;
|141||$&lt;br /&gt;
|-&lt;br /&gt;
|142||:&lt;br /&gt;
|-&lt;br /&gt;
|143||?&lt;br /&gt;
|-&lt;br /&gt;
|144||(&lt;br /&gt;
|-&lt;br /&gt;
|145||)&lt;br /&gt;
|-&lt;br /&gt;
|146||&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|147||&amp;lt;&lt;br /&gt;
|-&lt;br /&gt;
|148||=&lt;br /&gt;
|-&lt;br /&gt;
|149||+&lt;br /&gt;
|-&lt;br /&gt;
|150||-&lt;br /&gt;
|-&lt;br /&gt;
|151||*&lt;br /&gt;
|-&lt;br /&gt;
|152||/&lt;br /&gt;
|-&lt;br /&gt;
|153||;&lt;br /&gt;
|-&lt;br /&gt;
|154|||-&lt;br /&gt;
|-&lt;br /&gt;
|155||.&lt;br /&gt;
|-&lt;br /&gt;
|156||0&lt;br /&gt;
|-&lt;br /&gt;
|157||1&lt;br /&gt;
|-&lt;br /&gt;
|158||2&lt;br /&gt;
|-&lt;br /&gt;
|159||3&lt;br /&gt;
|-&lt;br /&gt;
|160||4&lt;br /&gt;
|-&lt;br /&gt;
|161||5&lt;br /&gt;
|-&lt;br /&gt;
|162||6&lt;br /&gt;
|-&lt;br /&gt;
|163||7&lt;br /&gt;
|-&lt;br /&gt;
|164||8&lt;br /&gt;
|-&lt;br /&gt;
|165||9&lt;br /&gt;
|-&lt;br /&gt;
|166||A&lt;br /&gt;
|-&lt;br /&gt;
|167||B&lt;br /&gt;
|-&lt;br /&gt;
|168||C&lt;br /&gt;
|-&lt;br /&gt;
|169||D&lt;br /&gt;
|-&lt;br /&gt;
|170||E&lt;br /&gt;
|-&lt;br /&gt;
|171||F&lt;br /&gt;
|-&lt;br /&gt;
|172||G&lt;br /&gt;
|-&lt;br /&gt;
|173||H&lt;br /&gt;
|-&lt;br /&gt;
|174||I&lt;br /&gt;
|-&lt;br /&gt;
|175||J&lt;br /&gt;
|-&lt;br /&gt;
|176||K&lt;br /&gt;
|-&lt;br /&gt;
|177||L&lt;br /&gt;
|-&lt;br /&gt;
|178||M&lt;br /&gt;
|-&lt;br /&gt;
|179||N&lt;br /&gt;
|-&lt;br /&gt;
|180||O&lt;br /&gt;
|-&lt;br /&gt;
|181||P&lt;br /&gt;
|-&lt;br /&gt;
|182||Q&lt;br /&gt;
|-&lt;br /&gt;
|183||R&lt;br /&gt;
|-&lt;br /&gt;
|184||S&lt;br /&gt;
|-&lt;br /&gt;
|185||T&lt;br /&gt;
|-&lt;br /&gt;
|186||U&lt;br /&gt;
|-&lt;br /&gt;
|187||V&lt;br /&gt;
|-&lt;br /&gt;
|188||W&lt;br /&gt;
|-&lt;br /&gt;
|189||X&lt;br /&gt;
|-&lt;br /&gt;
|190||Y&lt;br /&gt;
|-&lt;br /&gt;
|191||Z&lt;br /&gt;
|-&lt;br /&gt;
|192||&amp;quot;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|193||AT&lt;br /&gt;
|-&lt;br /&gt;
|194||TAB&lt;br /&gt;
|-&lt;br /&gt;
|195||?&lt;br /&gt;
|-&lt;br /&gt;
|196||CODE&lt;br /&gt;
|-&lt;br /&gt;
|197||VAL&lt;br /&gt;
|-&lt;br /&gt;
|198||LEN&lt;br /&gt;
|-&lt;br /&gt;
|199||SIN&lt;br /&gt;
|-&lt;br /&gt;
|200||COS&lt;br /&gt;
|-&lt;br /&gt;
|201||TAN&lt;br /&gt;
|-&lt;br /&gt;
|202||ASN&lt;br /&gt;
|-&lt;br /&gt;
|203||ACS&lt;br /&gt;
|-&lt;br /&gt;
|204||ATN&lt;br /&gt;
|-&lt;br /&gt;
|205||LN&lt;br /&gt;
|-&lt;br /&gt;
|206||EXP&lt;br /&gt;
|-&lt;br /&gt;
|207||INT&lt;br /&gt;
|-&lt;br /&gt;
|208||SQR&lt;br /&gt;
|-&lt;br /&gt;
|209||SGN&lt;br /&gt;
|-&lt;br /&gt;
|210||ABS&lt;br /&gt;
|-&lt;br /&gt;
|211||PEEK&lt;br /&gt;
|-&lt;br /&gt;
|212||USR&lt;br /&gt;
|-&lt;br /&gt;
|213||STR$&lt;br /&gt;
|-&lt;br /&gt;
|214||CHR$&lt;br /&gt;
|-&lt;br /&gt;
|215||NOT&lt;br /&gt;
|-&lt;br /&gt;
|216||**&lt;br /&gt;
|-&lt;br /&gt;
|217||OR&lt;br /&gt;
|-&lt;br /&gt;
|218||AND&lt;br /&gt;
|-&lt;br /&gt;
|219||&amp;lt;=&lt;br /&gt;
|-&lt;br /&gt;
|220||&amp;gt;=&lt;br /&gt;
|-&lt;br /&gt;
|221||&amp;lt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|222||THEN&lt;br /&gt;
|-&lt;br /&gt;
|223||TO&lt;br /&gt;
|-&lt;br /&gt;
|224||STEP&lt;br /&gt;
|-&lt;br /&gt;
|225||LPRINT&lt;br /&gt;
|-&lt;br /&gt;
|226||LLIST&lt;br /&gt;
|-&lt;br /&gt;
|227||STOP&lt;br /&gt;
|-&lt;br /&gt;
|228||SLOW&lt;br /&gt;
|-&lt;br /&gt;
|229||FAST&lt;br /&gt;
|-&lt;br /&gt;
|230||NEW&lt;br /&gt;
|-&lt;br /&gt;
|231||SCROLL&lt;br /&gt;
|-&lt;br /&gt;
|232||CONT&lt;br /&gt;
|-&lt;br /&gt;
|233||DIM&lt;br /&gt;
|-&lt;br /&gt;
|234||REM&lt;br /&gt;
|-&lt;br /&gt;
|235||FOR&lt;br /&gt;
|-&lt;br /&gt;
|236||GOTO&lt;br /&gt;
|-&lt;br /&gt;
|237||GOSUB&lt;br /&gt;
|-&lt;br /&gt;
|238||INPUT&lt;br /&gt;
|-&lt;br /&gt;
|239||LOAD&lt;br /&gt;
|-&lt;br /&gt;
|240||LIST&lt;br /&gt;
|-&lt;br /&gt;
|241||LET&lt;br /&gt;
|-&lt;br /&gt;
|242||PAUSE&lt;br /&gt;
|-&lt;br /&gt;
|243||NEXT&lt;br /&gt;
|-&lt;br /&gt;
|244||POKE&lt;br /&gt;
|-&lt;br /&gt;
|245||PRINT&lt;br /&gt;
|-&lt;br /&gt;
|246||PLOT&lt;br /&gt;
|-&lt;br /&gt;
|247||RUN&lt;br /&gt;
|-&lt;br /&gt;
|248||SAVE&lt;br /&gt;
|-&lt;br /&gt;
|249||RAND&lt;br /&gt;
|-&lt;br /&gt;
|250||IF&lt;br /&gt;
|-&lt;br /&gt;
|251||CLS&lt;br /&gt;
|-&lt;br /&gt;
|252||UNPLOT&lt;br /&gt;
|-&lt;br /&gt;
|253||CLEAR&lt;br /&gt;
|-&lt;br /&gt;
|254||RETURN&lt;br /&gt;
|-&lt;br /&gt;
|255||COPY&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
[http://www.worldofspectrum.org/ZX81BasicProgramming/ ZX81 BASIC Programming]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file</id>
		<title>Sinclair BASIC tokenized file</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file"/>
				<updated>2013-05-22T21:44:07Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sinclair BASIC is a dialect of the BASIC programming language created by  by Nine Tiles Networks Ltd and  used in the 8-bit home computers from Sinclair Research and Timex Sinclair.&lt;br /&gt;
&lt;br /&gt;
The original 4KB version was developed for the Sinclair ZX80, followed by an 8KB version for the ZX81 and 16 KB version for ZX Spectrum.&lt;br /&gt;
&lt;br /&gt;
Some unusual features of the Sinclair BASIC:&lt;br /&gt;
* There were keys on the keyboard for each BASIC keyword. For example, pressing P caused the entire command PRINT to appear. Some commands needed multiple keypresses to enter, For example, BEEP  was keyed by pressing CAPS SHIFT plus SYMBOL SHIFT to access extended mode, keeping SYMBOL SHIFT held down and pressing Z. &lt;br /&gt;
* When programs where SAVEd, the file written to disk or tape contained all of BASIC's internal state information, including the values of any defined basic variables, as well as the BASIC tokens. &lt;br /&gt;
&lt;br /&gt;
=== BASIC File  Layout ===&lt;br /&gt;
On a ZX81 , a saved BASIC file is a snapshot of the computer memory from memory location 16393 through to the end of the variable table. There is no header.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Memory Address&amp;quot; | Address&lt;br /&gt;
! title=&amp;quot;Name&amp;quot; | Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|16393||VERSN	||0 Identifies ZX81 BASIC in saved programs.&lt;br /&gt;
|-&lt;br /&gt;
|16394||E_PPC||Number of current line (with program cursor).&lt;br /&gt;
|-&lt;br /&gt;
|16396||D_FILE||Pointer to the start of the 'Display file', i.e. what is being displayed on screen&lt;br /&gt;
|-&lt;br /&gt;
|16398||DF_CC||Address of PRINT position in display file. Can be poked so that PRINT output is sent elsewhere.&lt;br /&gt;
|-&lt;br /&gt;
|16400||VARS||Pointer to start of BASIC Variable table&lt;br /&gt;
|-&lt;br /&gt;
|16402||DEST||Address of variable in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16404||E_LINE||Pointer to line currently being entered&lt;br /&gt;
|-&lt;br /&gt;
|16406||CH_ADD||Address of the next character to be interpreted: the character after the argument of PEEK, or the NEWLINE at the end of a POKE statement.&lt;br /&gt;
|-&lt;br /&gt;
|16408||X_PTR||Address of the character preceding the  marker.&lt;br /&gt;
|-&lt;br /&gt;
|16410||STKBOT||pointer to start (bottom) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16412||STKEND||pointer to end (top) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16414||BERG||Calculator's b register.&lt;br /&gt;
|-&lt;br /&gt;
|16415||MEM||Address of area used for calculator's memory. (Usually MEMBOT, but not always.)&lt;br /&gt;
|-&lt;br /&gt;
|16417|| ||not used	&lt;br /&gt;
|-&lt;br /&gt;
|16418||DF_SZ||The number of lines (including one blank line) in the lower part of the screen.&lt;br /&gt;
|-&lt;br /&gt;
|16419||S_TOP||The number of the top program line in automatic listings.&lt;br /&gt;
|-&lt;br /&gt;
|16421||LAST_K||Shows which keys pressed.&lt;br /&gt;
|- &lt;br /&gt;
|16423|| || Debounce status of keyboard.&lt;br /&gt;
|-&lt;br /&gt;
|16424||MARGIN||Number of blank lines above or below picture: 55 in Britain, 31 in America.&lt;br /&gt;
|-&lt;br /&gt;
|16425||NXTLIN||Address of next program line to be executed.&lt;br /&gt;
|-&lt;br /&gt;
|16427||OLDPPC||Line number of which CONT jumps.&lt;br /&gt;
|-&lt;br /&gt;
|16429||FLAGX||Various flags.&lt;br /&gt;
|-&lt;br /&gt;
|16430||STRLEN||Length of string type destination in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16432||T_ADDR||Address of next item in syntax table (very unlikely to be useful).&lt;br /&gt;
|-&lt;br /&gt;
|16434||SEED||The seed for RND. This is the variable that is set by RAND.&lt;br /&gt;
|-&lt;br /&gt;
16436||FRAMES||Counts the frames displayed on the television. Bit 15 is 1. Bits 0 to 14 are decremented for each frame set to the television. This can be used for timing, but PAUSE also uses it. PAUSE resets to 0 bit 15, &amp;amp; puts in bits 0 to 14 the length of the pause. When these have been counted down to zero, the pause stops. If the pause stops because of a key depression, bit 15 is set to 1 again.&lt;br /&gt;
|-&lt;br /&gt;
|16438||COORDS||x-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16439||		|| y-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16440||PR_CC||Less significant byte of address of next position for LPRINT to print as (in PRBUFF).&lt;br /&gt;
|-&lt;br /&gt;
|16441||S_POSN||Column number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16442||		 ||Line number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16443||CDFLAG||Various flags. Bit 7 is on (1) during compute &amp;amp; display mode.&lt;br /&gt;
|-&lt;br /&gt;
|16444||PRBUFF||Printer buffer (33rd character is NEWLINE).&lt;br /&gt;
|-&lt;br /&gt;
|16477||MEMBOT||Calculator's memory area; used to store numbers that cannot conveniently be put on the calculator stack.&lt;br /&gt;
|-&lt;br /&gt;
|16507|| || not used&lt;br /&gt;
|-&lt;br /&gt;
|16509|| ||            First BASIC line.&lt;br /&gt;
 |}&lt;br /&gt;
  &lt;br /&gt;
Each BASIC line is stored as:&lt;br /&gt;
 &lt;br /&gt;
  2 byte line number (in big-endian format)&lt;br /&gt;
  2 byte length of text including NEWLINE (in little endian format, length &amp;quot;excludes&amp;quot; the line number and length, i.e. to skip between lines you add &amp;quot;length of text&amp;quot; +4 bytes.&lt;br /&gt;
  text (BASIC tokens)&lt;br /&gt;
  NEWLINE (0x76)&lt;br /&gt;
&lt;br /&gt;
When a numeric constant is included in the text of a BASIC line, an ASCII string displaying the constant value will be inserted, followed by the token 0x7E, and the next 5 bytes are the value of the constant in floating point format.&lt;br /&gt;
&lt;br /&gt;
Following the last BASIC line comes the VARIABLEs table. Each entry in this table is of varying length and format. The first byte in each entry is the variable name, of which the upper 3 bits indicate the variable type.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Variable Name&amp;quot; | Variable Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|011nnnnn|| single letter variable name, followed by 5 byte number&lt;br /&gt;
|-&lt;br /&gt;
|101nnnnn ||multi letter variable name (last letter has high bit set), followed by 5 byte number&lt;br /&gt;
|-&lt;br /&gt;
|100nnnnn || array of numbers: &lt;br /&gt;
|-&lt;br /&gt;
|111nnnnnn || control variable of a for-next loop&lt;br /&gt;
|-&lt;br /&gt;
|010nnnnn ||single letter variable name - 0x20, 2 byte string length, text of string&lt;br /&gt;
|-&lt;br /&gt;
|110nnnnn || array of characters&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
[http://www.worldofspectrum.org/ZX81BasicProgramming/ ZX81 BASIC Programming]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file</id>
		<title>Sinclair BASIC tokenized file</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file"/>
				<updated>2013-05-22T21:43:26Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: layout variable table&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sinclair BASIC is a dialect of the BASIC programming language created by  by Nine Tiles Networks Ltd and  used in the 8-bit home computers from Sinclair Research and Timex Sinclair.&lt;br /&gt;
&lt;br /&gt;
The original 4KB version was developed for the Sinclair ZX80, followed by an 8KB version for the ZX81 and 16 KB version for ZX Spectrum.&lt;br /&gt;
&lt;br /&gt;
Some unusual features of the Sinclair BASIC:&lt;br /&gt;
* There were keys on the keyboard for each BASIC keyword. For example, pressing P caused the entire command PRINT to appear. Some commands needed multiple keypresses to enter, For example, BEEP  was keyed by pressing CAPS SHIFT plus SYMBOL SHIFT to access extended mode, keeping SYMBOL SHIFT held down and pressing Z. &lt;br /&gt;
* When programs where SAVEd, the file written to disk or tape contained all of BASIC's internal state information, including the values of any defined basic variables, as well as the BASIC tokens. &lt;br /&gt;
&lt;br /&gt;
=== BASIC File  Layout ===&lt;br /&gt;
On a ZX81 , a saved BASIC file is a snapshot of the computer memory from memory location 16393 through to the end of the variable table. There is no header.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Memory Address&amp;quot; | Address&lt;br /&gt;
! title=&amp;quot;Name&amp;quot; | Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|16393||VERSN	||0 Identifies ZX81 BASIC in saved programs.&lt;br /&gt;
|-&lt;br /&gt;
|16394||E_PPC||Number of current line (with program cursor).&lt;br /&gt;
|-&lt;br /&gt;
|16396||D_FILE||Pointer to the start of the 'Display file', i.e. what is being displayed on screen&lt;br /&gt;
|-&lt;br /&gt;
|16398||DF_CC||Address of PRINT position in display file. Can be poked so that PRINT output is sent elsewhere.&lt;br /&gt;
|-&lt;br /&gt;
|16400||VARS||Pointer to start of BASIC Variable table&lt;br /&gt;
|-&lt;br /&gt;
|16402||DEST||Address of variable in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16404||E_LINE||Pointer to line currently being entered&lt;br /&gt;
|-&lt;br /&gt;
|16406||CH_ADD||Address of the next character to be interpreted: the character after the argument of PEEK, or the NEWLINE at the end of a POKE statement.&lt;br /&gt;
|-&lt;br /&gt;
|16408||X_PTR||Address of the character preceding the  marker.&lt;br /&gt;
|-&lt;br /&gt;
|16410||STKBOT||pointer to start (bottom) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16412||STKEND||pointer to end (top) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16414||BERG||Calculator's b register.&lt;br /&gt;
|-&lt;br /&gt;
|16415||MEM||Address of area used for calculator's memory. (Usually MEMBOT, but not always.)&lt;br /&gt;
|-&lt;br /&gt;
|16417|| ||not used	&lt;br /&gt;
|-&lt;br /&gt;
|16418||DF_SZ||The number of lines (including one blank line) in the lower part of the screen.&lt;br /&gt;
|-&lt;br /&gt;
|16419||S_TOP||The number of the top program line in automatic listings.&lt;br /&gt;
|-&lt;br /&gt;
|16421||LAST_K||Shows which keys pressed.&lt;br /&gt;
|- &lt;br /&gt;
|16423|| || Debounce status of keyboard.&lt;br /&gt;
|-&lt;br /&gt;
|16424||MARGIN||Number of blank lines above or below picture: 55 in Britain, 31 in America.&lt;br /&gt;
|-&lt;br /&gt;
|16425||NXTLIN||Address of next program line to be executed.&lt;br /&gt;
|-&lt;br /&gt;
|16427||OLDPPC||Line number of which CONT jumps.&lt;br /&gt;
|-&lt;br /&gt;
|16429||FLAGX||Various flags.&lt;br /&gt;
|-&lt;br /&gt;
|16430||STRLEN||Length of string type destination in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16432||T_ADDR||Address of next item in syntax table (very unlikely to be useful).&lt;br /&gt;
|-&lt;br /&gt;
|16434||SEED||The seed for RND. This is the variable that is set by RAND.&lt;br /&gt;
|-&lt;br /&gt;
16436||FRAMES||Counts the frames displayed on the television. Bit 15 is 1. Bits 0 to 14 are decremented for each frame set to the television. This can be used for timing, but PAUSE also uses it. PAUSE resets to 0 bit 15, &amp;amp; puts in bits 0 to 14 the length of the pause. When these have been counted down to zero, the pause stops. If the pause stops because of a key depression, bit 15 is set to 1 again.&lt;br /&gt;
|-&lt;br /&gt;
|16438||COORDS||x-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16439||		|| y-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16440||PR_CC||Less significant byte of address of next position for LPRINT to print as (in PRBUFF).&lt;br /&gt;
|-&lt;br /&gt;
|16441||S_POSN||Column number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16442||		 ||Line number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16443||CDFLAG||Various flags. Bit 7 is on (1) during compute &amp;amp; display mode.&lt;br /&gt;
|-&lt;br /&gt;
|16444||PRBUFF||Printer buffer (33rd character is NEWLINE).&lt;br /&gt;
|-&lt;br /&gt;
|16477||MEMBOT||Calculator's memory area; used to store numbers that cannot conveniently be put on the calculator stack.&lt;br /&gt;
|-&lt;br /&gt;
|16507|| || not used&lt;br /&gt;
|-&lt;br /&gt;
|16509|| ||            First BASIC line.&lt;br /&gt;
 |}&lt;br /&gt;
  &lt;br /&gt;
Each BASIC line is stored as:&lt;br /&gt;
 &lt;br /&gt;
  2 byte line number (in big-endian format)&lt;br /&gt;
  2 byte length of text including NEWLINE (in little endian format, length &amp;quot;excludes&amp;quot; the line number and length, i.e. to skip between lines you add &amp;quot;length of text&amp;quot; +4 bytes.&lt;br /&gt;
  text (BASIC tokens)&lt;br /&gt;
  NEWLINE (0x76)&lt;br /&gt;
&lt;br /&gt;
When a numeric constant is included in the text of a BASIC line, an ASCII string displaying the constant value will be inserted, followed by the token 0x7E, and the next 5 bytes are the value of the constant in floating point format.&lt;br /&gt;
&lt;br /&gt;
Following the last BASIC line comes the VARIABLEs table. Each entry in this table is of varying length and format. The first byte in each entry is the variable name, of which the upper 3 bits indicate the variable type.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Variable Name&amp;quot; | Variable Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
|-|011nnnnn|| single letter variable name, followed by 5 byte number&lt;br /&gt;
|-|101nnnnn ||multi letter variable name (last letter has high bit set), followed by 5 byte number&lt;br /&gt;
|-|100nnnnn || array of numbers: &lt;br /&gt;
|-|111nnnnnn || control variable of a for-next loop&lt;br /&gt;
|-|010nnnnn ||single letter variable name - 0x20, 2 byte string length, text of string&lt;br /&gt;
|-|110nnnnn || array of characters&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
[http://www.worldofspectrum.org/ZX81BasicProgramming/ ZX81 BASIC Programming]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file</id>
		<title>Sinclair BASIC tokenized file</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file"/>
				<updated>2013-05-22T21:33:22Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: fixed table layout error&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sinclair BASIC is a dialect of the BASIC programming language created by  by Nine Tiles Networks Ltd and  used in the 8-bit home computers from Sinclair Research and Timex Sinclair.&lt;br /&gt;
&lt;br /&gt;
The original 4KB version was developed for the Sinclair ZX80, followed by an 8KB version for the ZX81 and 16 KB version for ZX Spectrum.&lt;br /&gt;
&lt;br /&gt;
Some unusual features of the Sinclair BASIC:&lt;br /&gt;
* There were keys on the keyboard for each BASIC keyword. For example, pressing P caused the entire command PRINT to appear. Some commands needed multiple keypresses to enter, For example, BEEP  was keyed by pressing CAPS SHIFT plus SYMBOL SHIFT to access extended mode, keeping SYMBOL SHIFT held down and pressing Z. &lt;br /&gt;
* When programs where SAVEd, the file written to disk or tape contained all of BASIC's internal state information, including the values of any defined basic variables, as well as the BASIC tokens. &lt;br /&gt;
&lt;br /&gt;
=== BASIC File  Layout ===&lt;br /&gt;
On a ZX81 , a saved BASIC file is a snapshot of the computer memory from memory location 16393 through to the end of the variable table. There is no header.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Memory Address&amp;quot; | Address&lt;br /&gt;
! title=&amp;quot;Name&amp;quot; | Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|16393||VERSN	||0 Identifies ZX81 BASIC in saved programs.&lt;br /&gt;
|-&lt;br /&gt;
|16394||E_PPC||Number of current line (with program cursor).&lt;br /&gt;
|-&lt;br /&gt;
|16396||D_FILE||Pointer to the start of the 'Display file', i.e. what is being displayed on screen&lt;br /&gt;
|-&lt;br /&gt;
|16398||DF_CC||Address of PRINT position in display file. Can be poked so that PRINT output is sent elsewhere.&lt;br /&gt;
|-&lt;br /&gt;
|16400||VARS||Pointer to start of BASIC Variable table&lt;br /&gt;
|-&lt;br /&gt;
|16402||DEST||Address of variable in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16404||E_LINE||Pointer to line currently being entered&lt;br /&gt;
|-&lt;br /&gt;
|16406||CH_ADD||Address of the next character to be interpreted: the character after the argument of PEEK, or the NEWLINE at the end of a POKE statement.&lt;br /&gt;
|-&lt;br /&gt;
|16408||X_PTR||Address of the character preceding the  marker.&lt;br /&gt;
|-&lt;br /&gt;
|16410||STKBOT||pointer to start (bottom) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16412||STKEND||pointer to end (top) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16414||BERG||Calculator's b register.&lt;br /&gt;
|-&lt;br /&gt;
|16415||MEM||Address of area used for calculator's memory. (Usually MEMBOT, but not always.)&lt;br /&gt;
|-&lt;br /&gt;
|16417|| ||not used	&lt;br /&gt;
|-&lt;br /&gt;
|16418||DF_SZ||The number of lines (including one blank line) in the lower part of the screen.&lt;br /&gt;
|-&lt;br /&gt;
|16419||S_TOP||The number of the top program line in automatic listings.&lt;br /&gt;
|-&lt;br /&gt;
|16421||LAST_K||Shows which keys pressed.&lt;br /&gt;
|- &lt;br /&gt;
|16423|| || Debounce status of keyboard.&lt;br /&gt;
|-&lt;br /&gt;
|16424||MARGIN||Number of blank lines above or below picture: 55 in Britain, 31 in America.&lt;br /&gt;
|-&lt;br /&gt;
|16425||NXTLIN||Address of next program line to be executed.&lt;br /&gt;
|-&lt;br /&gt;
|16427||OLDPPC||Line number of which CONT jumps.&lt;br /&gt;
|-&lt;br /&gt;
|16429||FLAGX||Various flags.&lt;br /&gt;
|-&lt;br /&gt;
|16430||STRLEN||Length of string type destination in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16432||T_ADDR||Address of next item in syntax table (very unlikely to be useful).&lt;br /&gt;
|-&lt;br /&gt;
|16434||SEED||The seed for RND. This is the variable that is set by RAND.&lt;br /&gt;
|-&lt;br /&gt;
16436||FRAMES||Counts the frames displayed on the television. Bit 15 is 1. Bits 0 to 14 are decremented for each frame set to the television. This can be used for timing, but PAUSE also uses it. PAUSE resets to 0 bit 15, &amp;amp; puts in bits 0 to 14 the length of the pause. When these have been counted down to zero, the pause stops. If the pause stops because of a key depression, bit 15 is set to 1 again.&lt;br /&gt;
|-&lt;br /&gt;
|16438||COORDS||x-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16439||		|| y-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16440||PR_CC||Less significant byte of address of next position for LPRINT to print as (in PRBUFF).&lt;br /&gt;
|-&lt;br /&gt;
|16441||S_POSN||Column number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16442||		 ||Line number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16443||CDFLAG||Various flags. Bit 7 is on (1) during compute &amp;amp; display mode.&lt;br /&gt;
|-&lt;br /&gt;
|16444||PRBUFF||Printer buffer (33rd character is NEWLINE).&lt;br /&gt;
|-&lt;br /&gt;
|16477||MEMBOT||Calculator's memory area; used to store numbers that cannot conveniently be put on the calculator stack.&lt;br /&gt;
|-&lt;br /&gt;
|16507|| || not used&lt;br /&gt;
|-&lt;br /&gt;
|16509|| ||            First BASIC line.&lt;br /&gt;
 |}&lt;br /&gt;
  &lt;br /&gt;
Each BASIC line is stored as:&lt;br /&gt;
 &lt;br /&gt;
  2 byte line number (in big-endian format)&lt;br /&gt;
  2 byte length of text including NEWLINE (in little endian format, length &amp;quot;excludes&amp;quot; the line number and length, i.e. to skip between lines you add &amp;quot;length of text&amp;quot; +4 bytes.&lt;br /&gt;
  text (BASIC tokens)&lt;br /&gt;
  NEWLINE (0x76)&lt;br /&gt;
&lt;br /&gt;
When a numeric constant is included in the text of a BASIC line, an ASCII string displaying the constant value will be inserted, followed by the token 0x7E, and the next 5 bytes are the value of the constant in floating point format.&lt;br /&gt;
&lt;br /&gt;
Following the last BASIC line comes the VARIABLEs table.&lt;br /&gt;
&lt;br /&gt;
      #first byte of name implies type:&lt;br /&gt;
      #011nnnnn = single letter variable name, followed by 5 byte number&lt;br /&gt;
      #101nnnnn = multi letter variable name (last letter has high bit set), followed by 5 byte number&lt;br /&gt;
      #100nnnnn = array of numbers: &lt;br /&gt;
      #111nnnnnn = control variable of a for-next loop&lt;br /&gt;
      #010nnnnn = single letter variable name - 0x20, 2 byte string length, text of string&lt;br /&gt;
      #110nnnnn = array of characters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
[]http://www.worldofspectrum.org/ZX81BasicProgramming/ ZX81 BASIC Programming]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file</id>
		<title>Sinclair BASIC tokenized file</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Sinclair_BASIC_tokenized_file"/>
				<updated>2013-05-22T21:32:43Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: initial version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Sinclair BASIC is a dialect of the BASIC programming language created by  by Nine Tiles Networks Ltd and  used in the 8-bit home computers from Sinclair Research and Timex Sinclair.&lt;br /&gt;
&lt;br /&gt;
The original 4KB version was developed for the Sinclair ZX80, followed by an 8KB version for the ZX81 and 16 KB version for ZX Spectrum.&lt;br /&gt;
&lt;br /&gt;
Some unusual features of the Sinclair BASIC:&lt;br /&gt;
* There were keys on the keyboard for each BASIC keyword. For example, pressing P caused the entire command PRINT to appear. Some commands needed multiple keypresses to enter, For example, BEEP  was keyed by pressing CAPS SHIFT plus SYMBOL SHIFT to access extended mode, keeping SYMBOL SHIFT held down and pressing Z. &lt;br /&gt;
* When programs where SAVEd, the file written to disk or tape contained all of BASIC's internal state information, including the values of any defined basic variables, as well as the BASIC tokens. &lt;br /&gt;
&lt;br /&gt;
=== BASIC File  Layout ===&lt;br /&gt;
On a ZX81 , a saved BASIC file is a snapshot of the computer memory from memory location 16393 through to the end of the variable table. There is no header.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! title=&amp;quot;Memory Address&amp;quot; | Address&lt;br /&gt;
! title=&amp;quot;Name&amp;quot; | Name&lt;br /&gt;
! title=&amp;quot;Description&amp;quot; |Description&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|16393||VERSN	||0 Identifies ZX81 BASIC in saved programs.&lt;br /&gt;
|-&lt;br /&gt;
|16394||E_PPC||Number of current line (with program cursor).&lt;br /&gt;
|-&lt;br /&gt;
|16396||D_FILE||Pointer to the start of the 'Display file', i.e. what is being displayed on screen&lt;br /&gt;
|-&lt;br /&gt;
|16398||DF_CC||Address of PRINT position in display file. Can be poked so that PRINT output is sent elsewhere.&lt;br /&gt;
|-&lt;br /&gt;
|16400||VARS||Pointer to start of BASIC Variable table&lt;br /&gt;
|-&lt;br /&gt;
|16402||DEST||Address of variable in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16404||E_LINE||Pointer to line currently being entered&lt;br /&gt;
|-&lt;br /&gt;
|16406||CH_ADD||Address of the next character to be interpreted: the character after the argument of PEEK, or the NEWLINE at the end of a POKE statement.&lt;br /&gt;
|-&lt;br /&gt;
|16408||X_PTR||Address of the character preceding the  marker.&lt;br /&gt;
|-&lt;br /&gt;
|16410||STKBOT||pointer to start (bottom) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16412||STKEND||pointer to end (top) of stack&lt;br /&gt;
|-&lt;br /&gt;
|16414||BERG||Calculator's b register.&lt;br /&gt;
|-&lt;br /&gt;
|16415||MEM||Address of area used for calculator's memory. (Usually MEMBOT, but not always.)&lt;br /&gt;
|-&lt;br /&gt;
|16417|| ||not used	&lt;br /&gt;
|-&lt;br /&gt;
|16418||DF_SZ||The number of lines (including one blank line) in the lower part of the screen.&lt;br /&gt;
|-&lt;br /&gt;
|16419||S_TOP||The number of the top program line in automatic listings.&lt;br /&gt;
|-&lt;br /&gt;
|16421||LAST_K||Shows which keys pressed.&lt;br /&gt;
|- &lt;br /&gt;
|16423|| || Debounce status of keyboard.&lt;br /&gt;
|-&lt;br /&gt;
|16424||MARGIN||Number of blank lines above or below picture: 55 in Britain, 31 in America.&lt;br /&gt;
|-&lt;br /&gt;
|16425||NXTLIN||Address of next program line to be executed.&lt;br /&gt;
|-&lt;br /&gt;
|16427||OLDPPC||Line number of which CONT jumps.&lt;br /&gt;
|-&lt;br /&gt;
|16429||FLAGX||Various flags.&lt;br /&gt;
|-&lt;br /&gt;
|16430||STRLEN||Length of string type destination in assignment.&lt;br /&gt;
|-&lt;br /&gt;
|16432||T_ADDR||Address of next item in syntax table (very unlikely to be useful).&lt;br /&gt;
|-&lt;br /&gt;
|16434||SEED||The seed for RND. This is the variable that is set by RAND.&lt;br /&gt;
|-&lt;br /&gt;
16436||FRAMES||Counts the frames displayed on the television. Bit 15 is 1. Bits 0 to 14 are decremented for each frame set to the television. This can be used for timing, but PAUSE also uses it. PAUSE resets to 0 bit 15, &amp;amp; puts in bits 0 to 14 the length of the pause. When these have been counted down to zero, the pause stops. If the pause stops because of a key depression, bit 15 is set to 1 again.&lt;br /&gt;
|-&lt;br /&gt;
|16438||COORDS||x-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16439||		|| y-coordinate of last point PLOTted.&lt;br /&gt;
|-&lt;br /&gt;
|16440||PR_CC||Less significant byte of address of next position for LPRINT to print as (in PRBUFF).&lt;br /&gt;
|-&lt;br /&gt;
|16441||S_POSN||Column number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16442||		 ||Line number for PRINT position.&lt;br /&gt;
|-&lt;br /&gt;
|16443||CDFLAG||Various flags. Bit 7 is on (1) during compute &amp;amp; display mode.&lt;br /&gt;
|-&lt;br /&gt;
|16444||PRBUFF||Printer buffer (33rd character is NEWLINE).&lt;br /&gt;
|-&lt;br /&gt;
|16477||MEMBOT||Calculator's memory area; used to store numbers that cannot conveniently be put on the calculator stack.&lt;br /&gt;
|-&lt;br /&gt;
|16507|| || not used&lt;br /&gt;
|-&lt;br /&gt;
|16509|| ||            First BASIC line.&lt;br /&gt;
   &lt;br /&gt;
Each BASIC line is stored as:&lt;br /&gt;
 &lt;br /&gt;
  2 byte line number (in big-endian format)&lt;br /&gt;
  2 byte length of text including NEWLINE (in little endian format, length &amp;quot;excludes&amp;quot; the line number and length, i.e. to skip between lines you add &amp;quot;length of text&amp;quot; +4 bytes.&lt;br /&gt;
  text (BASIC tokens)&lt;br /&gt;
  NEWLINE (0x76)&lt;br /&gt;
&lt;br /&gt;
When a numeric constant is included in the text of a BASIC line, an ASCII string displaying the constant value will be inserted, followed by the token 0x7E, and the next 5 bytes are the value of the constant in floating point format.&lt;br /&gt;
&lt;br /&gt;
Following the last BASIC line comes the VARIABLEs table.&lt;br /&gt;
&lt;br /&gt;
      #first byte of name implies type:&lt;br /&gt;
      #011nnnnn = single letter variable name, followed by 5 byte number&lt;br /&gt;
      #101nnnnn = multi letter variable name (last letter has high bit set), followed by 5 byte number&lt;br /&gt;
      #100nnnnn = array of numbers: &lt;br /&gt;
      #111nnnnnn = control variable of a for-next loop&lt;br /&gt;
      #010nnnnn = single letter variable name - 0x20, 2 byte string length, text of string&lt;br /&gt;
      #110nnnnn = array of characters&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
[]http://www.worldofspectrum.org/ZX81BasicProgramming/ ZX81 BASIC Programming]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Tokenized_BASIC</id>
		<title>Tokenized BASIC</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Tokenized_BASIC"/>
				<updated>2013-05-22T20:35:53Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: add link to Sinclair BASIC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|subcat=Source code&lt;br /&gt;
|thiscat=Tokenized BASIC&lt;br /&gt;
|extensions={{ext|bas}}&lt;br /&gt;
|image=Sol-screen.jpg&lt;br /&gt;
|caption=Sol BASIC screen shot (as simulated in Solace)&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Tokenized BASIC''' is a method of storing programs in the [[BASIC]] programming language by encoding the various keywords of the language as &amp;quot;tokens&amp;quot; instead of as plain text. Since the tokens are shorter byte sequences than the full text of the keywords, such programs take up less storage space in memory and in external storage such as disks or tapes, which was a significant concern in an era when computers were much more limited in memory and disk space than they are at present. It can also take less processing time for the interpreters to parse the code when it is in the form of tokens, which is another important concern for slower computers. Since computers are much faster and have much more memory and disk space now, tokenized languages are rarely used for source code storage, though compilers may generate intermediate data that is tokenized in some way in the course of producing executable code from text-based sources.&lt;br /&gt;
&lt;br /&gt;
In its heyday of the 1960s through 1980s, BASIC existed in many dialects, designed for specific machine platforms, and the format of tokenized programs was different in each. On systems where file types were commonly identified using extensions, '''.BAS''' was usually used for BASIC programs, while other systems had their own ways of identifying file types and often had a type code specific to their own platform's BASIC interpreter (or multiple codes for different versions of BASIC, such as Apple II DOS's 'I' for Integer BASIC and 'A' for Applesoft floating-point BASIC).&lt;br /&gt;
&lt;br /&gt;
People intending to transfer BASIC programs cross-system would usually export them in text form by piping the output of the LIST command to a text file (which sometimes required special tweaking to get the proper format; for instance, on the Apple II, one needed to do a poke first: '''POKE 33,33''', to set the screen window width narrow enough to defeat the automatic insertion of padding spaces on normal-size lines). Some BASICs made things easier by offering a &amp;quot;save-as-text&amp;quot; option in the SAVE command (sometimes appending &amp;quot;,A&amp;quot;, with A for ASCII, worked). Cross-system porting usually required considerable program revision as well due to the great differences between different BASIC dialects.&lt;br /&gt;
&lt;br /&gt;
Specific tokenized BASIC formats:&lt;br /&gt;
&lt;br /&gt;
* [[APF Imagination Machine BASIC tokenized file]]&lt;br /&gt;
* [[Apple Integer BASIC tokenized file]]&lt;br /&gt;
* [[Applesoft BASIC tokenized file]]&lt;br /&gt;
* [[Atari BASIC tokenized file]]&lt;br /&gt;
* [[BBC BASIC tokenized file]]&lt;br /&gt;
* [[Coleco Adam SmartBASIC tokenized file]]&lt;br /&gt;
* [[Commodore BASIC tokenized file]]&lt;br /&gt;
* [[Compucolor BASIC tokenized file]]&lt;br /&gt;
* [[Exidy Sorcerer BASIC tokenized file]]&lt;br /&gt;
* [[GW-BASIC tokenized file]] (or BASICA) (IBM PC and compatibles)&lt;br /&gt;
* [[MBASIC tokenized file]] (Microsoft BASIC for CP/M)&lt;br /&gt;
* [[NASCOM BASIC tokenized file]]&lt;br /&gt;
* [[Ohio Scientific BASIC tokenized file]]&lt;br /&gt;
* [[Sinclair BASIC tokenized file]] (for ZX80, ZX81 and Spectrum)&lt;br /&gt;
* [[Sol BASIC tokenized file]]&lt;br /&gt;
* [[TI BASIC tokenized file]] (TI 99/4A)&lt;br /&gt;
* [[Tiny BASIC tokenized file]] (ran on KIM-1 and some other early machines)&lt;br /&gt;
* [[TRS-80 Color BASIC tokenized file]]&lt;br /&gt;
* [[TRS-80 Level II BASIC tokenized file]]&lt;br /&gt;
&lt;br /&gt;
As a bit of trivia, three of the companies referenced above are named after U.S. states: Texas Instruments (TI), Ohio Scientific, and Connecticut Leather Company (Coleco).&lt;br /&gt;
&lt;br /&gt;
== Links and references ==&lt;br /&gt;
* [http://edmond.orignac.pagesperso-orange.fr/detokenizer.html Detokenizers for Microsoft BASICs]&lt;br /&gt;
* [http://www.pagetable.com/?p=46 Microsoft 6502 BASIC archeology]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Tokenized_BASIC</id>
		<title>Tokenized BASIC</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Tokenized_BASIC"/>
				<updated>2013-05-22T20:35:25Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|subcat=Source code&lt;br /&gt;
|thiscat=Tokenized BASIC&lt;br /&gt;
|extensions={{ext|bas}}&lt;br /&gt;
|image=Sol-screen.jpg&lt;br /&gt;
|caption=Sol BASIC screen shot (as simulated in Solace)&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Tokenized BASIC''' is a method of storing programs in the [[BASIC]] programming language by encoding the various keywords of the language as &amp;quot;tokens&amp;quot; instead of as plain text. Since the tokens are shorter byte sequences than the full text of the keywords, such programs take up less storage space in memory and in external storage such as disks or tapes, which was a significant concern in an era when computers were much more limited in memory and disk space than they are at present. It can also take less processing time for the interpreters to parse the code when it is in the form of tokens, which is another important concern for slower computers. Since computers are much faster and have much more memory and disk space now, tokenized languages are rarely used for source code storage, though compilers may generate intermediate data that is tokenized in some way in the course of producing executable code from text-based sources.&lt;br /&gt;
&lt;br /&gt;
In its heyday of the 1960s through 1980s, BASIC existed in many dialects, designed for specific machine platforms, and the format of tokenized programs was different in each. On systems where file types were commonly identified using extensions, '''.BAS''' was usually used for BASIC programs, while other systems had their own ways of identifying file types and often had a type code specific to their own platform's BASIC interpreter (or multiple codes for different versions of BASIC, such as Apple II DOS's 'I' for Integer BASIC and 'A' for Applesoft floating-point BASIC).&lt;br /&gt;
&lt;br /&gt;
People intending to transfer BASIC programs cross-system would usually export them in text form by piping the output of the LIST command to a text file (which sometimes required special tweaking to get the proper format; for instance, on the Apple II, one needed to do a poke first: '''POKE 33,33''', to set the screen window width narrow enough to defeat the automatic insertion of padding spaces on normal-size lines). Some BASICs made things easier by offering a &amp;quot;save-as-text&amp;quot; option in the SAVE command (sometimes appending &amp;quot;,A&amp;quot;, with A for ASCII, worked). Cross-system porting usually required considerable program revision as well due to the great differences between different BASIC dialects.&lt;br /&gt;
&lt;br /&gt;
Specific tokenized BASIC formats:&lt;br /&gt;
&lt;br /&gt;
* [[APF Imagination Machine BASIC tokenized file]]&lt;br /&gt;
* [[Apple Integer BASIC tokenized file]]&lt;br /&gt;
* [[Applesoft BASIC tokenized file]]&lt;br /&gt;
* [[Atari BASIC tokenized file]]&lt;br /&gt;
* [[BBC BASIC tokenized file]]&lt;br /&gt;
* [[Coleco Adam SmartBASIC tokenized file]]&lt;br /&gt;
* [[Commodore BASIC tokenized file]]&lt;br /&gt;
* [[Compucolor BASIC tokenized file]]&lt;br /&gt;
* [[Exidy Sorcerer BASIC tokenized file]]&lt;br /&gt;
* [[GW-BASIC tokenized file]] (or BASICA) (IBM PC and compatibles)&lt;br /&gt;
* [[MBASIC tokenized file]] (Microsoft BASIC for CP/M)&lt;br /&gt;
* [[NASCOM BASIC tokenized file]]&lt;br /&gt;
* [[Ohio Scientific BASIC tokenized file]]&lt;br /&gt;
* [[Sinclair BASIC tokenized file]] for ZX80, ZX81 and Spectrum&lt;br /&gt;
* [[Sol BASIC tokenized file]]&lt;br /&gt;
* [[TI BASIC tokenized file]] (TI 99/4A)&lt;br /&gt;
* [[Tiny BASIC tokenized file]] (ran on KIM-1 and some other early machines)&lt;br /&gt;
* [[TRS-80 Color BASIC tokenized file]]&lt;br /&gt;
* [[TRS-80 Level II BASIC tokenized file]]&lt;br /&gt;
&lt;br /&gt;
As a bit of trivia, three of the companies referenced above are named after U.S. states: Texas Instruments (TI), Ohio Scientific, and Connecticut Leather Company (Coleco).&lt;br /&gt;
&lt;br /&gt;
== Links and references ==&lt;br /&gt;
* [http://edmond.orignac.pagesperso-orange.fr/detokenizer.html Detokenizers for Microsoft BASICs]&lt;br /&gt;
* [http://www.pagetable.com/?p=46 Microsoft 6502 BASIC archeology]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Tokenized_BASIC</id>
		<title>Tokenized BASIC</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Tokenized_BASIC"/>
				<updated>2013-05-22T20:33:42Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|subcat=Source code&lt;br /&gt;
|thiscat=Tokenized BASIC&lt;br /&gt;
|extensions={{ext|bas}}&lt;br /&gt;
|image=Sol-screen.jpg&lt;br /&gt;
|caption=Sol BASIC screen shot (as simulated in Solace)&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Tokenized BASIC''' is a method of storing programs in the [[BASIC]] programming language by encoding the various keywords of the language as &amp;quot;tokens&amp;quot; instead of as plain text. Since the tokens are shorter byte sequences than the full text of the keywords, such programs take up less storage space in memory and in external storage such as disks or tapes, which was a significant concern in an era when computers were much more limited in memory and disk space than they are at present. It can also take less processing time for the interpreters to parse the code when it is in the form of tokens, which is another important concern for slower computers. Since computers are much faster and have much more memory and disk space now, tokenized languages are rarely used for source code storage, though compilers may generate intermediate data that is tokenized in some way in the course of producing executable code from text-based sources.&lt;br /&gt;
&lt;br /&gt;
In its heyday of the 1960s through 1980s, BASIC existed in many dialects, designed for specific machine platforms, and the format of tokenized programs was different in each. On systems where file types were commonly identified using extensions, '''.BAS''' was usually used for BASIC programs, while other systems had their own ways of identifying file types and often had a type code specific to their own platform's BASIC interpreter (or multiple codes for different versions of BASIC, such as Apple II DOS's 'I' for Integer BASIC and 'A' for Applesoft floating-point BASIC).&lt;br /&gt;
&lt;br /&gt;
People intending to transfer BASIC programs cross-system would usually export them in text form by piping the output of the LIST command to a text file (which sometimes required special tweaking to get the proper format; for instance, on the Apple II, one needed to do a poke first: '''POKE 33,33''', to set the screen window width narrow enough to defeat the automatic insertion of padding spaces on normal-size lines). Some BASICs made things easier by offering a &amp;quot;save-as-text&amp;quot; option in the SAVE command (sometimes appending &amp;quot;,A&amp;quot;, with A for ASCII, worked). Cross-system porting usually required considerable program revision as well due to the great differences between different BASIC dialects.&lt;br /&gt;
&lt;br /&gt;
Specific tokenized BASIC formats:&lt;br /&gt;
&lt;br /&gt;
* [[APF Imagination Machine BASIC tokenized file]]&lt;br /&gt;
* [[Apple Integer BASIC tokenized file]]&lt;br /&gt;
* [[Applesoft BASIC tokenized file]]&lt;br /&gt;
* [[Atari BASIC tokenized file]]&lt;br /&gt;
* [[BBC BASIC tokenized file]]&lt;br /&gt;
* [[Coleco Adam SmartBASIC tokenized file]]&lt;br /&gt;
* [[Commodore BASIC tokenized file]]&lt;br /&gt;
* [[Compucolor BASIC tokenized file]]&lt;br /&gt;
* [[Exidy Sorcerer BASIC tokenized file]]&lt;br /&gt;
* [[GW-BASIC tokenized file]] (or BASICA) (IBM PC and compatibles)&lt;br /&gt;
* [[MBASIC tokenized file]] (Microsoft BASIC for CP/M)&lt;br /&gt;
* [[NASCOM BASIC tokenized file]]&lt;br /&gt;
* [[Ohio Scientific BASIC tokenized file]]&lt;br /&gt;
* [[Sinclair ZX81 BASIC tokenized file]]&lt;br /&gt;
* [[Sol BASIC tokenized file]]&lt;br /&gt;
* [[TI BASIC tokenized file]] (TI 99/4A)&lt;br /&gt;
* [[Tiny BASIC tokenized file]] (ran on KIM-1 and some other early machines)&lt;br /&gt;
* [[TRS-80 Color BASIC tokenized file]]&lt;br /&gt;
* [[TRS-80 Level II BASIC tokenized file]]&lt;br /&gt;
&lt;br /&gt;
As a bit of trivia, three of the companies referenced above are named after U.S. states: Texas Instruments (TI), Ohio Scientific, and Connecticut Leather Company (Coleco).&lt;br /&gt;
&lt;br /&gt;
== Links and references ==&lt;br /&gt;
* [http://edmond.orignac.pagesperso-orange.fr/detokenizer.html Detokenizers for Microsoft BASICs]&lt;br /&gt;
* [http://www.pagetable.com/?p=46 Microsoft 6502 BASIC archeology]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Talk:DOS_executable_(.com)</id>
		<title>Talk:DOS executable (.com)</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Talk:DOS_executable_(.com)"/>
				<updated>2013-05-21T08:27:10Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== fixed vs relative addressing? ==&lt;br /&gt;
&lt;br /&gt;
re ''They can only use relative adressing'' - in 8086 mode, a memory address is either&lt;br /&gt;
- relative within a segment,&lt;br /&gt;
- absolute within a segment &lt;br /&gt;
- absolute including a segment address &lt;br /&gt;
&lt;br /&gt;
While it is unknown what segment a given COM file will be loaded into, it IS known (as specified) that it will be loaded from offset 0x100 into that segment. So intra-segment absolute addressing is perfectly valid. [[User talk:jonnosan|jonnosan]] 8:26 21 May 2013(UTC)&lt;br /&gt;
&lt;br /&gt;
== compressed executable vs commandline program ==&lt;br /&gt;
&lt;br /&gt;
Thanks for fixing the initial page. My source, a paper about the file utility mentioned  .com files being compressed executables. Guess I should cite more... [[User:Maurice.de.rooij|Maurice.de.rooij]] ([[User talk:Maurice.de.rooij|talk]]) 07:28, 6 December 2012 (UTC)&lt;br /&gt;
* [http://scholar.google.nl/scholar?cluster=7943745569952873113 Extensions of the UNIX File Command and Magic File for File Type Identification]&lt;br /&gt;
:Ah, yes, that seems a bit wrong (unless they talk about some other, specific COM file). I wanted to add COM some time ago anyway (when I did EXE), but it somehow got lost due to my being busy recently. I just happened to notice it in the &amp;quot;recent changes&amp;quot; and fixed it. On some unrelated note, why can't we delete (or move/rename) any pages? There are a few now that are blanked because they were moved. Is delete/move only for administrators? --[[User:Darkstar|Darkstar]] ([[User talk:Darkstar|talk]]) 17:22, 6 December 2012 (UTC)&lt;br /&gt;
::&amp;quot;Move&amp;quot; exists in the pull-down menu to the right of &amp;quot;View history&amp;quot;. I think &amp;quot;Delete&amp;quot; is reserved for admins, though. [[User:Dan Tobias|Dan Tobias]] ([[User talk:Dan Tobias|talk]]) 18:16, 6 December 2012 (UTC)&lt;br /&gt;
:: There seems not to exist such thing as compressed executable COM file, after an extensive search on the Google. Because the source was a university paper, I wrongly assumed that it didnt need verification. Another lesson learned... [[User:Maurice.de.rooij|Maurice.de.rooij]] ([[User talk:Maurice.de.rooij|talk]]) 18:37, 6 December 2012 (UTC)&lt;br /&gt;
::: Ah, indeed, I didn't see the &amp;quot;move&amp;quot; up there. Could have made my editing a bit more transparent. --[[User:Darkstar|Darkstar]] ([[User talk:Darkstar|talk]]) 22:22, 6 December 2012 (UTC)&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Commodore_64_binary_executable</id>
		<title>Commodore 64 binary executable</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Commodore_64_binary_executable"/>
				<updated>2013-05-20T23:27:11Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: add ref to CBMFS directory structure&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|subcat=Executables&lt;br /&gt;
|extensions={{ext|prg}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Binary files intended to be executed on a Commodore 64 (or emulator of it) are often stored with the extension .prg. (In the original Commodore environment, they generally didn't have an extension but had file type &amp;quot;PRG&amp;quot; in the [[CBMFS#CBM_DOS_Directory_Structure | directory structure]].) &lt;br /&gt;
&lt;br /&gt;
The first two bytes in a PRG file are the memory address that the file should be loaded into (in little-endian format). For a C64 [[Commodore BASIC tokenized file]] file, intended to be loaded into $801, these bytes are $01,$08. Note that these bytes will be ignored (i.e. a PRG file will be loaded into $801) UNLESS the LOAD command had a non-zero parameter after the device number. i.e. LOAD &amp;quot;*&amp;quot;,8 will load a file from device 8 (the typical device number for a disk drive) into $801, while LOAD &amp;quot;*&amp;quot;,8,1 will load a file into whatever memory address is specified by the first 2 bytes of the PRG. &lt;br /&gt;
&lt;br /&gt;
== Programs and utilities ==&lt;br /&gt;
* [http://search.cpan.org/~pawelkrol/D64-File-PRG-0.02/lib/D64/File/PRG.pm D64::File::PRG library for Perl to handle PRG files.]&lt;br /&gt;
&lt;br /&gt;
[[Category:Commodore computers]]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/CBMFS</id>
		<title>CBMFS</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/CBMFS"/>
				<updated>2013-05-20T23:23:31Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: add directory structure heading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|formattype=electronic&lt;br /&gt;
|subcat=Filesystem&lt;br /&gt;
}}&lt;br /&gt;
The CBM File System was used by disk drives made by Commodore Business Machines for the  PET, VIC-20, C64 and C128 range of computers. These drives were called 'intelligent peripherals' meaning the DOS (Disk Operating System) was runs in the drive itself, not on the computer the drive was attached to.&lt;br /&gt;
&lt;br /&gt;
The most popular CBM drive was the 1541, which supported 35 tracks using GCR encoding. &lt;br /&gt;
&lt;br /&gt;
==D64 File Format ==&lt;br /&gt;
&lt;br /&gt;
The [[D64]] format is most frequently used to capture 1541 disk images, it consists of a sector-for-sector copy of a 1540/1541 disk.  The standard D64 is a 174848 byte file comprised of 256 byte sectors arranged in 35 tracks with a varying number of  sectors  per  track for a total of 683 sectors. Track counting starts at 1, not 0, and goes  up&lt;br /&gt;
to 35. Sector counting starts at 0, not 1, for the first sector,  therefore a track with 21 sectors will go from 0 to 20.&lt;br /&gt;
&lt;br /&gt;
The original media (a 5.25&amp;quot; disk) has the tracks  laid  out  in  circles, with track 1 on the very outside of the disk  (closest  to  the  sides)  to track 35 being on the inside of the disk (closest to the inner  hub  ring). Commodore, in their infinite wisdom, varied the number of sectors per track and data densities across the disk to optimize available storage, resulting in the chart below. It shows the sectors/track for a  standard  D64.  Since the outside diameter of a circle is  the  largest  (versus  closer  to  the center), the outside tracks have the largest amount of storage.&lt;br /&gt;
&lt;br /&gt;
        Track   Sectors/track   # Sectors   Storage in Bytes&lt;br /&gt;
        -----   -------------   ---------   ----------------&lt;br /&gt;
         1-17        21            357           7820&lt;br /&gt;
        18-24        19            133           7170&lt;br /&gt;
        25-30        18            108           6300&lt;br /&gt;
        31-40(*)     17             85           6020&lt;br /&gt;
                                   ---&lt;br /&gt;
                                   683 (for a 35 track image)&lt;br /&gt;
&lt;br /&gt;
  Track #Sect #SectorsIn D64 Offset   Track #Sect #SectorsIn D64 Offset&lt;br /&gt;
  ----- ----- ---------- ----------   ----- ----- ---------- ----------&lt;br /&gt;
    1     21       0       $00000      21     19     414       $19E00&lt;br /&gt;
    2     21      21       $01500      22     19     433       $1B100&lt;br /&gt;
    3     21      42       $02A00      23     19     452       $1C400&lt;br /&gt;
    4     21      63       $03F00      24     19     471       $1D700&lt;br /&gt;
    5     21      84       $05400      25     18     490       $1EA00&lt;br /&gt;
    6     21     105       $06900      26     18     508       $1FC00&lt;br /&gt;
    7     21     126       $07E00      27     18     526       $20E00&lt;br /&gt;
    8     21     147       $09300      28     18     544       $22000&lt;br /&gt;
    9     21     168       $0A800      29     18     562       $23200&lt;br /&gt;
   10     21     189       $0BD00      30     18     580       $24400&lt;br /&gt;
   11     21     210       $0D200      31     17     598       $25600&lt;br /&gt;
   12     21     231       $0E700      32     17     615       $26700&lt;br /&gt;
   13     21     252       $0FC00      33     17     632       $27800&lt;br /&gt;
   14     21     273       $11100      34     17     649       $28900&lt;br /&gt;
   15     21     294       $12600      35     17     666       $29A00&lt;br /&gt;
   16     21     315       $13B00      36(*)  17     683       $2AB00&lt;br /&gt;
   17     21     336       $15000      37(*)  17     700       $2BC00&lt;br /&gt;
   18     19     357       $16500      38(*)  17     717       $2CD00&lt;br /&gt;
   19     19     376       $17800      39(*)  17     734       $2DE00&lt;br /&gt;
   20     19     395       $18B00      40(*)  17     751       $2EF00&lt;br /&gt;
&lt;br /&gt;
  (*)Tracks 36-40 apply to 40-track images only&lt;br /&gt;
&lt;br /&gt;
==CBM DOS Directory Structure ==&lt;br /&gt;
The directory track should be contained totally on track 18. Sectors 1-18&lt;br /&gt;
contain the entries and sector 0 contains the BAM (Block Availability  Map)&lt;br /&gt;
and disk name/ID. Since the directory is only 18 sectors large (19 less one&lt;br /&gt;
for the BAM), and each sector can contain only  8  entries  (32  bytes  per&lt;br /&gt;
entry), the maximum number of directory entries is 18 * 8 = 144. The  first&lt;br /&gt;
directory sector is always 18/1, even though the t/s pointer at 18/0 (first&lt;br /&gt;
two bytes) might point somewhere else.  It  then  follows  the  same  chain&lt;br /&gt;
structure as a normal file, using a sector interleave of 3. This makes  the&lt;br /&gt;
chain links go 18/1, 18/4, 18/7 etc.&lt;br /&gt;
&lt;br /&gt;
Note that you can extend the directory off  of  track  18,  but  only  when&lt;br /&gt;
reading the disk or image. Attempting to write to a directory sector not on&lt;br /&gt;
track 18 will cause directory corruption.&lt;br /&gt;
&lt;br /&gt;
Each directory sector has the following layout (18/1 partial dump):&lt;br /&gt;
&lt;br /&gt;
    00: 12 04 81 11 00 4E 41 4D 45 53 20 26 20 50 4F 53 &amp;lt;- notice the T/S link&lt;br /&gt;
    10: 49 54 A0 A0 A0 00 00 00 00 00 00 00 00 00 15 00 &amp;lt;- to 18/4 ($12/$04)&lt;br /&gt;
    20: 00 00 84 11 02 41 44 44 49 54 49 4F 4E 41 4C 20 &amp;lt;- and how its not here&lt;br /&gt;
    30: 49 4E 46 4F A0 11 0C FE 00 00 00 00 00 00 61 01 &amp;lt;- ($00/$00)&lt;br /&gt;
&lt;br /&gt;
The first two bytes of the sector ($12/$04) indicate the location of  the&lt;br /&gt;
next track/sector of the directory (18/4). If the track is set to $00, then&lt;br /&gt;
it is the last sector of the directory. It is possible,  however  unlikely,&lt;br /&gt;
that the directory may *not* be competely on track 18 (some disks do  exist&lt;br /&gt;
like this). Just follow the chain anyhow.&lt;br /&gt;
&lt;br /&gt;
When the directory is done, the track value will be $00. The sector  link&lt;br /&gt;
should contain a value of $FF, meaning the whole sector is  allocated,  but&lt;br /&gt;
the actual value doesn't matter. The drive will return  all  the  available&lt;br /&gt;
entries anyways. This is a breakdown of a  standard  directory  sector  and&lt;br /&gt;
entry:&lt;br /&gt;
&lt;br /&gt;
  Bytes: $00-1F: First directory entry&lt;br /&gt;
          00-01: Track/Sector location of next directory sector ($00 $00 if&lt;br /&gt;
                 not the first entry in the sector)&lt;br /&gt;
             02: File type.&lt;br /&gt;
                 Typical values for this location are:&lt;br /&gt;
                   $00 - Scratched (deleted file entry)&lt;br /&gt;
                    80 - DEL&lt;br /&gt;
                    81 - SEQ&lt;br /&gt;
                    82 - PRG&lt;br /&gt;
                    83 - USR&lt;br /&gt;
                    84 - REL&lt;br /&gt;
                 Bit 0-3: The actual filetype&lt;br /&gt;
                          000 (0) - DEL&lt;br /&gt;
                          001 (1) - SEQ&lt;br /&gt;
                          010 (2) - PRG&lt;br /&gt;
                          011 (3) - USR&lt;br /&gt;
                          100 (4) - REL&lt;br /&gt;
                          Values 5-15 are illegal, but if used will produce&lt;br /&gt;
                          very strange results. The 1541 is inconsistent in&lt;br /&gt;
                          how it treats these bits. Some routines use all 4&lt;br /&gt;
                          bits, others ignore bit 3,  resulting  in  values&lt;br /&gt;
                          from 0-7.&lt;br /&gt;
                 Bit   4: Not used&lt;br /&gt;
                 Bit   5: Used only during SAVE-@ replacement&lt;br /&gt;
                 Bit   6: Locked flag (Set produces &amp;quot;&amp;gt;&amp;quot; locked files)&lt;br /&gt;
                 Bit   7: Closed flag  (Not  set  produces  &amp;quot;*&amp;quot;, or &amp;quot;splat&amp;quot;&lt;br /&gt;
                          files)&lt;br /&gt;
          03-04: Track/sector location of first sector of file&lt;br /&gt;
          05-14: 16 character filename (in PETASCII, padded with $A0)&lt;br /&gt;
          15-16: Track/Sector location of first side-sector block (REL file&lt;br /&gt;
                 only)&lt;br /&gt;
             17: REL file record length (REL file only, max. value 254)&lt;br /&gt;
          18-1D: Unused (except with GEOS disks)&lt;br /&gt;
          1E-1F: File size in sectors, low/high byte  order  ($1E+$1F*256).&lt;br /&gt;
                 The approx. filesize in bytes is &amp;lt;= #sectors * 254&lt;br /&gt;
          20-3F: Second dir entry. From now on the first two bytes of  each&lt;br /&gt;
                 entry in this sector  should  be  $00  $00,  as  they  are&lt;br /&gt;
                 unused.&lt;br /&gt;
          40-5F: Third dir entry&lt;br /&gt;
          60-7F: Fourth dir entry&lt;br /&gt;
          80-9F: Fifth dir entry&lt;br /&gt;
          A0-BF: Sixth dir entry&lt;br /&gt;
          C0-DF: Seventh dir entry&lt;br /&gt;
          E0-FF: Eighth dir entry&lt;br /&gt;
&lt;br /&gt;
Files, on a standard 1541, are stored using an interleave of 10. Assuming a&lt;br /&gt;
starting track/sector of 17/0, the chain  would  run  17/0,  17/10,  17/20,&lt;br /&gt;
17/8, 17/18, etc.&lt;br /&gt;
&lt;br /&gt;
Note: No GEOS entries are listed in the above description. See [[GEOS VLIR]] for GEOS info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The layout of the BAM area (sector 18/0) is a bit more complicated...&lt;br /&gt;
&lt;br /&gt;
      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F&lt;br /&gt;
      -----------------------------------------------&lt;br /&gt;
  00: 12 01 41 00 12 FF F9 17 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  10: 15 FF FF 1F 12 FF F9 17 00 00 00 00 00 00 00 00&lt;br /&gt;
  20: 00 00 00 00 0E FF 74 03 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  30: 0E 3F FC 11 07 E1 80 01 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  40: 15 FF FF 1F 15 FF FF 1F 0D C0 FF 07 13 FF FF 07&lt;br /&gt;
  50: 13 FF FF 07 11 FF CF 07 13 FF FF 07 12 7F FF 07&lt;br /&gt;
  60: 13 FF FF 07 0A 75 55 01 00 00 00 00 00 00 00 00&lt;br /&gt;
  70: 00 00 00 00 00 00 00 00 01 08 00 00 03 02 48 00&lt;br /&gt;
  80: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01&lt;br /&gt;
  90: 53 48 41 52 45 57 41 52 45 20 31 20 20 A0 A0 A0&lt;br /&gt;
  A0: A0 A0 56 54 A0 32 41 A0 A0 A0 A0 00 00 00 00 00&lt;br /&gt;
  B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
&lt;br /&gt;
  Bytes:$00-01: Track/Sector location of the first directory sector (should&lt;br /&gt;
                be set to 18/1 but it doesn't matter, and don't trust  what&lt;br /&gt;
                is there, always go to 18/1 for first directory entry)&lt;br /&gt;
            02: Disk DOS version type (see note below)&lt;br /&gt;
                  $41 (&amp;quot;A&amp;quot;)&lt;br /&gt;
            03: Unused&lt;br /&gt;
         04-8F: BAM entries for each track, in groups  of  four  bytes  per&lt;br /&gt;
                track, starting on track 1 (see below for more details)&lt;br /&gt;
         90-9F: Disk Name (padded with $A0)&lt;br /&gt;
         A0-A1: Filled with $A0&lt;br /&gt;
         A2-A3: Disk ID&lt;br /&gt;
            A4: Usually $A0&lt;br /&gt;
         A5-A6: DOS type, usually &amp;quot;2A&amp;quot;&lt;br /&gt;
         A7-AA: Filled with $A0&lt;br /&gt;
         AB-FF: Normally unused ($00), except for 40 track extended format,&lt;br /&gt;
                see the following two entries:&lt;br /&gt;
         AC-BF: DOLPHIN DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
         C0-D3: SPEED DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
&lt;br /&gt;
Note: The BAM entries for SPEED, DOLPHIN and  ProLogic  DOS  use  the  same layout as standard BAM entries.&lt;br /&gt;
&lt;br /&gt;
One of the interesting things from the BAM sector is the byte  at  offset&lt;br /&gt;
$02, the DOS version byte. If it is set to anything other than $41 or  $00,&lt;br /&gt;
then we have what is called &amp;quot;soft write protection&amp;quot;. Any attempt  to  write&lt;br /&gt;
to the disk will return the &amp;quot;DOS Version&amp;quot; error code 73  ,&amp;quot;CBM  DOS  V  2.6&lt;br /&gt;
1541&amp;quot;. The 1541 is simply telling  you  that  it  thinks  the  disk  format&lt;br /&gt;
version is incorrect. This message will normally come  up  when  you  first&lt;br /&gt;
turn on the 1541 and read the error channel. If you write a $00  or  a  $41&lt;br /&gt;
into 1541 memory location $00FF (for device 0),  then  you  can  circumvent&lt;br /&gt;
this type of write-protection, and change the DOS version back to  what  it&lt;br /&gt;
should be.&lt;br /&gt;
&lt;br /&gt;
The BAM entries require a bit (no pun intended) more of a breakdown. Take&lt;br /&gt;
the first entry at bytes $04-$07 ($12 $FF $F9 $17). The first byte ($12) is&lt;br /&gt;
the number of free sectors on that track. Since we are looking at the track&lt;br /&gt;
1 entry, this means it has 18 (decimal) free sectors. The next three  bytes&lt;br /&gt;
represent the bitmap of which sectors are used/free. Since it is 3 bytes (8&lt;br /&gt;
bits/byte) we have 24 bits of storage. Remember that at  most,  each  track&lt;br /&gt;
only has 21 sectors, so there are a few unused bits.&lt;br /&gt;
&lt;br /&gt;
   Bytes: 04-07: 12 FF F9 17   Track 1 BAM&lt;br /&gt;
          08-0B: 15 FF FF FF   Track 2 BAM&lt;br /&gt;
          0C-0F: 15 FF FF 1F   Track 3 BAM&lt;br /&gt;
          ...&lt;br /&gt;
          8C-8F: 11 FF FF 01   Track 35 BAM&lt;br /&gt;
&lt;br /&gt;
These entries must be viewed in binary to make any sense. We will use the&lt;br /&gt;
first entry (track 1) at bytes 04-07:&lt;br /&gt;
&lt;br /&gt;
     FF=11111111, F9=11111001, 17=00010111&lt;br /&gt;
&lt;br /&gt;
In order to make any sense from the binary notation, flip the bits around.&lt;br /&gt;
&lt;br /&gt;
                   111111 11112222&lt;br /&gt;
        01234567 89012345 67890123&lt;br /&gt;
        --------------------------&lt;br /&gt;
        11111111 10011111 11101000&lt;br /&gt;
        ^                     ^&lt;br /&gt;
    sector 0              sector 20&lt;br /&gt;
&lt;br /&gt;
Since we are on the first track, we have 21 sectors, and only use  up  to&lt;br /&gt;
the bit 20 position. If a bit is on (1), the  sector  is  free.  Therefore,&lt;br /&gt;
track 1 has sectors 9,10 and 19 used, all the rest are free.  Any  leftover&lt;br /&gt;
bits that refer to sectors that don't exist, like bits 21-23 in  the  above&lt;br /&gt;
example, are set to allocated.&lt;br /&gt;
&lt;br /&gt;
Each filetype has its own unique properties, but most follow  one  simple&lt;br /&gt;
structure. The first file sector is pointed to by the directory and follows&lt;br /&gt;
a t/s chain, until the track value reaches  $00.  When  this  happens,  the&lt;br /&gt;
value in the sector link location indicates how much of the sector is used.&lt;br /&gt;
For example, the following chain indicates a file 6 sectors long, and  ends&lt;br /&gt;
when we encounter the $00/$34 chain. At this point the last sector occupies&lt;br /&gt;
from bytes $02-$34.&lt;br /&gt;
&lt;br /&gt;
    1       2       3       4       5       6&lt;br /&gt;
  ----    -----   -----   -----   -----   -----&lt;br /&gt;
  17/0    17/10   17/20   17/1    17/11    0/52&lt;br /&gt;
 (11/00) (11/0A) (11/14) (11/01) (11/0B)  (0/34)&lt;br /&gt;
&lt;br /&gt;
== Variations on the D64 layout ==&lt;br /&gt;
&lt;br /&gt;
     &lt;br /&gt;
These are some variations of the D64 layout:&lt;br /&gt;
&lt;br /&gt;
1. Standard 35 track layout but with 683 error bytes added on to the  end&lt;br /&gt;
of the file. Each byte of the  error  info  corresponds  to  a  single&lt;br /&gt;
sector stored in the D64, indicating if the  sector  on  the  original&lt;br /&gt;
disk contained an error. The first byte is for track 1/0, and the last&lt;br /&gt;
byte is for track 35/16.&lt;br /&gt;
&lt;br /&gt;
2. A 40 track layout, following the same layout as a 35 track  disk,  but &lt;br /&gt;
with 5 extra tracks. These contain 17 sectors each, like tracks 31-35.&lt;br /&gt;
Some of the PC utilities do allow you to create and  work  with  these&lt;br /&gt;
files. This can also have error bytes attached like variant #1.&lt;br /&gt;
&lt;br /&gt;
3. The Commodore 128 allowed for &amp;quot;auto-boot&amp;quot; disks. With  this,  t/s  1/0&lt;br /&gt;
holds a specific byte sequence which the computer recognizes  as  boot&lt;br /&gt;
code. See the document C128BOOT.TXT for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a small chart detailing the standard file sizes of  D64  images,&lt;br /&gt;
35 or 40 tracks, with or without error bytes.&lt;br /&gt;
&lt;br /&gt;
     Disk type                  Size&lt;br /&gt;
     ---------                  ------&lt;br /&gt;
     35 track, no errors        174848&lt;br /&gt;
     35 track, 683 error bytes  175531&lt;br /&gt;
     40 track, no errors        196608&lt;br /&gt;
     40 track, 768 error bytes  197376&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table (provided by Wolfgang Moser) outlines the differences&lt;br /&gt;
between the standard 1541 DOS and the various &amp;quot;speeder&amp;quot; DOS's  that  exist.&lt;br /&gt;
The 'header 7/8' category is the 'fill bytes' as  the  end  of  the  sector&lt;br /&gt;
header of  a  real  1541  disk  See  [[G64]]  for  a  better&lt;br /&gt;
explanation of these bytes.&lt;br /&gt;
&lt;br /&gt;
        Disk format             |Tracks|Header 7/8|Dos type|DiskDos&lt;br /&gt;
                                |      |allsechdrs|        |vs.type&lt;br /&gt;
       ============================================================&lt;br /&gt;
        Original CBM DOS v2.6   |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        SpeedDOS+               |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfessionalDOS Initial |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
          (Version 1/Prototype) |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfDOS Release         |  40  | $0f  $0f |  &amp;quot;4A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  40  | $0d  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        PrologicDOS 1541        |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        PrologicDOS 1541        |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
        ProSpeed 1571 2.0       |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        ProSpeed 1571 2.0       |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The location of the extra BAM information in sector 18/0,  for  40  track&lt;br /&gt;
images, will be different depending on what standard the  disks  have  been&lt;br /&gt;
formatted with. SPEED DOS stores them from $C0 to $D3, DOLPHIN  DOS  stores&lt;br /&gt;
them from $AC to $BF and PrologicDOS stored them right after  the  existing&lt;br /&gt;
BAM entries from $90-A3. PrologicDOS also  moves  the  disk  label  and  ID&lt;br /&gt;
forward from the standard location of $90 to $A4. 64COPY and Star Commander&lt;br /&gt;
let you select from several different types of extended  disk  formats  you&lt;br /&gt;
want to create/work with.&lt;br /&gt;
&lt;br /&gt;
All three of the speeder DOS's mentioned above don't alter  the  standard&lt;br /&gt;
sector interleave of 10 for files and 3 for directories. The reason is that&lt;br /&gt;
they use a memory cache installed in the drive which reads the entire track&lt;br /&gt;
in one pass. This alleviates the need for custom interleave values. They do&lt;br /&gt;
seem to alter the algorithm that finds the next available  free  sector  so&lt;br /&gt;
that the interleave value can deviate from 10 under certain  circumstances,&lt;br /&gt;
but I don't know why they would bother.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Speed DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $C0-D3.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 00 00 00 00  ??00?2A?????????&lt;br /&gt;
  00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00C0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00D0: 11 FF FF 01 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Dolphin DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $AC-BF.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 11 FF FF 01  ??00?2A?????????&lt;br /&gt;
  00B0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ???????????????? &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a PrologicDOS BAM sector. Note that the disk  name&lt;br /&gt;
and ID are now located at $A4 instead of starting at $90.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00A0: 11 FF FF 01 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00B0: A0 A0 A0 A0 A0 A0 30 30 A0 32 50 A0 A0 A0 A0 00  ??????00?2P?????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00ED: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the meaning of the error bytes added onto the end of any extended&lt;br /&gt;
D64. The CODE is the same as that generated by the 1541 drive controller...&lt;br /&gt;
it reports these numbers, not the error code we usually see when  an  error&lt;br /&gt;
occurs.&lt;br /&gt;
&lt;br /&gt;
Some of what comes  below  is  taken  from  Immers/Neufeld  book  &amp;quot;Inside&lt;br /&gt;
Commodore DOS&amp;quot;. Note the descriptions are not  completely  accurate  as  to&lt;br /&gt;
what the drive DOS is actually doing to seek/read/decode/write sectors, but&lt;br /&gt;
serve as simple examples only. The &amp;quot;type&amp;quot; field is where the error  usually&lt;br /&gt;
occurs, whether it's searching for any SYNC mark, any header ID, any  valid&lt;br /&gt;
header, or reading a sector.&lt;br /&gt;
&lt;br /&gt;
These first errors are &amp;quot;seek&amp;quot; errors, where the disk controller is simply&lt;br /&gt;
reading headers and looking at descriptor bytes, checksums, format ID's and&lt;br /&gt;
reporting what errors it sees. These errors do *not* necessarily  apply  to&lt;br /&gt;
the exact sector being looked for. This fact  makes  duplication  of  these&lt;br /&gt;
errors very unreliable.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     03    21    Seek   No SYNC sequence found.&lt;br /&gt;
                        Each  sector  data  block  and  header  block   are&lt;br /&gt;
                        preceeded by SYNC marks. If *no* sync  sequence  is&lt;br /&gt;
                        found within 20 milliseconds (only ~1/10 of a  disk&lt;br /&gt;
                        rotation!) then this error is generated. This error&lt;br /&gt;
                        used to mean the entire track is bad, but  it  does&lt;br /&gt;
                        not have to be the case. Only a small area  of  the&lt;br /&gt;
                        track needs to be without  a  SYNC  mark  and  this&lt;br /&gt;
                        error will be generated.&lt;br /&gt;
                        Converting this error to a D64 is very  problematic&lt;br /&gt;
                        because it depends on where the physical head is on&lt;br /&gt;
                        the disk when a read attempt is made. If it  is  on&lt;br /&gt;
                        valid header/sectors then it  won't  occur.  If  it&lt;br /&gt;
                        happens over an area without SYNC  marks,  it  will&lt;br /&gt;
                        happen.&lt;br /&gt;
     02    20    Seek   Header descriptor byte not found (HEX $08, GCR $52)&lt;br /&gt;
                        Each sector is preceeded by an  8-byte  GCR  header&lt;br /&gt;
                        block, which starts with the value  $52  (GCR).  If&lt;br /&gt;
                        this value is not found  after  90  attempts,  this&lt;br /&gt;
                        error is generated.&lt;br /&gt;
                        Basically, what a track  has  is  SYNC  marks,  and&lt;br /&gt;
                        possibly valid data blocks,  but  no  valid  header&lt;br /&gt;
                        descriptors.&lt;br /&gt;
     09    27    Seek   Checksum error in header block&lt;br /&gt;
                        The  header  block  contains  a   checksum   value,&lt;br /&gt;
                        calculated by XOR'ing the TRACK,  SECTOR,  ID1  and&lt;br /&gt;
                        ID2 values. If this checksum is wrong,  this  error&lt;br /&gt;
                        is generated.&lt;br /&gt;
     0B    29    Seek   Disk sector ID mismatch&lt;br /&gt;
                        The ID's from the header  block  of  the  currently&lt;br /&gt;
                        read sector are compared against the ones from  the&lt;br /&gt;
                        low-level header of 18/0. If there is  a  mismatch,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
     02    20    Seek   Header block not found&lt;br /&gt;
                        This error can be reported again when searching for&lt;br /&gt;
                        the correct header block. An image of the header is&lt;br /&gt;
                        built and searched for, but not found after 90 read&lt;br /&gt;
                        attempts.  Note  the  difference  from  the   first&lt;br /&gt;
                        occurance. The first one only searches for a  valid&lt;br /&gt;
                        ID, not the whole header.&lt;br /&gt;
&lt;br /&gt;
Note that error 20 occurs twice during this phase. The first time is when&lt;br /&gt;
a header ID is being searched for, the second is  when  the  proper  header&lt;br /&gt;
pattern for the sector being searched for is not found.&lt;br /&gt;
&lt;br /&gt;
From this point on, all the errors apply to the specific sector  you  are&lt;br /&gt;
looking for. If a read passed all the previous checks, then we are  at  the&lt;br /&gt;
sector being searched for.&lt;br /&gt;
&lt;br /&gt;
Note that the entire sector is read before  these  errors  are  detected.&lt;br /&gt;
Therefore the data, checksum and off bytes are available.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     04    22    Read   Data descriptor byte not found (HEX $07, GCR $55)&lt;br /&gt;
                        Each sector data block is preceeded  by  the  value&lt;br /&gt;
                        $07, the &amp;quot;data block&amp;quot; descriptor. If this value  is&lt;br /&gt;
                        not there, this error is  generated.  Each  encoded&lt;br /&gt;
                        sector  has  actually  260  bytes.  First  is   the&lt;br /&gt;
                        descriptor byte, then  follows  the  256  bytes  of&lt;br /&gt;
                        data, a checksum, and two &amp;quot;off&amp;quot; bytes.&lt;br /&gt;
     05    23    Read   Checksum error in data block&lt;br /&gt;
                        The checksum of  the  data  read  of  the  disk  is&lt;br /&gt;
                        calculated, and compared against the one stored  at&lt;br /&gt;
                        the end of the sector. If  there's  a  discrepancy,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
     0F    74    Read   Drive Not Ready (no disk in drive or no device 1)&lt;br /&gt;
&lt;br /&gt;
These errors only  apply  when  writing  to  a  disk.  I  don't  see  the&lt;br /&gt;
usefulness of having these as they cannot be present when only *reading*  a&lt;br /&gt;
disk.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     06    24    Write  Write verify (on format)&lt;br /&gt;
     07    25    Write  Write verify error&lt;br /&gt;
                        Once the GCR-encoded sector  is  written  out,  the&lt;br /&gt;
                        drive waits for the sector to come around again and&lt;br /&gt;
                        verifies the whole 325-byte GCR block.  Any  errors&lt;br /&gt;
                        encountered will generate this error.&lt;br /&gt;
     08    26    Write  Write protect on&lt;br /&gt;
                        Self explanatory. Remove the write-protect tab, and&lt;br /&gt;
                        try again.&lt;br /&gt;
     0A    28    Write  Write error&lt;br /&gt;
                        In actual fact, this error never occurs, but it  is&lt;br /&gt;
                        included for completeness.&lt;br /&gt;
&lt;br /&gt;
This is not an error at all, but when gets reported when the  read  of  a&lt;br /&gt;
sector is ok.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     01    00    N/A    No error.&lt;br /&gt;
                        Self explanatory. No errors were  detected  in  the&lt;br /&gt;
                        reading and decoding of the sector.&lt;br /&gt;
&lt;br /&gt;
The advantage with using the 35 track D64  format,  regardless  of  error&lt;br /&gt;
bytes, is that it can be converted directly back to a 1541 disk  by  either&lt;br /&gt;
using the proper cable and software on the PC, or send it down to  the  C64&lt;br /&gt;
and writing it back to a 1541. It is the best documented format since it is&lt;br /&gt;
also native to the C64, with many books explaining the disk layout and  the&lt;br /&gt;
internals of the 1541.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What it takes to support D64 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The D64 layout is reasonably robust,  being  that  it  is  an  electronic&lt;br /&gt;
representation of a physical 1541  disk.  It  shares  *most*  of  the  1541&lt;br /&gt;
attributes and it supports all file formats, since all C64 files came  from&lt;br /&gt;
here. The only file I have found that can't be copied to a D64 is a T64 FRZ&lt;br /&gt;
(FRoZen files), since you lose the extra file type attribute.&lt;br /&gt;
&lt;br /&gt;
Since the D64 layout seems to be an exact byte copy of a 1541 floppy,  it&lt;br /&gt;
would appear to be the perfect format for *any* emulator. However, it  does&lt;br /&gt;
not contain certain vital bits of information that, as a user, you normally&lt;br /&gt;
don't have access to.&lt;br /&gt;
&lt;br /&gt;
Preceeding each sector on a real  1541  disk  is  a  header  block  which&lt;br /&gt;
contains the sector ID bytes and checksum. From the  information  contained&lt;br /&gt;
in the header, the drive determines if there's  an  error  on  that  header&lt;br /&gt;
(27-checksum error, 29-disk ID mismatch). The sector itself  also  contains&lt;br /&gt;
info (data block signature, checksum) that result in  error  detection  (23&lt;br /&gt;
checksum, 22 data block not present, etc). The error bytes had to be  added&lt;br /&gt;
on to the D64 image, &amp;quot;extending&amp;quot;  the  format  to  take  into  account  the&lt;br /&gt;
missing info.&lt;br /&gt;
&lt;br /&gt;
The disk ID is important in the copy protection of  some  programs.  Some&lt;br /&gt;
programs fail to work properly since the D64 doesn't  contain  these  ID's.&lt;br /&gt;
These bytes would be an addition to the format which has  never  been  done&lt;br /&gt;
and would be difficult to do. (As an aside, the  4-pack  ZipCode  files  do&lt;br /&gt;
contain the original master disk ID, but these are lost in  the  conversion&lt;br /&gt;
of a ZipCode to a D64. Only storing *one* of the ID's is  not  enough,  all&lt;br /&gt;
the sector ID's should be kept.)&lt;br /&gt;
&lt;br /&gt;
The extended track 1541 disks also presented  a  problem,  as  there  are&lt;br /&gt;
several different formats (and how/where to store the extra BAM entries  in&lt;br /&gt;
a sector that was not designed for  them,  yet  still  remain  compatible).&lt;br /&gt;
Because of the additions to the format (error bytes and  40  tracks)  there&lt;br /&gt;
exists 4 different types of D64's, all recognizeable by their size.&lt;br /&gt;
&lt;br /&gt;
It is also the only format that uses the sector count for the  file  size&lt;br /&gt;
rather than  actual  bytes  used.  This  can  present  some  problems  when&lt;br /&gt;
converting/copying the to another format because you may have to  know  the&lt;br /&gt;
size before you begin (see LBR format).&lt;br /&gt;
&lt;br /&gt;
It also contains no consistent signature, useful for recognizing  if  D64&lt;br /&gt;
is really what it claims to be. In order to determine if a file is  a  D64,&lt;br /&gt;
you must check the file size.&lt;br /&gt;
&lt;br /&gt;
(Content taken from [http://unusedino.de/ec64/technical/formats/d64.html D64.TXT] in Peter Scheper's excellent compendium of C64 file format information).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Commodore computers]]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Apple_DOS_file_system</id>
		<title>Apple DOS file system</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Apple_DOS_file_system"/>
				<updated>2013-05-20T22:10:50Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Apple DOS 3.3 disks were 5 1/4&amp;quot; media containing 35 tracks of 16 sectors using a GCR encoding.&lt;br /&gt;
&lt;br /&gt;
The DOS executable was stored on disk. The Disk ][ controller card (typically placed in slot #6 of an Apple ][) contained firmware that when started (via the command PR#6) would load the track $00, sector $00 into memory and start executing. In the case of a DOS boot disk, that sector would contain code that loaded the full DOS into memory, this was always stored in the first 3 tracks of a DOS boot disk.&lt;br /&gt;
&lt;br /&gt;
When a new DOS boot disk was created (using the INIT command), the DOS in memory would be written to the disk being INITed. This made it easy for people to create variants of DOS (by altering the running copy of DOS then INITing a new disk). Common modifications made include changing the GCR encoding or the sync and sector header bytes (to prevent the copying of a disk via normal DOS copy programs), and extending the number of tracks per disk (up to 40)&lt;br /&gt;
&lt;br /&gt;
=== Volume Table Of Contents ===&lt;br /&gt;
A standard Apple DOS 3.3 has a structure called a Volume Table of Contents (VTOC) stored at &lt;br /&gt;
track $11, sector $00&lt;br /&gt;
&lt;br /&gt;
The contents of the VTOC are:&lt;br /&gt;
&lt;br /&gt;
  offset&lt;br /&gt;
  -----&lt;br /&gt;
  $00    not used&lt;br /&gt;
  $01    track number of first catalog sector&lt;br /&gt;
  $02    sector number of first catalog sector&lt;br /&gt;
  $03    release number of DOS used to INIT this disk&lt;br /&gt;
  $04-05 not used&lt;br /&gt;
  $06    Diskette volume number (1-254)&lt;br /&gt;
  $07-26 not used&lt;br /&gt;
  $27    maximum number of track/sector pairs which will fit in one file track/sector&lt;br /&gt;
     	    list sector (122 for 256 byte sectors)&lt;br /&gt;
  $28-2F not used&lt;br /&gt;
  $30    last track where sectors were allocated&lt;br /&gt;
  $31    direction of track allocation (+1 or -1)&lt;br /&gt;
  $32-33 not used&lt;br /&gt;
  $34    number of tracks per diskette (normally 35)&lt;br /&gt;
  $35    number of sectors per track (13 or 16)  &lt;br /&gt;
  $36-37 number of bytes per sector (LO/HI format)&lt;br /&gt;
  $38-3B bit map of free sectors in track 0&lt;br /&gt;
  $3C-3F bit map of free sectors in track 1&lt;br /&gt;
  $40-43 bit map of free sectors in track 2&lt;br /&gt;
	...&lt;br /&gt;
  $BC-BF bit map of free sectors in track 33&lt;br /&gt;
  $CO-C3 bit map of free sectors in track 34&lt;br /&gt;
  $C4-FF bit maps for additional tracks if there are more than 35 tracks per diskette&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Catalog  ===&lt;br /&gt;
The catalog consists of  a 35 byte &amp;quot;File Descriptive Entry&amp;quot; for each file on the disk. The catalog is a chain of sectors, the location of the first Catalog sector is found by looking in the VTOC. &lt;br /&gt;
&lt;br /&gt;
 offset&lt;br /&gt;
 ----&lt;br /&gt;
 $00    Not Used&lt;br /&gt;
 $01    track number of next catalog sector&lt;br /&gt;
 $02    sector number of next catalog sector&lt;br /&gt;
 $03-0A not used&lt;br /&gt;
 $0B-2D First file descriptive entry&lt;br /&gt;
 $2E-50 Second file descriptive entry&lt;br /&gt;
 $51-73 Third file descriptive entry&lt;br /&gt;
 $74-96 Fourth file descriptive entry&lt;br /&gt;
 $97-B9 Fifth file descriptive entry&lt;br /&gt;
 $BA-DC Sixth file descriptive entry&lt;br /&gt;
 $DD-FF Seventh file descriptive entry&lt;br /&gt;
&lt;br /&gt;
=== File Descriptive Entry ===&lt;br /&gt;
 offset&lt;br /&gt;
 ----&lt;br /&gt;
 $00    Track of first track/sector list sector, if this is a deleted file this contains FF&lt;br /&gt;
	 and the original track number is copied to the last byte of the file name (BYTE 20)&lt;br /&gt;
 	If this byte contains a 00, the entry is assumed to never have been used and is&lt;br /&gt;
 	available for use. (This means track 0 can never be used for data even if the DOS image&lt;br /&gt;
 	is 'wiped' from the disk)&lt;br /&gt;
 $01    Sector of first track/sector list sector &lt;br /&gt;
 $02    File type and flags:&lt;br /&gt;
        $80+file type - file is locked&lt;br /&gt;
	$00+file type - file is not locked&lt;br /&gt;
	$00 - TEXT file&lt;br /&gt;
	$01 - INTEGER BASIC file&lt;br /&gt;
	$02 - APPLESOFT BASIC file&lt;br /&gt;
	$04 - BINARY file&lt;br /&gt;
	$08 - S type file&lt;br /&gt;
	$10 - RELOCATABLE object module file&lt;br /&gt;
	$20 - a type file&lt;br /&gt;
	$40 - b type file&lt;br /&gt;
 $03-20 File Name (30 characters)&lt;br /&gt;
 $21-22 Length of file in sectors (LO/HI format)&lt;br /&gt;
&lt;br /&gt;
=== Track Sector List Format ===&lt;br /&gt;
 $00	Not used&lt;br /&gt;
 $01	Track number of next T/S list of one is needed or zero if no more t/s list&lt;br /&gt;
 $02 	Sector number of next T/S list (if one is present)&lt;br /&gt;
 $03-04	Not used&lt;br /&gt;
 $05-06	Sector offset in file of the first sector described by this list&lt;br /&gt;
 $07-oB	Not used&lt;br /&gt;
 $0C-0D	Track and sector of first data sector or zeros&lt;br /&gt;
 $0E-0F	Track and sector of second data sector or zeros&lt;br /&gt;
 $10-FF	Up to 120 more track and sector pairs&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Apple_DOS_file_system</id>
		<title>Apple DOS file system</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Apple_DOS_file_system"/>
				<updated>2013-05-20T22:10:13Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: Created page with &amp;quot;Apple DOS 3.3 disks were 5 1/4&amp;quot; media containing 35 tracks of 16 sectors using a GCR encoding.  The DOS executable was stored on disk. The Disk ][ controller card (typically p...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Apple DOS 3.3 disks were 5 1/4&amp;quot; media containing 35 tracks of 16 sectors using a GCR encoding.&lt;br /&gt;
&lt;br /&gt;
The DOS executable was stored on disk. The Disk ][ controller card (typically placed in slot #6 of an Apple ][) contained firmware that when started (via the command PR#6) would load the track $00, sector $00 into memory and start executing. In the case of a DOS boot disk, that sector would contain code that loaded the full DOS into memory, this was always stored in the first 3 tracks of a DOS boot disk.&lt;br /&gt;
&lt;br /&gt;
When a new DOS boot disk was created (using the INIT command), the DOS in memory would be written to the disk being INITed. This made it easy for people to create variants of DOS (by altering the running copy of DOS then INITing a new disk). Common modifications made include changing the GCR encoding or the sync and sector header bytes (to prevent the copying of a disk via normal DOS copy programs), and extending the number of tracks per disk (up to 40)&lt;br /&gt;
&lt;br /&gt;
=== Volume Table Of Contents ===&lt;br /&gt;
A standard Apple DOS 3.3 has a structure called a Volume Table of Contents (VTOC) stored at &lt;br /&gt;
track $11, sector $00&lt;br /&gt;
&lt;br /&gt;
The contents of the VTOC are:&lt;br /&gt;
&lt;br /&gt;
  offset&lt;br /&gt;
  -----&lt;br /&gt;
  $00    not used&lt;br /&gt;
  $01    track number of first catalog sector&lt;br /&gt;
  $02    sector number of first catalog sector&lt;br /&gt;
  $03    release number of DOS used to INIT this disk&lt;br /&gt;
  $04-05 not used&lt;br /&gt;
  $06    Diskette volume number (1-254)&lt;br /&gt;
  $07-26 not used&lt;br /&gt;
  $27    maximum number of track/sector pairs which will fit in one file track/sector&lt;br /&gt;
     	    list sector (122 for 256 byte sectors)&lt;br /&gt;
  $28-2F not used&lt;br /&gt;
  $30    last track where sectors were allocated&lt;br /&gt;
  $31    direction of track allocation (+1 or -1)&lt;br /&gt;
  $32-33 not used&lt;br /&gt;
  $34    number of tracks per diskette (normally 35)&lt;br /&gt;
  $35    number of sectors per track (13 or 16)  &lt;br /&gt;
  $36-37 number of bytes per sector (LO/HI format)&lt;br /&gt;
  $38-3B bit map of free sectors in track 0&lt;br /&gt;
  $3C-3F bit map of free sectors in track 1&lt;br /&gt;
  $40-43 bit map of free sectors in track 2&lt;br /&gt;
	...&lt;br /&gt;
  $BC-BF bit map of free sectors in track 33&lt;br /&gt;
  $CO-C3 bit map of free sectors in track 34&lt;br /&gt;
  $C4-FF bit maps for additional tracks if there are more than 35 tracks per diskette&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 === Catalog  ===&lt;br /&gt;
The catalog consists of  a 35 byte &amp;quot;File Descriptive Entry&amp;quot; for each file on the disk. The catalog is a chain of sectors, the location of the first Catalog sector is found by looking in the VTOC. &lt;br /&gt;
&lt;br /&gt;
 offset&lt;br /&gt;
 ----&lt;br /&gt;
 $00    Not Used&lt;br /&gt;
 $01    track number of next catalog sector&lt;br /&gt;
 $02    sector number of next catalog sector&lt;br /&gt;
 $03-0A not used&lt;br /&gt;
 $0B-2D First file descriptive entry&lt;br /&gt;
 $2E-50 Second file descriptive entry&lt;br /&gt;
 $51-73 Third file descriptive entry&lt;br /&gt;
 $74-96 Fourth file descriptive entry&lt;br /&gt;
 $97-B9 Fifth file descriptive entry&lt;br /&gt;
 $BA-DC Sixth file descriptive entry&lt;br /&gt;
 $DD-FF Seventh file descriptive entry&lt;br /&gt;
&lt;br /&gt;
=== File Descriptive Entry ===&lt;br /&gt;
 offset&lt;br /&gt;
 ----&lt;br /&gt;
 $00    Track of first track/sector list sector, if this is a deleted file this contains FF&lt;br /&gt;
	 and the original track number is copied to the last byte of the file name (BYTE 20)&lt;br /&gt;
 	If this byte contains a 00, the entry is assumed to never have been used and is&lt;br /&gt;
 	available for use. (This means track 0 can never be used for data even if the DOS image&lt;br /&gt;
 	is 'wiped' from the disk)&lt;br /&gt;
 &lt;br /&gt;
 $01    Sector of first track/sector list sector &lt;br /&gt;
 $02    File type and flags:&lt;br /&gt;
        $80+file type - file is locked&lt;br /&gt;
	$00+file type - file is not locked&lt;br /&gt;
	$00 - TEXT file&lt;br /&gt;
	$01 - INTEGER BASIC file&lt;br /&gt;
	$02 - APPLESOFT BASIC file&lt;br /&gt;
	$04 - BINARY file&lt;br /&gt;
	$08 - S type file&lt;br /&gt;
	$10 - RELOCATABLE object module file&lt;br /&gt;
	$20 - a type file&lt;br /&gt;
	$40 - b type file&lt;br /&gt;
 $03-20 File Name (30 characters)&lt;br /&gt;
 $21-22 Length of file in sectors (LO/HI format)&lt;br /&gt;
&lt;br /&gt;
=== 	Track Sector List Format ===&lt;br /&gt;
 $00	Not used&lt;br /&gt;
 $01	Track number of next T/S list of one is needed or zero if no more t/s list&lt;br /&gt;
 $02 	Sector number of next T/S list (if one is present)&lt;br /&gt;
 $03-04	Not used&lt;br /&gt;
 $05-06	Sector offset in file of the first sector described by this list&lt;br /&gt;
 $07-oB	Not used&lt;br /&gt;
 $0C-0D	Track and sector of first data sector or zeros&lt;br /&gt;
 $0E-0F	Track and sector of second data sector or zeros&lt;br /&gt;
 $10-FF	Up to 120 more track and sector pairs&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Commodore_64_binary_executable</id>
		<title>Commodore 64 binary executable</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Commodore_64_binary_executable"/>
				<updated>2013-05-20T21:51:46Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|subcat=Executables&lt;br /&gt;
|extensions={{ext|prg}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Binary files intended to be executed on a Commodore 64 (or emulator of it) are often stored with the extension .prg. (In the original Commodore environment, they generally didn't have an extension but had file type &amp;quot;PRG&amp;quot; in the directory structure.) &lt;br /&gt;
&lt;br /&gt;
The first two bytes in a PRG file are the memory address that the file should be loaded into (in little-endian format). For a C64 [[Commodore BASIC tokenized file]] file, intended to be loaded into $801, these bytes are $01,$08. Note that these bytes will be ignored (i.e. a PRG file will be loaded into $801) UNLESS the LOAD command had a non-zero parameter after the device number. i.e. LOAD &amp;quot;*&amp;quot;,8 will load a file from device 8 (the typical device number for a disk drive) into $801, while LOAD &amp;quot;*&amp;quot;,8,1 will load a file into whatever memory address is specified by the first 2 bytes of the PRG. &lt;br /&gt;
&lt;br /&gt;
== Programs and utilities ==&lt;br /&gt;
* [http://search.cpan.org/~pawelkrol/D64-File-PRG-0.02/lib/D64/File/PRG.pm D64::File::PRG library for Perl to handle PRG files.]&lt;br /&gt;
&lt;br /&gt;
[[Category:Commodore computers]]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/GEOS_Font</id>
		<title>GEOS Font</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/GEOS_Font"/>
				<updated>2013-05-20T21:33:24Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: ontent taken from http://zimmers.net/geos/docs/fontfile.txt which is unattributed and has been floating around BBS and web sites  for decades&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;GEOS  Font files are multiple point size bitmaps stored in [[GEOS VLIR]] files;  the chain number (0-126) is  the&lt;br /&gt;
point  size.  GEOS limits a font to a point size of 48.  This  is&lt;br /&gt;
probably   due  to  memory  limitations  for  storing  the  font.&lt;br /&gt;
Nonexistent point sizes have VLIR chain addresses of $00,$FF.&lt;br /&gt;
&lt;br /&gt;
The header in each font file contains Font ID and point size&lt;br /&gt;
information for the fonts in the file.  This includes the FONT ID&lt;br /&gt;
at  offset  $80 (128)  within the header block, the 32 byte point&lt;br /&gt;
size table at $82 (130) ordered from smallest to largest  (padded &lt;br /&gt;
with 0's), and the 32 byte font sizes at $61 (97) ordered from&lt;br /&gt;
smallest to largest (padded with 0's).  This leaves room for 16 &lt;br /&gt;
fonts per font file.&lt;br /&gt;
&lt;br /&gt;
Font  files  are identified by a unique ID number  which  is&lt;br /&gt;
stored in the file's info sector at offset 130.  The info  sector&lt;br /&gt;
contains a word identifier for each point size in the font. These&lt;br /&gt;
identifiers have the form:  ID# * 8 + point size.  In other words,&lt;br /&gt;
bits 15-6 represent the font number while bits 0-5 hold the point&lt;br /&gt;
size.  These ID words are used by GEOwrite and GEOpaint.  &lt;br /&gt;
&lt;br /&gt;
                         0    BSW            13   Tilden&lt;br /&gt;
                         1    University     14   Evans&lt;br /&gt;
                         2    California     15   Durant&lt;br /&gt;
                         3    Roma           16   Telegraph&lt;br /&gt;
                         4    Dwinelle       17   Superb&lt;br /&gt;
                         5    Cory           18   Bowditch&lt;br /&gt;
                         6    Tolman         19   Ormond&lt;br /&gt;
                         7    Bubble         20   Elmwood&lt;br /&gt;
                         8    Fontknox       21   Hearst&lt;br /&gt;
                         9    Harmon         21   Brennens (BUG)&lt;br /&gt;
                         10   Mykonos        23   Channing&lt;br /&gt;
                         11   Boalt          24   Putnam&lt;br /&gt;
                         12   Stadium        25   LeConte&lt;br /&gt;
&lt;br /&gt;
Each VLIR in a font file is organized as follows:&lt;br /&gt;
&lt;br /&gt;
          OffSet    Description&lt;br /&gt;
          -------   -------------------------------------------------------&lt;br /&gt;
          $00       Number  of pixels minus 1 above the underline.  This is&lt;br /&gt;
                    the line of print.&lt;br /&gt;
          $01-$02   Number of bytes in the bit stream.&lt;br /&gt;
          $03       Point size, character height in pixels.&lt;br /&gt;
          $04-$05   Index  from  beginning of font to table of  bit  stream&lt;br /&gt;
                    indices. Usually $0008.&lt;br /&gt;
          $06-$07   Index from beginning of font to first bit stream.&lt;br /&gt;
          $08-???   Table  of words which are indices into the bit streams;&lt;br /&gt;
                    one  for  each character from space (32) to  the  tilde&lt;br /&gt;
                    (126).  There is also an extra index on the  end.  This&lt;br /&gt;
                    extra  index is needed because the difference between a&lt;br /&gt;
                    character's index and the next character's index is the&lt;br /&gt;
                    width of the character in pixels.&lt;br /&gt;
          ???-???   Pointed  to by $06-$07.  The font is stored as  several&lt;br /&gt;
                    bit  streams,  one for each line of pixels.  The  point&lt;br /&gt;
                    size  is the number of bit streams.  All the  character&lt;br /&gt;
                    images  are stored in the bit stream.  The GEOS  KERNAL&lt;br /&gt;
                    has  some very sophisticated bit manipulation  routines&lt;br /&gt;
                    for accessing any given character.&lt;br /&gt;
&lt;br /&gt;
(content taken from http://zimmers.net/geos/docs/fontfile.txt which is unattributed and has been floating around BBS and web sites  for decades)&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Fonts</id>
		<title>Fonts</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Fonts"/>
				<updated>2013-05-20T21:29:32Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: added GEOS font&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|formattype=electronic&lt;br /&gt;
|thiscat=Fonts&lt;br /&gt;
|image=Fonts.png&lt;br /&gt;
}}&lt;br /&gt;
Fonts describe how text looks (as opposed to how the characters are represented in text, which is the area of [[Character Encoding]]s). There are a number of formats that describe fonts for computers. &lt;br /&gt;
&lt;br /&gt;
* [[Acorn Font]]&lt;br /&gt;
* [[BDF]]&lt;br /&gt;
* [[CID]], [[TFM]], [[OFM]], [[OVF]], [[OVP]], [[MetaFont]] TeX Fonts and support data&lt;br /&gt;
* [[dfont]]&lt;br /&gt;
* [[EOT|Embedded OpenType]]&lt;br /&gt;
* [[FON]] (Windows bitmap fonts)&lt;br /&gt;
* [[GEOS Font]]&lt;br /&gt;
* [[OTF|OpenType]]&lt;br /&gt;
* [[Open File Format]]&lt;br /&gt;
* [[PFB]], [[PFM]], [[AFM]], [[BDF]] (Adobe font formats)&lt;br /&gt;
* [[sfnt]]&lt;br /&gt;
* [[TTF|TrueType]]&lt;br /&gt;
* [[WOFF|Web Open Font Format]]&lt;br /&gt;
&lt;br /&gt;
See [https://en.wikipedia.org/wiki/Category:Font_formats Wikipedia] for more.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* O'Reilly, &amp;quot;Fonts and Encodings&amp;quot;, Yannis Haralambous, ISBN 978-0-596-10242-5&lt;br /&gt;
* [http://www.mcsweeneys.net/articles/im-comic-sans-asshole I'm Comic Sans, Asshole!]&lt;br /&gt;
&lt;br /&gt;
[[Category:Fonts| ]]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/GEOS_VLIR</id>
		<title>GEOS VLIR</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/GEOS_VLIR"/>
				<updated>2013-05-20T21:26:05Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: Content taken from http://unusedino.de/ec64/technical/formats/geos.html in Peter Scheper's compendium of c64 file formats&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Later on in the life of the C64, the GEOS OS came out. It  was  a  system&lt;br /&gt;
much like many other windowing OS's (MAC  OS,  Windows)  in  that  it  used&lt;br /&gt;
icons, windows, a mouse pointer and resource drivers. In order  to  contain&lt;br /&gt;
all the information needed for the windowing system (icon, window position,&lt;br /&gt;
creation time/date), a new filetype called VLIR was  needed  and  directory&lt;br /&gt;
changes were made. While GEOS files might not be of interest to many of the&lt;br /&gt;
emulator users, it is likely that these  files  will  be  encountered,  and&lt;br /&gt;
knowledge of them would be helpful.&lt;br /&gt;
&lt;br /&gt;
There are actually two types of GEOS files, VLIR  and  SEQuential.  Don't&lt;br /&gt;
confuse the GEOS SEQuential type with that of the standard  D64  SEQ  file.&lt;br /&gt;
They are related, but not the same.  VLIR  are  described  in  more  detail&lt;br /&gt;
following this paragraph. GEOS SEQuential files  are  all  non-VLIR  files,&lt;br /&gt;
including normal PRG, USR and SEQ types.&lt;br /&gt;
&lt;br /&gt;
GEOS files usually have an entity  attached  called  an  INFO  block.  It&lt;br /&gt;
contains ICON info, author, file description, load  address  etc.  However,&lt;br /&gt;
just because an INFO block does not exist for a given file, does  not  mean&lt;br /&gt;
that the file is not a GEOS file.&lt;br /&gt;
&lt;br /&gt;
Each GEOS VLIR file or application is comprised of many  separate  chains&lt;br /&gt;
(called RECORDS) for different sections of the app/file. Each RECORD can be&lt;br /&gt;
loaded in separately and overtop of other ones. Below  is  a  dump  of  the&lt;br /&gt;
first directory sector of the GEOS 2.0 disk. Note  the  first  entry  seems&lt;br /&gt;
normal enough, but the rest have additional  information  in  the  normally&lt;br /&gt;
unused section of the entry.&lt;br /&gt;
&lt;br /&gt;
      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F&lt;br /&gt;
      -----------------------------------------------&lt;br /&gt;
  00: 12 04 82 13 00 47 45 4F 53 20 56 32 2E 30 20 45  &amp;lt;- Normal entry&lt;br /&gt;
  10: 4E 47 4C 2E A0 00 00 00 00 00 00 00 00 00 58 00&lt;br /&gt;
  20: 00 00 83 02 02 44 45 53 4B 20 54 4F 50 A0 A0 A0  &amp;lt;- First GEOS file.&lt;br /&gt;
  30: A0 A0 A0 A0 A0 02 0F 01 04 58 08 13 0D 23 78 00  &amp;lt;- Note extra info&lt;br /&gt;
  40: 00 00 83 0B 13 43 4F 4D 4D 20 31 33 35 31 28 61     from offset $15 to&lt;br /&gt;
  50: 29 A0 A0 A0 A0 08 0F 00 0A 58 05 09 15 24 03 00     $1D.&lt;br /&gt;
  60: 00 00 83 0F 0D 4D 50 53 2D 38 30 31 A0 A0 A0 A0&lt;br /&gt;
  70: A0 A0 A0 A0 A0 0F 05 00 09 56 07 19 01 00 04 00&lt;br /&gt;
  80: 00 00 83 08 0D 43 4F 4E 46 49 47 55 52 45 A0 A0&lt;br /&gt;
  90: A0 A0 A0 A0 A0 08 05 01 0E 58 05 1F 0B 31 4E 00&lt;br /&gt;
  A0: 00 00 83 01 10 50 41 49 4E 54 20 44 52 49 56 45&lt;br /&gt;
  B0: 52 53 A0 A0 A0 01 08 00 06 57 08 0C 0E 00 12 00&lt;br /&gt;
  C0: 00 00 83 0B 05 70 72 65 66 65 72 65 6E 63 65 20&lt;br /&gt;
  D0: 6D 67 72 A0 A0 0B 12 00 05 56 0A 09 13 2D 16 00&lt;br /&gt;
  E0: 00 00 83 08 11 70 61 64 20 63 6F 6C 6F 72 20 6D&lt;br /&gt;
  F0: 67 72 A0 A0 A0 08 07 00 05 58 05 19 0C 10 16 00 &lt;br /&gt;
&lt;br /&gt;
Lets analyze the second entry to see what's all involved with GEOS files.&lt;br /&gt;
Note, the offset values have been changed to 0 to make referencing easier.&lt;br /&gt;
&lt;br /&gt;
  00: 00 00 83 02 02 44 45 53 4B 20 54 4F 50 A0 A0 A0&lt;br /&gt;
  10: A0 A0 A0 A0 A0 02 0F 01 04 58 08 13 0D 23 78 00 &lt;br /&gt;
&lt;br /&gt;
  Byte:   $02: C64 filetype (see the section on D64 for an explanation) REL&lt;br /&gt;
               files are not allowed.&lt;br /&gt;
        03-04: Starting track/sector (02/02 from above) of C64 file if GEOS&lt;br /&gt;
               filetype is $00. If GEOS filetype is non-zero,  track/sector&lt;br /&gt;
               of single-sector RECORD block&lt;br /&gt;
        05-14: Filename (in ASCII, padded with $A0, case varies)&lt;br /&gt;
        15-16: Track/sector location of info block&lt;br /&gt;
           17: GEOS file structure&lt;br /&gt;
                 $00 - Sequential&lt;br /&gt;
                  01 - VLIR file&lt;br /&gt;
           18: GEOS filetype&lt;br /&gt;
                 $00 - Non-GEOS (normal C64 file)&lt;br /&gt;
                  01 - BASIC&lt;br /&gt;
                  02 - Assembler&lt;br /&gt;
                  03 - Data file&lt;br /&gt;
                  04 - System File&lt;br /&gt;
                  05 - Desk Accessory&lt;br /&gt;
                  06 - Application&lt;br /&gt;
                  07 - Application Data (user-created documents)&lt;br /&gt;
                  08 - Font File&lt;br /&gt;
                  09 - Printer Driver&lt;br /&gt;
                  0A - Input Driver&lt;br /&gt;
                  0B - Disk Driver (or Disk Device)&lt;br /&gt;
                  0C - System Boot File&lt;br /&gt;
                  0D - Temporary&lt;br /&gt;
                  0E - Auto-Execute File&lt;br /&gt;
               0F-FF - Undefined&lt;br /&gt;
           19: Year (1900 + value)&lt;br /&gt;
           1A: Month (1-12, $01 to $0C)&lt;br /&gt;
           1B: Day (1-31, $01 to $1F)&lt;br /&gt;
           1C: Hour (0-23, $00 to $17) in military format&lt;br /&gt;
           1D: Minute (0-59, $00 to $3B)&lt;br /&gt;
        1E-1F: Filesize, in sectors (low/high byte order)&lt;br /&gt;
&lt;br /&gt;
If the values at byte $18 is 00 then we have a  normal,  sequential,  C64&lt;br /&gt;
file, without an info block. If the value at byte  $18  is  anything  other&lt;br /&gt;
than 00, we have a GEOS file, be it VLIR or sequential, with an info block.&lt;br /&gt;
&lt;br /&gt;
One big addition to the directory is the TIME STAMP contained at $19-$1D.&lt;br /&gt;
The year is simply the number 1900 plus whatever is stored at that location&lt;br /&gt;
so the year 2005 would have a $69 (105 decimal) stored there. The  rest  of&lt;br /&gt;
the values are limited as described above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The INFO BLOCK stores items like  the  ICON,  size,  load  address,  file&lt;br /&gt;
types, description, etc, and is always only 1 sector long. Since there is a&lt;br /&gt;
fixed space to store information, the ICON height, width and bitmap  length&lt;br /&gt;
must be the same. Here is a sample info block, and layout...&lt;br /&gt;
&lt;br /&gt;
      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
      -----------------------------------------------  ----------------&lt;br /&gt;
  00: 00 FF 03 15 BF 3F 83 F8 40 44 04 8E 38 E2 B5 93  ????+??°@D??8?+?&lt;br /&gt;
  10: 59 AA 92 A9 B5 93 59 AA 92 A9 BF 93 F9 B1 93 19  Y???+?Y???+?????&lt;br /&gt;
  20: 8E 10 E1 BB 93 B9 B5 93 59 AA 92 A9 B5 93 59 AE  ??????+?Y???+?Y?&lt;br /&gt;
  30: 92 E9 B1 93 19 80 10 01 BF 93 F9 FF D7 FD 80 38  ????????+??????8&lt;br /&gt;
  40: 03 FF FF FF 83 05 00 00 2E D9 54 00 2E 50 68 6F  ????????.+T?.Pho&lt;br /&gt;
  50: 74 6F 20 4D 67 72 20 20 20 56 32 2E 31 00 00 00  to?Mgr???V2.1???&lt;br /&gt;
  60: 00 43 68 72 69 73 20 48 61 77 6C 65 79 00 00 00  ?Chris?Hawley???&lt;br /&gt;
  70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  80: 00 00 00 00 00 00 00 00 00 53 61 76 65 20 70 68  ?????????Save?ph&lt;br /&gt;
  90: 6F 74 6F 20 69 6D 61 67 65 73 20 69 6E 20 61 20  oto?images?in?a?&lt;br /&gt;
  A0: 53 61 76 65 20 70 68 6F 74 6F 20 69 6D 61 67 65  Save?photo?image&lt;br /&gt;
  B0: 73 20 69 6E 20 61 20 70 68 6F 74 6F 20 61 6C 62  s?in?a?photo?alb&lt;br /&gt;
  C0: 75 6D 20 66 6F 72 20 6C 61 74 65 72 20 75 73 65  um?for?later?use&lt;br /&gt;
  D0: 20 69 6E 20 67 65 6F 57 72 69 74 65 20 6F 72 20  ?in?geoWrite?or?&lt;br /&gt;
  E0: 67 65 6F 50 61 69 6E 74 2E 00 02 85 06 85 07 85  geoPaint.???????&lt;br /&gt;
  F0: 08 85 09 85 16 A9 04 85 11 A9 00 85 10 4C 2F C2  ?????????????L/+&lt;br /&gt;
&lt;br /&gt;
  Byte: $00-01: Contains $00/$FF since its only 1 sector long&lt;br /&gt;
         02-04: Information sector ID bytes (03 15 BF). The &amp;quot;03&amp;quot; is  likely&lt;br /&gt;
                the bitmap width, and the &amp;quot;15&amp;quot; is likely the bitmap height,&lt;br /&gt;
                but rare exceptions do exist to this!&lt;br /&gt;
         05-43: Icon bitmap (sprite format, 63 bytes)&lt;br /&gt;
            44: C64 filetype (same as that from the directory entry)&lt;br /&gt;
            45: GEOS filetype (same as that from the directory entry)&lt;br /&gt;
            46: GEOS file structure (same as that from the dir entry)&lt;br /&gt;
         47-48: Program load address&lt;br /&gt;
         49-4A: Program end address (only with accessories)&lt;br /&gt;
         4B-4C: Program start address&lt;br /&gt;
         4D-60: Class text (terminated with a $00)&lt;br /&gt;
         61-74: Author (with application data: name  of  application  disk,&lt;br /&gt;
                terminated with a $00. This string may not  necessarily  be&lt;br /&gt;
                set, or it may contain invalid data)&lt;br /&gt;
                The following GEOS files have authors:&lt;br /&gt;
                  1 - BASIC&lt;br /&gt;
                  2 - Assembler&lt;br /&gt;
                  5 - Desk Accessory&lt;br /&gt;
                  6 - Application&lt;br /&gt;
                  9 - Printer Driver&lt;br /&gt;
                 10 - Input Driver&lt;br /&gt;
         75-88: If a document, the name of the application that created it.&lt;br /&gt;
         89-9F: Available for applications, unreserved.&lt;br /&gt;
         A0-FF: Description (terminated with a $00)&lt;br /&gt;
&lt;br /&gt;
Note: all the text strings above are in ASCII, not PETASCII.&lt;br /&gt;
&lt;br /&gt;
If the file is a VLIR, then the RECORD block is of interest. This  single&lt;br /&gt;
sector is made up of up to 127 track/sector pointers, each of  which  point&lt;br /&gt;
to program sections (called RECORDS). VLIR files are comprised of  loadable&lt;br /&gt;
RECORDS (overlays, if you wish to use PC terminology). The first RECORD  is&lt;br /&gt;
what is always loaded first when you run that application. After that,  the&lt;br /&gt;
OS loads whatever RECORD it needs. Here is a partial sample of  the  RECORD&lt;br /&gt;
sector...&lt;br /&gt;
&lt;br /&gt;
  00: 00 FF 08 00 09 04 09 03 0A 0A 0B 11 0F 11 00 00&lt;br /&gt;
  10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 &lt;br /&gt;
&lt;br /&gt;
  Byte: $00-01: Contains 00/FF since its only 1 sector long&lt;br /&gt;
         02-03: Starting track/sector (8,0) for the first RECORD&lt;br /&gt;
         04-05: Starting track/sector (9,4) for the second RECORD&lt;br /&gt;
         06-07: Starting track/sector (9,3) for the third RECORD&lt;br /&gt;
         08-09: fourth RECORD (10/10)&lt;br /&gt;
         0A-0B: fifth RECORD (11/17)&lt;br /&gt;
         0C-0D: sixth RECORD (15/17)&lt;br /&gt;
         0E-0F: seventh RECORD (0/0)&lt;br /&gt;
&lt;br /&gt;
When a T/S link of $00/$00 is encountered, we  are  at  the  end  of  the&lt;br /&gt;
RECORD block. If the T/S  link  is  a  $00/$FF,  then  the  record  is  not&lt;br /&gt;
available.&lt;br /&gt;
&lt;br /&gt;
Note that if you add up the sectors so far, we have only  used  two,  one&lt;br /&gt;
for the INFO sector and one for the RECORD sector. Obviously there are more&lt;br /&gt;
used, and they are contained in the sector chains from the  RECORD  sector.&lt;br /&gt;
Each t/s link in the RECORD sector points to a chain of sectors, the length&lt;br /&gt;
of which is included in the  sector  count  for  the  GEOS  file.  Doing  a&lt;br /&gt;
VALIDATE on a GEOS disk when not in GEOS would de-allocate all these sector&lt;br /&gt;
chains (and the RECORD sector as well), which would not be good!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is the dump of a BAM sector from a  GEOS-formatted  D64  image  and&lt;br /&gt;
there are some changes for GEOS. We have all the typical data (forward  t/s&lt;br /&gt;
pointer to 18/1, DOS type, disk name/id) but we also have  the  GEOS-format&lt;br /&gt;
signature from $AB-BC. From observation, any GEOS-formatted disk will  have&lt;br /&gt;
the GEOS signature written in the same place (offset  $AB)  in  the  sector&lt;br /&gt;
that contains the disk name/ID.&lt;br /&gt;
&lt;br /&gt;
      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
      -----------------------------------------------  ----------------&lt;br /&gt;
  00: 12 01 41 00 13 FE DF 1F 0A 69 29 0D 15 FF FF 1F  ??A??????i)?????&lt;br /&gt;
  10: 0C 96 D6 16 01 00 00 10 00 00 00 00 11 FD BD 1D  ????????????????&lt;br /&gt;
  20: 15 FF FF 1F 0C 96 D6 16 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  40: 00 00 00 00 00 00 00 00 0F FC FD 05 00 00 00 00  ????????????????&lt;br /&gt;
  50: 00 00 00 00 06 05 05 05 01 00 40 00 00 00 00 00  ??????????@?????&lt;br /&gt;
  60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  80: 00 00 00 00 00 00 00 00 01 00 02 00 11 FF FF 01  ????????????????&lt;br /&gt;
  90: 41 70 70 6C 69 63 61 74 69 6F 6E 73 A0 A0 A0 A0  Applications????&lt;br /&gt;
  A0: A0 A0 4A 44 A0 32 41 A0 A0 A0 A0 13 08 47 45 4F  ??JD?2A??????GEO&lt;br /&gt;
  B0: 53 20 66 6F 72 6D 61 74 20 56 31 2E 30 50 BD 1E  S?format?V1.0P??&lt;br /&gt;
  C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  D0: 00 00 00 00 00 00 00 00 00 00 00 18 2D 00 00 00  ????????????-???&lt;br /&gt;
  E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
  Bytes:$00-01: Track/Sector location of the first directory sector (should&lt;br /&gt;
                be 18,1, but it doesn't seem to matter)&lt;br /&gt;
            02: Disk DOS version type&lt;br /&gt;
                  $41=1541&lt;br /&gt;
            03: $2A, DOS version.&lt;br /&gt;
         04-8F: BAM entries for each track, in groups  of  four  bytes  per&lt;br /&gt;
                track, starting on track 1&lt;br /&gt;
         90-9F: Disk Name (padded with $A0)&lt;br /&gt;
         A0-A1: Filled with $A0&lt;br /&gt;
         A2-A3: Disk ID&lt;br /&gt;
            A4: Usually $A0&lt;br /&gt;
         A5-A6: DOS type, usually &amp;quot;2A&amp;quot;&lt;br /&gt;
         A7-AA: Filled with $A0&lt;br /&gt;
         AB-AC: Border sector trk/sec (see below)&lt;br /&gt;
         AD-BC: GEOS ID string (&amp;quot;GEOS format V1.x&amp;quot;, in ASCII)&lt;br /&gt;
         BD-DC: Unused (usually $00)&lt;br /&gt;
         DD-FF: Free sector info for tracks  36-70,  used  on  double-sided&lt;br /&gt;
                1571 disks only!&lt;br /&gt;
&lt;br /&gt;
The first two bytes at $AB/$AC ($13 $08) are the track/sector location of&lt;br /&gt;
the BORDER SECTOR, which is one sector long,  has  the  same  layout  as  a&lt;br /&gt;
normal directory sector, and is used for copying files  from  one  disk  to&lt;br /&gt;
another. When you need to copy a file, you drag the icon to the  bottom  of&lt;br /&gt;
the screen and the file is moved from its normal location in the  directory&lt;br /&gt;
to the border sector. Since it is  only  1  sector,  it  can  only  hold  8&lt;br /&gt;
entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to check to see if a disk is formatted for  GEOS,  check  the&lt;br /&gt;
string in the BAM sector starting at $AD (offset 173) for the string  &amp;quot;GEOS&lt;br /&gt;
format&amp;quot;. If it does not match, the disk is not in GEOS format. This is  the&lt;br /&gt;
way that GEOS itself verifies if a disk is GEOS formatted.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On a D64/1541, here is how GEOS allocates blocks as it either saves files&lt;br /&gt;
or needs blocks for other purposes:&lt;br /&gt;
&lt;br /&gt;
Saving files: When there's still at least one free  block  in  the  current&lt;br /&gt;
track, then the next block is searched for starting at the sector which  is&lt;br /&gt;
away from the current one by at least the soft interleave.  The  exceptions&lt;br /&gt;
are track 25 and  above  where  the  interleave  changes  to  the  original&lt;br /&gt;
interleave _minus one_.&lt;br /&gt;
&lt;br /&gt;
When stepping to the next track, the sector where the  next  block  of  the&lt;br /&gt;
files is saved to is computed as following:&lt;br /&gt;
&lt;br /&gt;
  New sector = (Next track - Previous Track) * 2 + 4 + Soft interleave&lt;br /&gt;
&lt;br /&gt;
Getting the Border Sector: When allocating  the  GEOS  border  sector,  the&lt;br /&gt;
search starts upwards from sector 19/0 for a  free  sector  and  then  from&lt;br /&gt;
sector 1/0 if no free one has been found yet.&lt;br /&gt;
&lt;br /&gt;
Getting the first sector for saving a file: Start searching from sector 1/0&lt;br /&gt;
and, on the first track that has  at  least  one  free  sector,  you  start&lt;br /&gt;
searching at the sector computed by the form above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How to detect if a file is GEOS ===&lt;br /&gt;
&lt;br /&gt;
1. Check the bottom 3 bits of the D64 file type (byte position $02  of  the&lt;br /&gt;
directory entry). If it is not 0, 1 or 2  (but  3  or  higher,  REL  and&lt;br /&gt;
above), the file cannot be GEOS.&lt;br /&gt;
&lt;br /&gt;
2. Check the FILE STRUCTURE and FILE TYPE bytes (byte position $23 and  $24&lt;br /&gt;
respectively). If they are both $00, then the file is not GEOS, but is a&lt;br /&gt;
normal D64 filetype (no INFO block either).&lt;br /&gt;
&lt;br /&gt;
3. Check the FILE STRUCTURE byte (position $23). If it  is  anything  other&lt;br /&gt;
than $00 or $01, then the file is not GEOS (as those are the only  legal&lt;br /&gt;
values).&lt;br /&gt;
&lt;br /&gt;
4. If you've reached this point, and everything looks ok, then the file  is&lt;br /&gt;
GEOS. Now, if the FILE STRUCTURE byte (position $23) is a $01, then  the&lt;br /&gt;
file is a GEOS VLIR, othersize it is a GEOS SEQ.&lt;br /&gt;
&lt;br /&gt;
5. Check the FILE TYPE byte (position $24). If it is non-zero,  then  there&lt;br /&gt;
is likely an INFO block attached.  Check  the  track/sector  pointer  at&lt;br /&gt;
position $21/22 to see if they are valid numbers (track within the specs&lt;br /&gt;
of the disk and sector in range for the track value). If they look good,&lt;br /&gt;
then the info block exists.&lt;br /&gt;
&lt;br /&gt;
(Content taken from [http://unusedino.de/ec64/technical/formats/geos.html GEOS.TXT] in Peter Scheper's compendium of c64 file formats)&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/CBMFS</id>
		<title>CBMFS</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/CBMFS"/>
				<updated>2013-05-20T21:20:36Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|formattype=electronic&lt;br /&gt;
|subcat=Filesystem&lt;br /&gt;
}}&lt;br /&gt;
The CBM File System was used by disk drives made by Commodore Business Machines for the  PET, VIC-20, C64 and C128 range of computers. These drives were called 'intelligent peripherals' meaning the DOS (Disk Operating System) was runs in the drive itself, not on the computer the drive was attached to.&lt;br /&gt;
&lt;br /&gt;
The most popular CBM drive was the 1541, which supported 35 tracks using GCR encoding. &lt;br /&gt;
&lt;br /&gt;
==D64 File Format ==&lt;br /&gt;
&lt;br /&gt;
The D64 format is most frequently used to capture 1541 disk images, it consists of a sector-for-sector copy of a 1540/1541 disk.  The standard D64 is a 174848 byte file comprised of 256 byte sectors arranged in 35 tracks with a varying number of  sectors  per  track for a total of 683 sectors. Track counting starts at 1, not 0, and goes  up&lt;br /&gt;
to 35. Sector counting starts at 0, not 1, for the first sector,  therefore a track with 21 sectors will go from 0 to 20.&lt;br /&gt;
&lt;br /&gt;
The original media (a 5.25&amp;quot; disk) has the tracks  laid  out  in  circles, with track 1 on the very outside of the disk  (closest  to  the  sides)  to track 35 being on the inside of the disk (closest to the inner  hub  ring). Commodore, in their infinite wisdom, varied the number of sectors per track and data densities across the disk to optimize available storage, resulting in the chart below. It shows the sectors/track for a  standard  D64.  Since the outside diameter of a circle is  the  largest  (versus  closer  to  the center), the outside tracks have the largest amount of storage.&lt;br /&gt;
&lt;br /&gt;
        Track   Sectors/track   # Sectors   Storage in Bytes&lt;br /&gt;
        -----   -------------   ---------   ----------------&lt;br /&gt;
         1-17        21            357           7820&lt;br /&gt;
        18-24        19            133           7170&lt;br /&gt;
        25-30        18            108           6300&lt;br /&gt;
        31-40(*)     17             85           6020&lt;br /&gt;
                                   ---&lt;br /&gt;
                                   683 (for a 35 track image)&lt;br /&gt;
&lt;br /&gt;
  Track #Sect #SectorsIn D64 Offset   Track #Sect #SectorsIn D64 Offset&lt;br /&gt;
  ----- ----- ---------- ----------   ----- ----- ---------- ----------&lt;br /&gt;
    1     21       0       $00000      21     19     414       $19E00&lt;br /&gt;
    2     21      21       $01500      22     19     433       $1B100&lt;br /&gt;
    3     21      42       $02A00      23     19     452       $1C400&lt;br /&gt;
    4     21      63       $03F00      24     19     471       $1D700&lt;br /&gt;
    5     21      84       $05400      25     18     490       $1EA00&lt;br /&gt;
    6     21     105       $06900      26     18     508       $1FC00&lt;br /&gt;
    7     21     126       $07E00      27     18     526       $20E00&lt;br /&gt;
    8     21     147       $09300      28     18     544       $22000&lt;br /&gt;
    9     21     168       $0A800      29     18     562       $23200&lt;br /&gt;
   10     21     189       $0BD00      30     18     580       $24400&lt;br /&gt;
   11     21     210       $0D200      31     17     598       $25600&lt;br /&gt;
   12     21     231       $0E700      32     17     615       $26700&lt;br /&gt;
   13     21     252       $0FC00      33     17     632       $27800&lt;br /&gt;
   14     21     273       $11100      34     17     649       $28900&lt;br /&gt;
   15     21     294       $12600      35     17     666       $29A00&lt;br /&gt;
   16     21     315       $13B00      36(*)  17     683       $2AB00&lt;br /&gt;
   17     21     336       $15000      37(*)  17     700       $2BC00&lt;br /&gt;
   18     19     357       $16500      38(*)  17     717       $2CD00&lt;br /&gt;
   19     19     376       $17800      39(*)  17     734       $2DE00&lt;br /&gt;
   20     19     395       $18B00      40(*)  17     751       $2EF00&lt;br /&gt;
&lt;br /&gt;
  (*)Tracks 36-40 apply to 40-track images only&lt;br /&gt;
&lt;br /&gt;
The directory track should be contained totally on track 18. Sectors 1-18&lt;br /&gt;
contain the entries and sector 0 contains the BAM (Block Availability  Map)&lt;br /&gt;
and disk name/ID. Since the directory is only 18 sectors large (19 less one&lt;br /&gt;
for the BAM), and each sector can contain only  8  entries  (32  bytes  per&lt;br /&gt;
entry), the maximum number of directory entries is 18 * 8 = 144. The  first&lt;br /&gt;
directory sector is always 18/1, even though the t/s pointer at 18/0 (first&lt;br /&gt;
two bytes) might point somewhere else.  It  then  follows  the  same  chain&lt;br /&gt;
structure as a normal file, using a sector interleave of 3. This makes  the&lt;br /&gt;
chain links go 18/1, 18/4, 18/7 etc.&lt;br /&gt;
&lt;br /&gt;
Note that you can extend the directory off  of  track  18,  but  only  when&lt;br /&gt;
reading the disk or image. Attempting to write to a directory sector not on&lt;br /&gt;
track 18 will cause directory corruption.&lt;br /&gt;
&lt;br /&gt;
Each directory sector has the following layout (18/1 partial dump):&lt;br /&gt;
&lt;br /&gt;
    00: 12 04 81 11 00 4E 41 4D 45 53 20 26 20 50 4F 53 &amp;lt;- notice the T/S link&lt;br /&gt;
    10: 49 54 A0 A0 A0 00 00 00 00 00 00 00 00 00 15 00 &amp;lt;- to 18/4 ($12/$04)&lt;br /&gt;
    20: 00 00 84 11 02 41 44 44 49 54 49 4F 4E 41 4C 20 &amp;lt;- and how its not here&lt;br /&gt;
    30: 49 4E 46 4F A0 11 0C FE 00 00 00 00 00 00 61 01 &amp;lt;- ($00/$00)&lt;br /&gt;
&lt;br /&gt;
The first two bytes of the sector ($12/$04) indicate the location of  the&lt;br /&gt;
next track/sector of the directory (18/4). If the track is set to $00, then&lt;br /&gt;
it is the last sector of the directory. It is possible,  however  unlikely,&lt;br /&gt;
that the directory may *not* be competely on track 18 (some disks do  exist&lt;br /&gt;
like this). Just follow the chain anyhow.&lt;br /&gt;
&lt;br /&gt;
When the directory is done, the track value will be $00. The sector  link&lt;br /&gt;
should contain a value of $FF, meaning the whole sector is  allocated,  but&lt;br /&gt;
the actual value doesn't matter. The drive will return  all  the  available&lt;br /&gt;
entries anyways. This is a breakdown of a  standard  directory  sector  and&lt;br /&gt;
entry:&lt;br /&gt;
&lt;br /&gt;
  Bytes: $00-1F: First directory entry&lt;br /&gt;
          00-01: Track/Sector location of next directory sector ($00 $00 if&lt;br /&gt;
                 not the first entry in the sector)&lt;br /&gt;
             02: File type.&lt;br /&gt;
                 Typical values for this location are:&lt;br /&gt;
                   $00 - Scratched (deleted file entry)&lt;br /&gt;
                    80 - DEL&lt;br /&gt;
                    81 - SEQ&lt;br /&gt;
                    82 - PRG&lt;br /&gt;
                    83 - USR&lt;br /&gt;
                    84 - REL&lt;br /&gt;
                 Bit 0-3: The actual filetype&lt;br /&gt;
                          000 (0) - DEL&lt;br /&gt;
                          001 (1) - SEQ&lt;br /&gt;
                          010 (2) - PRG&lt;br /&gt;
                          011 (3) - USR&lt;br /&gt;
                          100 (4) - REL&lt;br /&gt;
                          Values 5-15 are illegal, but if used will produce&lt;br /&gt;
                          very strange results. The 1541 is inconsistent in&lt;br /&gt;
                          how it treats these bits. Some routines use all 4&lt;br /&gt;
                          bits, others ignore bit 3,  resulting  in  values&lt;br /&gt;
                          from 0-7.&lt;br /&gt;
                 Bit   4: Not used&lt;br /&gt;
                 Bit   5: Used only during SAVE-@ replacement&lt;br /&gt;
                 Bit   6: Locked flag (Set produces &amp;quot;&amp;gt;&amp;quot; locked files)&lt;br /&gt;
                 Bit   7: Closed flag  (Not  set  produces  &amp;quot;*&amp;quot;, or &amp;quot;splat&amp;quot;&lt;br /&gt;
                          files)&lt;br /&gt;
          03-04: Track/sector location of first sector of file&lt;br /&gt;
          05-14: 16 character filename (in PETASCII, padded with $A0)&lt;br /&gt;
          15-16: Track/Sector location of first side-sector block (REL file&lt;br /&gt;
                 only)&lt;br /&gt;
             17: REL file record length (REL file only, max. value 254)&lt;br /&gt;
          18-1D: Unused (except with GEOS disks)&lt;br /&gt;
          1E-1F: File size in sectors, low/high byte  order  ($1E+$1F*256).&lt;br /&gt;
                 The approx. filesize in bytes is &amp;lt;= #sectors * 254&lt;br /&gt;
          20-3F: Second dir entry. From now on the first two bytes of  each&lt;br /&gt;
                 entry in this sector  should  be  $00  $00,  as  they  are&lt;br /&gt;
                 unused.&lt;br /&gt;
          40-5F: Third dir entry&lt;br /&gt;
          60-7F: Fourth dir entry&lt;br /&gt;
          80-9F: Fifth dir entry&lt;br /&gt;
          A0-BF: Sixth dir entry&lt;br /&gt;
          C0-DF: Seventh dir entry&lt;br /&gt;
          E0-FF: Eighth dir entry&lt;br /&gt;
&lt;br /&gt;
Files, on a standard 1541, are stored using an interleave of 10. Assuming a&lt;br /&gt;
starting track/sector of 17/0, the chain  would  run  17/0,  17/10,  17/20,&lt;br /&gt;
17/8, 17/18, etc.&lt;br /&gt;
&lt;br /&gt;
Note: No GEOS entries are listed in the above description. See [[GEOS VLIR]] for GEOS info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The layout of the BAM area (sector 18/0) is a bit more complicated...&lt;br /&gt;
&lt;br /&gt;
      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F&lt;br /&gt;
      -----------------------------------------------&lt;br /&gt;
  00: 12 01 41 00 12 FF F9 17 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  10: 15 FF FF 1F 12 FF F9 17 00 00 00 00 00 00 00 00&lt;br /&gt;
  20: 00 00 00 00 0E FF 74 03 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  30: 0E 3F FC 11 07 E1 80 01 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  40: 15 FF FF 1F 15 FF FF 1F 0D C0 FF 07 13 FF FF 07&lt;br /&gt;
  50: 13 FF FF 07 11 FF CF 07 13 FF FF 07 12 7F FF 07&lt;br /&gt;
  60: 13 FF FF 07 0A 75 55 01 00 00 00 00 00 00 00 00&lt;br /&gt;
  70: 00 00 00 00 00 00 00 00 01 08 00 00 03 02 48 00&lt;br /&gt;
  80: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01&lt;br /&gt;
  90: 53 48 41 52 45 57 41 52 45 20 31 20 20 A0 A0 A0&lt;br /&gt;
  A0: A0 A0 56 54 A0 32 41 A0 A0 A0 A0 00 00 00 00 00&lt;br /&gt;
  B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
&lt;br /&gt;
  Bytes:$00-01: Track/Sector location of the first directory sector (should&lt;br /&gt;
                be set to 18/1 but it doesn't matter, and don't trust  what&lt;br /&gt;
                is there, always go to 18/1 for first directory entry)&lt;br /&gt;
            02: Disk DOS version type (see note below)&lt;br /&gt;
                  $41 (&amp;quot;A&amp;quot;)&lt;br /&gt;
            03: Unused&lt;br /&gt;
         04-8F: BAM entries for each track, in groups  of  four  bytes  per&lt;br /&gt;
                track, starting on track 1 (see below for more details)&lt;br /&gt;
         90-9F: Disk Name (padded with $A0)&lt;br /&gt;
         A0-A1: Filled with $A0&lt;br /&gt;
         A2-A3: Disk ID&lt;br /&gt;
            A4: Usually $A0&lt;br /&gt;
         A5-A6: DOS type, usually &amp;quot;2A&amp;quot;&lt;br /&gt;
         A7-AA: Filled with $A0&lt;br /&gt;
         AB-FF: Normally unused ($00), except for 40 track extended format,&lt;br /&gt;
                see the following two entries:&lt;br /&gt;
         AC-BF: DOLPHIN DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
         C0-D3: SPEED DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
&lt;br /&gt;
Note: The BAM entries for SPEED, DOLPHIN and  ProLogic  DOS  use  the  same layout as standard BAM entries.&lt;br /&gt;
&lt;br /&gt;
One of the interesting things from the BAM sector is the byte  at  offset&lt;br /&gt;
$02, the DOS version byte. If it is set to anything other than $41 or  $00,&lt;br /&gt;
then we have what is called &amp;quot;soft write protection&amp;quot;. Any attempt  to  write&lt;br /&gt;
to the disk will return the &amp;quot;DOS Version&amp;quot; error code 73  ,&amp;quot;CBM  DOS  V  2.6&lt;br /&gt;
1541&amp;quot;. The 1541 is simply telling  you  that  it  thinks  the  disk  format&lt;br /&gt;
version is incorrect. This message will normally come  up  when  you  first&lt;br /&gt;
turn on the 1541 and read the error channel. If you write a $00  or  a  $41&lt;br /&gt;
into 1541 memory location $00FF (for device 0),  then  you  can  circumvent&lt;br /&gt;
this type of write-protection, and change the DOS version back to  what  it&lt;br /&gt;
should be.&lt;br /&gt;
&lt;br /&gt;
The BAM entries require a bit (no pun intended) more of a breakdown. Take&lt;br /&gt;
the first entry at bytes $04-$07 ($12 $FF $F9 $17). The first byte ($12) is&lt;br /&gt;
the number of free sectors on that track. Since we are looking at the track&lt;br /&gt;
1 entry, this means it has 18 (decimal) free sectors. The next three  bytes&lt;br /&gt;
represent the bitmap of which sectors are used/free. Since it is 3 bytes (8&lt;br /&gt;
bits/byte) we have 24 bits of storage. Remember that at  most,  each  track&lt;br /&gt;
only has 21 sectors, so there are a few unused bits.&lt;br /&gt;
&lt;br /&gt;
   Bytes: 04-07: 12 FF F9 17   Track 1 BAM&lt;br /&gt;
          08-0B: 15 FF FF FF   Track 2 BAM&lt;br /&gt;
          0C-0F: 15 FF FF 1F   Track 3 BAM&lt;br /&gt;
          ...&lt;br /&gt;
          8C-8F: 11 FF FF 01   Track 35 BAM&lt;br /&gt;
&lt;br /&gt;
These entries must be viewed in binary to make any sense. We will use the&lt;br /&gt;
first entry (track 1) at bytes 04-07:&lt;br /&gt;
&lt;br /&gt;
     FF=11111111, F9=11111001, 17=00010111&lt;br /&gt;
&lt;br /&gt;
In order to make any sense from the binary notation, flip the bits around.&lt;br /&gt;
&lt;br /&gt;
                   111111 11112222&lt;br /&gt;
        01234567 89012345 67890123&lt;br /&gt;
        --------------------------&lt;br /&gt;
        11111111 10011111 11101000&lt;br /&gt;
        ^                     ^&lt;br /&gt;
    sector 0              sector 20&lt;br /&gt;
&lt;br /&gt;
Since we are on the first track, we have 21 sectors, and only use  up  to&lt;br /&gt;
the bit 20 position. If a bit is on (1), the  sector  is  free.  Therefore,&lt;br /&gt;
track 1 has sectors 9,10 and 19 used, all the rest are free.  Any  leftover&lt;br /&gt;
bits that refer to sectors that don't exist, like bits 21-23 in  the  above&lt;br /&gt;
example, are set to allocated.&lt;br /&gt;
&lt;br /&gt;
Each filetype has its own unique properties, but most follow  one  simple&lt;br /&gt;
structure. The first file sector is pointed to by the directory and follows&lt;br /&gt;
a t/s chain, until the track value reaches  $00.  When  this  happens,  the&lt;br /&gt;
value in the sector link location indicates how much of the sector is used.&lt;br /&gt;
For example, the following chain indicates a file 6 sectors long, and  ends&lt;br /&gt;
when we encounter the $00/$34 chain. At this point the last sector occupies&lt;br /&gt;
from bytes $02-$34.&lt;br /&gt;
&lt;br /&gt;
    1       2       3       4       5       6&lt;br /&gt;
  ----    -----   -----   -----   -----   -----&lt;br /&gt;
  17/0    17/10   17/20   17/1    17/11    0/52&lt;br /&gt;
 (11/00) (11/0A) (11/14) (11/01) (11/0B)  (0/34)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Variations on the D64 layout ==&lt;br /&gt;
&lt;br /&gt;
     &lt;br /&gt;
These are some variations of the D64 layout:&lt;br /&gt;
&lt;br /&gt;
1. Standard 35 track layout but with 683 error bytes added on to the  end&lt;br /&gt;
of the file. Each byte of the  error  info  corresponds  to  a  single&lt;br /&gt;
sector stored in the D64, indicating if the  sector  on  the  original&lt;br /&gt;
disk contained an error. The first byte is for track 1/0, and the last&lt;br /&gt;
byte is for track 35/16.&lt;br /&gt;
&lt;br /&gt;
2. A 40 track layout, following the same layout as a 35 track  disk,  but &lt;br /&gt;
with 5 extra tracks. These contain 17 sectors each, like tracks 31-35.&lt;br /&gt;
Some of the PC utilities do allow you to create and  work  with  these&lt;br /&gt;
files. This can also have error bytes attached like variant #1.&lt;br /&gt;
&lt;br /&gt;
3. The Commodore 128 allowed for &amp;quot;auto-boot&amp;quot; disks. With  this,  t/s  1/0&lt;br /&gt;
holds a specific byte sequence which the computer recognizes  as  boot&lt;br /&gt;
code. See the document C128BOOT.TXT for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a small chart detailing the standard file sizes of  D64  images,&lt;br /&gt;
35 or 40 tracks, with or without error bytes.&lt;br /&gt;
&lt;br /&gt;
     Disk type                  Size&lt;br /&gt;
     ---------                  ------&lt;br /&gt;
     35 track, no errors        174848&lt;br /&gt;
     35 track, 683 error bytes  175531&lt;br /&gt;
     40 track, no errors        196608&lt;br /&gt;
     40 track, 768 error bytes  197376&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table (provided by Wolfgang Moser) outlines the differences&lt;br /&gt;
between the standard 1541 DOS and the various &amp;quot;speeder&amp;quot; DOS's  that  exist.&lt;br /&gt;
The 'header 7/8' category is the 'fill bytes' as  the  end  of  the  sector&lt;br /&gt;
header of  a  real  1541  disk  See  [[G64]]  for  a  better&lt;br /&gt;
explanation of these bytes.&lt;br /&gt;
&lt;br /&gt;
        Disk format             |Tracks|Header 7/8|Dos type|DiskDos&lt;br /&gt;
                                |      |allsechdrs|        |vs.type&lt;br /&gt;
       ============================================================&lt;br /&gt;
        Original CBM DOS v2.6   |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        SpeedDOS+               |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfessionalDOS Initial |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
          (Version 1/Prototype) |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfDOS Release         |  40  | $0f  $0f |  &amp;quot;4A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  40  | $0d  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        PrologicDOS 1541        |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        PrologicDOS 1541        |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
        ProSpeed 1571 2.0       |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        ProSpeed 1571 2.0       |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The location of the extra BAM information in sector 18/0,  for  40  track&lt;br /&gt;
images, will be different depending on what standard the  disks  have  been&lt;br /&gt;
formatted with. SPEED DOS stores them from $C0 to $D3, DOLPHIN  DOS  stores&lt;br /&gt;
them from $AC to $BF and PrologicDOS stored them right after  the  existing&lt;br /&gt;
BAM entries from $90-A3. PrologicDOS also  moves  the  disk  label  and  ID&lt;br /&gt;
forward from the standard location of $90 to $A4. 64COPY and Star Commander&lt;br /&gt;
let you select from several different types of extended  disk  formats  you&lt;br /&gt;
want to create/work with.&lt;br /&gt;
&lt;br /&gt;
All three of the speeder DOS's mentioned above don't alter  the  standard&lt;br /&gt;
sector interleave of 10 for files and 3 for directories. The reason is that&lt;br /&gt;
they use a memory cache installed in the drive which reads the entire track&lt;br /&gt;
in one pass. This alleviates the need for custom interleave values. They do&lt;br /&gt;
seem to alter the algorithm that finds the next available  free  sector  so&lt;br /&gt;
that the interleave value can deviate from 10 under certain  circumstances,&lt;br /&gt;
but I don't know why they would bother.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Speed DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $C0-D3.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 00 00 00 00  ??00?2A?????????&lt;br /&gt;
  00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00C0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00D0: 11 FF FF 01 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Dolphin DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $AC-BF.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 11 FF FF 01  ??00?2A?????????&lt;br /&gt;
  00B0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ???????????????? &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a PrologicDOS BAM sector. Note that the disk  name&lt;br /&gt;
and ID are now located at $A4 instead of starting at $90.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00A0: 11 FF FF 01 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00B0: A0 A0 A0 A0 A0 A0 30 30 A0 32 50 A0 A0 A0 A0 00  ??????00?2P?????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00ED: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the meaning of the error bytes added onto the end of any extended&lt;br /&gt;
D64. The CODE is the same as that generated by the 1541 drive controller...&lt;br /&gt;
it reports these numbers, not the error code we usually see when  an  error&lt;br /&gt;
occurs.&lt;br /&gt;
&lt;br /&gt;
Some of what comes  below  is  taken  from  Immers/Neufeld  book  &amp;quot;Inside&lt;br /&gt;
Commodore DOS&amp;quot;. Note the descriptions are not  completely  accurate  as  to&lt;br /&gt;
what the drive DOS is actually doing to seek/read/decode/write sectors, but&lt;br /&gt;
serve as simple examples only. The &amp;quot;type&amp;quot; field is where the error  usually&lt;br /&gt;
occurs, whether it's searching for any SYNC mark, any header ID, any  valid&lt;br /&gt;
header, or reading a sector.&lt;br /&gt;
&lt;br /&gt;
These first errors are &amp;quot;seek&amp;quot; errors, where the disk controller is simply&lt;br /&gt;
reading headers and looking at descriptor bytes, checksums, format ID's and&lt;br /&gt;
reporting what errors it sees. These errors do *not* necessarily  apply  to&lt;br /&gt;
the exact sector being looked for. This fact  makes  duplication  of  these&lt;br /&gt;
errors very unreliable.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     03    21    Seek   No SYNC sequence found.&lt;br /&gt;
                        Each  sector  data  block  and  header  block   are&lt;br /&gt;
                        preceeded by SYNC marks. If *no* sync  sequence  is&lt;br /&gt;
                        found within 20 milliseconds (only ~1/10 of a  disk&lt;br /&gt;
                        rotation!) then this error is generated. This error&lt;br /&gt;
                        used to mean the entire track is bad, but  it  does&lt;br /&gt;
                        not have to be the case. Only a small area  of  the&lt;br /&gt;
                        track needs to be without  a  SYNC  mark  and  this&lt;br /&gt;
                        error will be generated.&lt;br /&gt;
                        Converting this error to a D64 is very  problematic&lt;br /&gt;
                        because it depends on where the physical head is on&lt;br /&gt;
                        the disk when a read attempt is made. If it  is  on&lt;br /&gt;
                        valid header/sectors then it  won't  occur.  If  it&lt;br /&gt;
                        happens over an area without SYNC  marks,  it  will&lt;br /&gt;
                        happen.&lt;br /&gt;
     02    20    Seek   Header descriptor byte not found (HEX $08, GCR $52)&lt;br /&gt;
                        Each sector is preceeded by an  8-byte  GCR  header&lt;br /&gt;
                        block, which starts with the value  $52  (GCR).  If&lt;br /&gt;
                        this value is not found  after  90  attempts,  this&lt;br /&gt;
                        error is generated.&lt;br /&gt;
                        Basically, what a track  has  is  SYNC  marks,  and&lt;br /&gt;
                        possibly valid data blocks,  but  no  valid  header&lt;br /&gt;
                        descriptors.&lt;br /&gt;
     09    27    Seek   Checksum error in header block&lt;br /&gt;
                        The  header  block  contains  a   checksum   value,&lt;br /&gt;
                        calculated by XOR'ing the TRACK,  SECTOR,  ID1  and&lt;br /&gt;
                        ID2 values. If this checksum is wrong,  this  error&lt;br /&gt;
                        is generated.&lt;br /&gt;
     0B    29    Seek   Disk sector ID mismatch&lt;br /&gt;
                        The ID's from the header  block  of  the  currently&lt;br /&gt;
                        read sector are compared against the ones from  the&lt;br /&gt;
                        low-level header of 18/0. If there is  a  mismatch,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
     02    20    Seek   Header block not found&lt;br /&gt;
                        This error can be reported again when searching for&lt;br /&gt;
                        the correct header block. An image of the header is&lt;br /&gt;
                        built and searched for, but not found after 90 read&lt;br /&gt;
                        attempts.  Note  the  difference  from  the   first&lt;br /&gt;
                        occurance. The first one only searches for a  valid&lt;br /&gt;
                        ID, not the whole header.&lt;br /&gt;
&lt;br /&gt;
Note that error 20 occurs twice during this phase. The first time is when&lt;br /&gt;
a header ID is being searched for, the second is  when  the  proper  header&lt;br /&gt;
pattern for the sector being searched for is not found.&lt;br /&gt;
&lt;br /&gt;
From this point on, all the errors apply to the specific sector  you  are&lt;br /&gt;
looking for. If a read passed all the previous checks, then we are  at  the&lt;br /&gt;
sector being searched for.&lt;br /&gt;
&lt;br /&gt;
Note that the entire sector is read before  these  errors  are  detected.&lt;br /&gt;
Therefore the data, checksum and off bytes are available.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     04    22    Read   Data descriptor byte not found (HEX $07, GCR $55)&lt;br /&gt;
                        Each sector data block is preceeded  by  the  value&lt;br /&gt;
                        $07, the &amp;quot;data block&amp;quot; descriptor. If this value  is&lt;br /&gt;
                        not there, this error is  generated.  Each  encoded&lt;br /&gt;
                        sector  has  actually  260  bytes.  First  is   the&lt;br /&gt;
                        descriptor byte, then  follows  the  256  bytes  of&lt;br /&gt;
                        data, a checksum, and two &amp;quot;off&amp;quot; bytes.&lt;br /&gt;
     05    23    Read   Checksum error in data block&lt;br /&gt;
                        The checksum of  the  data  read  of  the  disk  is&lt;br /&gt;
                        calculated, and compared against the one stored  at&lt;br /&gt;
                        the end of the sector. If  there's  a  discrepancy,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
     0F    74    Read   Drive Not Ready (no disk in drive or no device 1)&lt;br /&gt;
&lt;br /&gt;
These errors only  apply  when  writing  to  a  disk.  I  don't  see  the&lt;br /&gt;
usefulness of having these as they cannot be present when only *reading*  a&lt;br /&gt;
disk.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     06    24    Write  Write verify (on format)&lt;br /&gt;
     07    25    Write  Write verify error&lt;br /&gt;
                        Once the GCR-encoded sector  is  written  out,  the&lt;br /&gt;
                        drive waits for the sector to come around again and&lt;br /&gt;
                        verifies the whole 325-byte GCR block.  Any  errors&lt;br /&gt;
                        encountered will generate this error.&lt;br /&gt;
     08    26    Write  Write protect on&lt;br /&gt;
                        Self explanatory. Remove the write-protect tab, and&lt;br /&gt;
                        try again.&lt;br /&gt;
     0A    28    Write  Write error&lt;br /&gt;
                        In actual fact, this error never occurs, but it  is&lt;br /&gt;
                        included for completeness.&lt;br /&gt;
&lt;br /&gt;
This is not an error at all, but when gets reported when the  read  of  a&lt;br /&gt;
sector is ok.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     01    00    N/A    No error.&lt;br /&gt;
                        Self explanatory. No errors were  detected  in  the&lt;br /&gt;
                        reading and decoding of the sector.&lt;br /&gt;
&lt;br /&gt;
The advantage with using the 35 track D64  format,  regardless  of  error&lt;br /&gt;
bytes, is that it can be converted directly back to a 1541 disk  by  either&lt;br /&gt;
using the proper cable and software on the PC, or send it down to  the  C64&lt;br /&gt;
and writing it back to a 1541. It is the best documented format since it is&lt;br /&gt;
also native to the C64, with many books explaining the disk layout and  the&lt;br /&gt;
internals of the 1541.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What it takes to support D64 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The D64 layout is reasonably robust,  being  that  it  is  an  electronic&lt;br /&gt;
representation of a physical 1541  disk.  It  shares  *most*  of  the  1541&lt;br /&gt;
attributes and it supports all file formats, since all C64 files came  from&lt;br /&gt;
here. The only file I have found that can't be copied to a D64 is a T64 FRZ&lt;br /&gt;
(FRoZen files), since you lose the extra file type attribute.&lt;br /&gt;
&lt;br /&gt;
Since the D64 layout seems to be an exact byte copy of a 1541 floppy,  it&lt;br /&gt;
would appear to be the perfect format for *any* emulator. However, it  does&lt;br /&gt;
not contain certain vital bits of information that, as a user, you normally&lt;br /&gt;
don't have access to.&lt;br /&gt;
&lt;br /&gt;
Preceeding each sector on a real  1541  disk  is  a  header  block  which&lt;br /&gt;
contains the sector ID bytes and checksum. From the  information  contained&lt;br /&gt;
in the header, the drive determines if there's  an  error  on  that  header&lt;br /&gt;
(27-checksum error, 29-disk ID mismatch). The sector itself  also  contains&lt;br /&gt;
info (data block signature, checksum) that result in  error  detection  (23&lt;br /&gt;
checksum, 22 data block not present, etc). The error bytes had to be  added&lt;br /&gt;
on to the D64 image, &amp;quot;extending&amp;quot;  the  format  to  take  into  account  the&lt;br /&gt;
missing info.&lt;br /&gt;
&lt;br /&gt;
The disk ID is important in the copy protection of  some  programs.  Some&lt;br /&gt;
programs fail to work properly since the D64 doesn't  contain  these  ID's.&lt;br /&gt;
These bytes would be an addition to the format which has  never  been  done&lt;br /&gt;
and would be difficult to do. (As an aside, the  4-pack  ZipCode  files  do&lt;br /&gt;
contain the original master disk ID, but these are lost in  the  conversion&lt;br /&gt;
of a ZipCode to a D64. Only storing *one* of the ID's is  not  enough,  all&lt;br /&gt;
the sector ID's should be kept.)&lt;br /&gt;
&lt;br /&gt;
The extended track 1541 disks also presented  a  problem,  as  there  are&lt;br /&gt;
several different formats (and how/where to store the extra BAM entries  in&lt;br /&gt;
a sector that was not designed for  them,  yet  still  remain  compatible).&lt;br /&gt;
Because of the additions to the format (error bytes and  40  tracks)  there&lt;br /&gt;
exists 4 different types of D64's, all recognizeable by their size.&lt;br /&gt;
&lt;br /&gt;
It is also the only format that uses the sector count for the  file  size&lt;br /&gt;
rather than  actual  bytes  used.  This  can  present  some  problems  when&lt;br /&gt;
converting/copying the to another format because you may have to  know  the&lt;br /&gt;
size before you begin (see LBR format).&lt;br /&gt;
&lt;br /&gt;
It also contains no consistent signature, useful for recognizing  if  D64&lt;br /&gt;
is really what it claims to be. In order to determine if a file is  a  D64,&lt;br /&gt;
you must check the file size.&lt;br /&gt;
&lt;br /&gt;
(Content taken from [http://unusedino.de/ec64/technical/formats/d64.html D64.TXT] in Peter Scheper's excellent compendium of C64 file format information).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Commodore computers]]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/Filesystem</id>
		<title>Filesystem</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/Filesystem"/>
				<updated>2013-05-20T21:20:07Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: add GEOS VLIR&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|formattype=electronic&lt;br /&gt;
|thiscat=Filesystem&lt;br /&gt;
|image=Office Supplies File Cabinet 02.png&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Filesystems are [[Electronic_File_Formats|Electronic Formats]] that are a prerequisite to being able to read any file off a digital medium — you have to be able to mount the filesystem, and thus read it, in order to be able to read a file.&lt;br /&gt;
&lt;br /&gt;
* [[Acer Fast Filesystem]] (SCO OpenServer)&lt;br /&gt;
* [[ADFS]] (Acorn MOS, RISC OS)&lt;br /&gt;
* [[AdvFS]](Advanced File System, Digital/Tru64 Unix)&lt;br /&gt;
* [[Ami File Safe]] (Amiga)&lt;br /&gt;
* [[Andrew File System]] (Carnegie Mellon University)&lt;br /&gt;
* [[APF Imagination Machine disk file system]]&lt;br /&gt;
* [[Apple DOS file system]] (Apple II; see also ProDOS below)&lt;br /&gt;
* [[Atari File Management Subsystem]] (FMS: Atari 400/800)&lt;br /&gt;
* [[AthFS]] (AtheOS/Syllable)&lt;br /&gt;
* [[BFS]] (BeOS)&lt;br /&gt;
* [[btrfs]] (Linux)&lt;br /&gt;
* [[CBMFS]] (Commodore 64)&lt;br /&gt;
** [[GEOS VLIR]] (GEOS Variable Length Index Record )&lt;br /&gt;
** [[CMDFS]] (CBMFS extension by Creative Micro Designs)&lt;br /&gt;
* [[Compucolor file system]]&lt;br /&gt;
* [[CP/M file system]]&lt;br /&gt;
* [[DDFS]] (Data Domain File System)&lt;br /&gt;
* [[DTFS]] (Desktop File System, [[SCO OpenServer]])&lt;br /&gt;
* [[EFS]] (Extent File System, SGI IRIX. Replaced by [[XFS]])&lt;br /&gt;
* [[EOS file system]] (Coleco Adam &amp;quot;data pack&amp;quot; tape drives and disks)&lt;br /&gt;
* [[exFAT]] (Microsoft, for flash memory)&lt;br /&gt;
* [[ext]] (developed for Linux, previously used MINIX fs)&lt;br /&gt;
* [[ext2]], [[ext3]], [[ext4]] (these are all just variants of each other)&lt;br /&gt;
* [[F2FS]], (Flash Friendly Filesystem)&lt;br /&gt;
* [[FAT8]]&lt;br /&gt;
* [[FAT12]]&lt;br /&gt;
* [[FAT16]]&lt;br /&gt;
* [[FAT32]]&lt;br /&gt;
* [[FFS]] (Amiga Fast File System)&lt;br /&gt;
* [[Files-11]] (VMS)&lt;br /&gt;
* [[Fossil]] (Plan 9)&lt;br /&gt;
* [[fuse-exFAT]] (open-source clone of exFAT)&lt;br /&gt;
* [[Google File System]]&lt;br /&gt;
* [[HAMMER]] (DragonflyBSD)&lt;br /&gt;
* [[HFS]]&lt;br /&gt;
* [[HFS+]]&lt;br /&gt;
* [[HPFS]] (OS/2 native file system)&lt;br /&gt;
* [[ISO 9660]]&lt;br /&gt;
* [[JFFS2]]&lt;br /&gt;
* [[LanyFS]] (Lanyard Filesystem)&lt;br /&gt;
* [[LogFS]]&lt;br /&gt;
* [[MDR (Floppy Disk)|MDR]] (audio instrument format close to MSDOS)&lt;br /&gt;
* [[MEGA file system]]&lt;br /&gt;
* [[MFS]] (ancient Macintosh filesystem)&lt;br /&gt;
* [[MINIX file system]]&lt;br /&gt;
* [[NILFS2]]&lt;br /&gt;
* [[NetWare File System]] (Novell NetWare, replaced by [[NSS]])&lt;br /&gt;
* [[NSS]] (Novell Storage Services)&lt;br /&gt;
* [[NTFS]]&lt;br /&gt;
* [[POHMELFS]] (distributed Linux filesystem)&lt;br /&gt;
* [[PRAMFS]] (Persistent &amp;amp; Protected RAM File-System)&lt;br /&gt;
* [[ProDOS file system]] (Apple)&lt;br /&gt;
* [[QFS]]&lt;br /&gt;
* [[ReFS]] (Microsoft's new FS- Resilient Filesystem, on Windows 8 Server)&lt;br /&gt;
* [[ReiserFS]]&lt;br /&gt;
** [[Reiser4]]&lt;br /&gt;
* [[SDFS]] (Deduplication based filesystem)&lt;br /&gt;
* [[SkyFS]] (SkyOS)&lt;br /&gt;
* [[SOS file system]] (Apple III)&lt;br /&gt;
* [[squashfs]]&lt;br /&gt;
* [[UCSD p-System Filesystem]] (UCSD Pascal)&lt;br /&gt;
* [[UDF]]&lt;br /&gt;
* [[UFS]] (Unix Files System, Solaris and BSD)&lt;br /&gt;
** [[UFS2]]&lt;br /&gt;
* [[VMUFAT]] (Filesystem for Dreamcast VMU units)&lt;br /&gt;
* [[VxFS]]&lt;br /&gt;
* [[WAFL]] (NetApp's commercial file system)&lt;br /&gt;
* [[Xiafs]] (Linux, dropped in favour of ext2)&lt;br /&gt;
* [[XFS]] (SGI)&lt;br /&gt;
* [[XtreemFS]], (Linux, distributed file system)&lt;br /&gt;
* [[YAFFS]]&lt;br /&gt;
* [[ZFS]]&lt;br /&gt;
&lt;br /&gt;
== Format details ==&lt;br /&gt;
* [[desktop.ini]] (Windows)&lt;br /&gt;
* [[Desktop Services Store]] (Mac OS X)&lt;br /&gt;
* [[MBR]] (Master Boot Record)&lt;br /&gt;
* [[Resource Fork]] (MacOS)&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/CBMFS</id>
		<title>CBMFS</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/CBMFS"/>
				<updated>2013-05-20T21:13:53Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: add d64 heading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|formattype=electronic&lt;br /&gt;
|subcat=Filesystem&lt;br /&gt;
}}&lt;br /&gt;
The CBM File System was used by disk drives made by Commodore Business Machines for the  PET, VIC-20, C64 and C128 range of computers. These drives were called 'intelligent peripherals' meaning the DOS (Disk Operating System) was runs in the drive itself, not on the computer the drive was attached to.&lt;br /&gt;
&lt;br /&gt;
The most popular CBM drive was the 1541, which supported 35 tracks using GCR encoding. &lt;br /&gt;
&lt;br /&gt;
==D64 File Format ==&lt;br /&gt;
&lt;br /&gt;
The D64 format is most frequently used to capture 1541 disk images, it consists of a sector-for-sector copy of a 1540/1541 disk.  The standard D64 is a 174848 byte file comprised of 256 byte sectors arranged in 35 tracks with a varying number of  sectors  per  track for a total of 683 sectors. Track counting starts at 1, not 0, and goes  up&lt;br /&gt;
to 35. Sector counting starts at 0, not 1, for the first sector,  therefore a track with 21 sectors will go from 0 to 20.&lt;br /&gt;
&lt;br /&gt;
The original media (a 5.25&amp;quot; disk) has the tracks  laid  out  in  circles, with track 1 on the very outside of the disk  (closest  to  the  sides)  to track 35 being on the inside of the disk (closest to the inner  hub  ring). Commodore, in their infinite wisdom, varied the number of sectors per track and data densities across the disk to optimize available storage, resulting in the chart below. It shows the sectors/track for a  standard  D64.  Since the outside diameter of a circle is  the  largest  (versus  closer  to  the center), the outside tracks have the largest amount of storage.&lt;br /&gt;
&lt;br /&gt;
        Track   Sectors/track   # Sectors   Storage in Bytes&lt;br /&gt;
        -----   -------------   ---------   ----------------&lt;br /&gt;
         1-17        21            357           7820&lt;br /&gt;
        18-24        19            133           7170&lt;br /&gt;
        25-30        18            108           6300&lt;br /&gt;
        31-40(*)     17             85           6020&lt;br /&gt;
                                   ---&lt;br /&gt;
                                   683 (for a 35 track image)&lt;br /&gt;
&lt;br /&gt;
  Track #Sect #SectorsIn D64 Offset   Track #Sect #SectorsIn D64 Offset&lt;br /&gt;
  ----- ----- ---------- ----------   ----- ----- ---------- ----------&lt;br /&gt;
    1     21       0       $00000      21     19     414       $19E00&lt;br /&gt;
    2     21      21       $01500      22     19     433       $1B100&lt;br /&gt;
    3     21      42       $02A00      23     19     452       $1C400&lt;br /&gt;
    4     21      63       $03F00      24     19     471       $1D700&lt;br /&gt;
    5     21      84       $05400      25     18     490       $1EA00&lt;br /&gt;
    6     21     105       $06900      26     18     508       $1FC00&lt;br /&gt;
    7     21     126       $07E00      27     18     526       $20E00&lt;br /&gt;
    8     21     147       $09300      28     18     544       $22000&lt;br /&gt;
    9     21     168       $0A800      29     18     562       $23200&lt;br /&gt;
   10     21     189       $0BD00      30     18     580       $24400&lt;br /&gt;
   11     21     210       $0D200      31     17     598       $25600&lt;br /&gt;
   12     21     231       $0E700      32     17     615       $26700&lt;br /&gt;
   13     21     252       $0FC00      33     17     632       $27800&lt;br /&gt;
   14     21     273       $11100      34     17     649       $28900&lt;br /&gt;
   15     21     294       $12600      35     17     666       $29A00&lt;br /&gt;
   16     21     315       $13B00      36(*)  17     683       $2AB00&lt;br /&gt;
   17     21     336       $15000      37(*)  17     700       $2BC00&lt;br /&gt;
   18     19     357       $16500      38(*)  17     717       $2CD00&lt;br /&gt;
   19     19     376       $17800      39(*)  17     734       $2DE00&lt;br /&gt;
   20     19     395       $18B00      40(*)  17     751       $2EF00&lt;br /&gt;
&lt;br /&gt;
  (*)Tracks 36-40 apply to 40-track images only&lt;br /&gt;
&lt;br /&gt;
The directory track should be contained totally on track 18. Sectors 1-18&lt;br /&gt;
contain the entries and sector 0 contains the BAM (Block Availability  Map)&lt;br /&gt;
and disk name/ID. Since the directory is only 18 sectors large (19 less one&lt;br /&gt;
for the BAM), and each sector can contain only  8  entries  (32  bytes  per&lt;br /&gt;
entry), the maximum number of directory entries is 18 * 8 = 144. The  first&lt;br /&gt;
directory sector is always 18/1, even though the t/s pointer at 18/0 (first&lt;br /&gt;
two bytes) might point somewhere else.  It  then  follows  the  same  chain&lt;br /&gt;
structure as a normal file, using a sector interleave of 3. This makes  the&lt;br /&gt;
chain links go 18/1, 18/4, 18/7 etc.&lt;br /&gt;
&lt;br /&gt;
Note that you can extend the directory off  of  track  18,  but  only  when&lt;br /&gt;
reading the disk or image. Attempting to write to a directory sector not on&lt;br /&gt;
track 18 will cause directory corruption.&lt;br /&gt;
&lt;br /&gt;
Each directory sector has the following layout (18/1 partial dump):&lt;br /&gt;
&lt;br /&gt;
    00: 12 04 81 11 00 4E 41 4D 45 53 20 26 20 50 4F 53 &amp;lt;- notice the T/S link&lt;br /&gt;
    10: 49 54 A0 A0 A0 00 00 00 00 00 00 00 00 00 15 00 &amp;lt;- to 18/4 ($12/$04)&lt;br /&gt;
    20: 00 00 84 11 02 41 44 44 49 54 49 4F 4E 41 4C 20 &amp;lt;- and how its not here&lt;br /&gt;
    30: 49 4E 46 4F A0 11 0C FE 00 00 00 00 00 00 61 01 &amp;lt;- ($00/$00)&lt;br /&gt;
&lt;br /&gt;
The first two bytes of the sector ($12/$04) indicate the location of  the&lt;br /&gt;
next track/sector of the directory (18/4). If the track is set to $00, then&lt;br /&gt;
it is the last sector of the directory. It is possible,  however  unlikely,&lt;br /&gt;
that the directory may *not* be competely on track 18 (some disks do  exist&lt;br /&gt;
like this). Just follow the chain anyhow.&lt;br /&gt;
&lt;br /&gt;
When the directory is done, the track value will be $00. The sector  link&lt;br /&gt;
should contain a value of $FF, meaning the whole sector is  allocated,  but&lt;br /&gt;
the actual value doesn't matter. The drive will return  all  the  available&lt;br /&gt;
entries anyways. This is a breakdown of a  standard  directory  sector  and&lt;br /&gt;
entry:&lt;br /&gt;
&lt;br /&gt;
  Bytes: $00-1F: First directory entry&lt;br /&gt;
          00-01: Track/Sector location of next directory sector ($00 $00 if&lt;br /&gt;
                 not the first entry in the sector)&lt;br /&gt;
             02: File type.&lt;br /&gt;
                 Typical values for this location are:&lt;br /&gt;
                   $00 - Scratched (deleted file entry)&lt;br /&gt;
                    80 - DEL&lt;br /&gt;
                    81 - SEQ&lt;br /&gt;
                    82 - PRG&lt;br /&gt;
                    83 - USR&lt;br /&gt;
                    84 - REL&lt;br /&gt;
                 Bit 0-3: The actual filetype&lt;br /&gt;
                          000 (0) - DEL&lt;br /&gt;
                          001 (1) - SEQ&lt;br /&gt;
                          010 (2) - PRG&lt;br /&gt;
                          011 (3) - USR&lt;br /&gt;
                          100 (4) - REL&lt;br /&gt;
                          Values 5-15 are illegal, but if used will produce&lt;br /&gt;
                          very strange results. The 1541 is inconsistent in&lt;br /&gt;
                          how it treats these bits. Some routines use all 4&lt;br /&gt;
                          bits, others ignore bit 3,  resulting  in  values&lt;br /&gt;
                          from 0-7.&lt;br /&gt;
                 Bit   4: Not used&lt;br /&gt;
                 Bit   5: Used only during SAVE-@ replacement&lt;br /&gt;
                 Bit   6: Locked flag (Set produces &amp;quot;&amp;gt;&amp;quot; locked files)&lt;br /&gt;
                 Bit   7: Closed flag  (Not  set  produces  &amp;quot;*&amp;quot;, or &amp;quot;splat&amp;quot;&lt;br /&gt;
                          files)&lt;br /&gt;
          03-04: Track/sector location of first sector of file&lt;br /&gt;
          05-14: 16 character filename (in PETASCII, padded with $A0)&lt;br /&gt;
          15-16: Track/Sector location of first side-sector block (REL file&lt;br /&gt;
                 only)&lt;br /&gt;
             17: REL file record length (REL file only, max. value 254)&lt;br /&gt;
          18-1D: Unused (except with GEOS disks)&lt;br /&gt;
          1E-1F: File size in sectors, low/high byte  order  ($1E+$1F*256).&lt;br /&gt;
                 The approx. filesize in bytes is &amp;lt;= #sectors * 254&lt;br /&gt;
          20-3F: Second dir entry. From now on the first two bytes of  each&lt;br /&gt;
                 entry in this sector  should  be  $00  $00,  as  they  are&lt;br /&gt;
                 unused.&lt;br /&gt;
          40-5F: Third dir entry&lt;br /&gt;
          60-7F: Fourth dir entry&lt;br /&gt;
          80-9F: Fifth dir entry&lt;br /&gt;
          A0-BF: Sixth dir entry&lt;br /&gt;
          C0-DF: Seventh dir entry&lt;br /&gt;
          E0-FF: Eighth dir entry&lt;br /&gt;
&lt;br /&gt;
Files, on a standard 1541, are stored using an interleave of 10. Assuming a&lt;br /&gt;
starting track/sector of 17/0, the chain  would  run  17/0,  17/10,  17/20,&lt;br /&gt;
17/8, 17/18, etc.&lt;br /&gt;
&lt;br /&gt;
Note: No GEOS entries are listed in the above description. See [[GEOS]] for GEOS info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The layout of the BAM area (sector 18/0) is a bit more complicated...&lt;br /&gt;
&lt;br /&gt;
      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F&lt;br /&gt;
      -----------------------------------------------&lt;br /&gt;
  00: 12 01 41 00 12 FF F9 17 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  10: 15 FF FF 1F 12 FF F9 17 00 00 00 00 00 00 00 00&lt;br /&gt;
  20: 00 00 00 00 0E FF 74 03 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  30: 0E 3F FC 11 07 E1 80 01 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  40: 15 FF FF 1F 15 FF FF 1F 0D C0 FF 07 13 FF FF 07&lt;br /&gt;
  50: 13 FF FF 07 11 FF CF 07 13 FF FF 07 12 7F FF 07&lt;br /&gt;
  60: 13 FF FF 07 0A 75 55 01 00 00 00 00 00 00 00 00&lt;br /&gt;
  70: 00 00 00 00 00 00 00 00 01 08 00 00 03 02 48 00&lt;br /&gt;
  80: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01&lt;br /&gt;
  90: 53 48 41 52 45 57 41 52 45 20 31 20 20 A0 A0 A0&lt;br /&gt;
  A0: A0 A0 56 54 A0 32 41 A0 A0 A0 A0 00 00 00 00 00&lt;br /&gt;
  B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
&lt;br /&gt;
  Bytes:$00-01: Track/Sector location of the first directory sector (should&lt;br /&gt;
                be set to 18/1 but it doesn't matter, and don't trust  what&lt;br /&gt;
                is there, always go to 18/1 for first directory entry)&lt;br /&gt;
            02: Disk DOS version type (see note below)&lt;br /&gt;
                  $41 (&amp;quot;A&amp;quot;)&lt;br /&gt;
            03: Unused&lt;br /&gt;
         04-8F: BAM entries for each track, in groups  of  four  bytes  per&lt;br /&gt;
                track, starting on track 1 (see below for more details)&lt;br /&gt;
         90-9F: Disk Name (padded with $A0)&lt;br /&gt;
         A0-A1: Filled with $A0&lt;br /&gt;
         A2-A3: Disk ID&lt;br /&gt;
            A4: Usually $A0&lt;br /&gt;
         A5-A6: DOS type, usually &amp;quot;2A&amp;quot;&lt;br /&gt;
         A7-AA: Filled with $A0&lt;br /&gt;
         AB-FF: Normally unused ($00), except for 40 track extended format,&lt;br /&gt;
                see the following two entries:&lt;br /&gt;
         AC-BF: DOLPHIN DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
         C0-D3: SPEED DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
&lt;br /&gt;
Note: The BAM entries for SPEED, DOLPHIN and  ProLogic  DOS  use  the  same layout as standard BAM entries.&lt;br /&gt;
&lt;br /&gt;
One of the interesting things from the BAM sector is the byte  at  offset&lt;br /&gt;
$02, the DOS version byte. If it is set to anything other than $41 or  $00,&lt;br /&gt;
then we have what is called &amp;quot;soft write protection&amp;quot;. Any attempt  to  write&lt;br /&gt;
to the disk will return the &amp;quot;DOS Version&amp;quot; error code 73  ,&amp;quot;CBM  DOS  V  2.6&lt;br /&gt;
1541&amp;quot;. The 1541 is simply telling  you  that  it  thinks  the  disk  format&lt;br /&gt;
version is incorrect. This message will normally come  up  when  you  first&lt;br /&gt;
turn on the 1541 and read the error channel. If you write a $00  or  a  $41&lt;br /&gt;
into 1541 memory location $00FF (for device 0),  then  you  can  circumvent&lt;br /&gt;
this type of write-protection, and change the DOS version back to  what  it&lt;br /&gt;
should be.&lt;br /&gt;
&lt;br /&gt;
The BAM entries require a bit (no pun intended) more of a breakdown. Take&lt;br /&gt;
the first entry at bytes $04-$07 ($12 $FF $F9 $17). The first byte ($12) is&lt;br /&gt;
the number of free sectors on that track. Since we are looking at the track&lt;br /&gt;
1 entry, this means it has 18 (decimal) free sectors. The next three  bytes&lt;br /&gt;
represent the bitmap of which sectors are used/free. Since it is 3 bytes (8&lt;br /&gt;
bits/byte) we have 24 bits of storage. Remember that at  most,  each  track&lt;br /&gt;
only has 21 sectors, so there are a few unused bits.&lt;br /&gt;
&lt;br /&gt;
   Bytes: 04-07: 12 FF F9 17   Track 1 BAM&lt;br /&gt;
          08-0B: 15 FF FF FF   Track 2 BAM&lt;br /&gt;
          0C-0F: 15 FF FF 1F   Track 3 BAM&lt;br /&gt;
          ...&lt;br /&gt;
          8C-8F: 11 FF FF 01   Track 35 BAM&lt;br /&gt;
&lt;br /&gt;
These entries must be viewed in binary to make any sense. We will use the&lt;br /&gt;
first entry (track 1) at bytes 04-07:&lt;br /&gt;
&lt;br /&gt;
     FF=11111111, F9=11111001, 17=00010111&lt;br /&gt;
&lt;br /&gt;
In order to make any sense from the binary notation, flip the bits around.&lt;br /&gt;
&lt;br /&gt;
                   111111 11112222&lt;br /&gt;
        01234567 89012345 67890123&lt;br /&gt;
        --------------------------&lt;br /&gt;
        11111111 10011111 11101000&lt;br /&gt;
        ^                     ^&lt;br /&gt;
    sector 0              sector 20&lt;br /&gt;
&lt;br /&gt;
Since we are on the first track, we have 21 sectors, and only use  up  to&lt;br /&gt;
the bit 20 position. If a bit is on (1), the  sector  is  free.  Therefore,&lt;br /&gt;
track 1 has sectors 9,10 and 19 used, all the rest are free.  Any  leftover&lt;br /&gt;
bits that refer to sectors that don't exist, like bits 21-23 in  the  above&lt;br /&gt;
example, are set to allocated.&lt;br /&gt;
&lt;br /&gt;
Each filetype has its own unique properties, but most follow  one  simple&lt;br /&gt;
structure. The first file sector is pointed to by the directory and follows&lt;br /&gt;
a t/s chain, until the track value reaches  $00.  When  this  happens,  the&lt;br /&gt;
value in the sector link location indicates how much of the sector is used.&lt;br /&gt;
For example, the following chain indicates a file 6 sectors long, and  ends&lt;br /&gt;
when we encounter the $00/$34 chain. At this point the last sector occupies&lt;br /&gt;
from bytes $02-$34.&lt;br /&gt;
&lt;br /&gt;
    1       2       3       4       5       6&lt;br /&gt;
  ----    -----   -----   -----   -----   -----&lt;br /&gt;
  17/0    17/10   17/20   17/1    17/11    0/52&lt;br /&gt;
 (11/00) (11/0A) (11/14) (11/01) (11/0B)  (0/34)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Variations on the D64 layout ==&lt;br /&gt;
&lt;br /&gt;
     &lt;br /&gt;
These are some variations of the D64 layout:&lt;br /&gt;
&lt;br /&gt;
1. Standard 35 track layout but with 683 error bytes added on to the  end&lt;br /&gt;
of the file. Each byte of the  error  info  corresponds  to  a  single&lt;br /&gt;
sector stored in the D64, indicating if the  sector  on  the  original&lt;br /&gt;
disk contained an error. The first byte is for track 1/0, and the last&lt;br /&gt;
byte is for track 35/16.&lt;br /&gt;
&lt;br /&gt;
2. A 40 track layout, following the same layout as a 35 track  disk,  but &lt;br /&gt;
with 5 extra tracks. These contain 17 sectors each, like tracks 31-35.&lt;br /&gt;
Some of the PC utilities do allow you to create and  work  with  these&lt;br /&gt;
files. This can also have error bytes attached like variant #1.&lt;br /&gt;
&lt;br /&gt;
3. The Commodore 128 allowed for &amp;quot;auto-boot&amp;quot; disks. With  this,  t/s  1/0&lt;br /&gt;
holds a specific byte sequence which the computer recognizes  as  boot&lt;br /&gt;
code. See the document C128BOOT.TXT for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a small chart detailing the standard file sizes of  D64  images,&lt;br /&gt;
35 or 40 tracks, with or without error bytes.&lt;br /&gt;
&lt;br /&gt;
     Disk type                  Size&lt;br /&gt;
     ---------                  ------&lt;br /&gt;
     35 track, no errors        174848&lt;br /&gt;
     35 track, 683 error bytes  175531&lt;br /&gt;
     40 track, no errors        196608&lt;br /&gt;
     40 track, 768 error bytes  197376&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table (provided by Wolfgang Moser) outlines the differences&lt;br /&gt;
between the standard 1541 DOS and the various &amp;quot;speeder&amp;quot; DOS's  that  exist.&lt;br /&gt;
The 'header 7/8' category is the 'fill bytes' as  the  end  of  the  sector&lt;br /&gt;
header of  a  real  1541  disk  See  [[G64]]  for  a  better&lt;br /&gt;
explanation of these bytes.&lt;br /&gt;
&lt;br /&gt;
        Disk format             |Tracks|Header 7/8|Dos type|DiskDos&lt;br /&gt;
                                |      |allsechdrs|        |vs.type&lt;br /&gt;
       ============================================================&lt;br /&gt;
        Original CBM DOS v2.6   |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        SpeedDOS+               |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfessionalDOS Initial |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
          (Version 1/Prototype) |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfDOS Release         |  40  | $0f  $0f |  &amp;quot;4A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  40  | $0d  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        PrologicDOS 1541        |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        PrologicDOS 1541        |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
        ProSpeed 1571 2.0       |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        ProSpeed 1571 2.0       |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The location of the extra BAM information in sector 18/0,  for  40  track&lt;br /&gt;
images, will be different depending on what standard the  disks  have  been&lt;br /&gt;
formatted with. SPEED DOS stores them from $C0 to $D3, DOLPHIN  DOS  stores&lt;br /&gt;
them from $AC to $BF and PrologicDOS stored them right after  the  existing&lt;br /&gt;
BAM entries from $90-A3. PrologicDOS also  moves  the  disk  label  and  ID&lt;br /&gt;
forward from the standard location of $90 to $A4. 64COPY and Star Commander&lt;br /&gt;
let you select from several different types of extended  disk  formats  you&lt;br /&gt;
want to create/work with.&lt;br /&gt;
&lt;br /&gt;
All three of the speeder DOS's mentioned above don't alter  the  standard&lt;br /&gt;
sector interleave of 10 for files and 3 for directories. The reason is that&lt;br /&gt;
they use a memory cache installed in the drive which reads the entire track&lt;br /&gt;
in one pass. This alleviates the need for custom interleave values. They do&lt;br /&gt;
seem to alter the algorithm that finds the next available  free  sector  so&lt;br /&gt;
that the interleave value can deviate from 10 under certain  circumstances,&lt;br /&gt;
but I don't know why they would bother.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Speed DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $C0-D3.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 00 00 00 00  ??00?2A?????????&lt;br /&gt;
  00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00C0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00D0: 11 FF FF 01 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Dolphin DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $AC-BF.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 11 FF FF 01  ??00?2A?????????&lt;br /&gt;
  00B0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ???????????????? &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a PrologicDOS BAM sector. Note that the disk  name&lt;br /&gt;
and ID are now located at $A4 instead of starting at $90.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00A0: 11 FF FF 01 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00B0: A0 A0 A0 A0 A0 A0 30 30 A0 32 50 A0 A0 A0 A0 00  ??????00?2P?????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00ED: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the meaning of the error bytes added onto the end of any extended&lt;br /&gt;
D64. The CODE is the same as that generated by the 1541 drive controller...&lt;br /&gt;
it reports these numbers, not the error code we usually see when  an  error&lt;br /&gt;
occurs.&lt;br /&gt;
&lt;br /&gt;
Some of what comes  below  is  taken  from  Immers/Neufeld  book  &amp;quot;Inside&lt;br /&gt;
Commodore DOS&amp;quot;. Note the descriptions are not  completely  accurate  as  to&lt;br /&gt;
what the drive DOS is actually doing to seek/read/decode/write sectors, but&lt;br /&gt;
serve as simple examples only. The &amp;quot;type&amp;quot; field is where the error  usually&lt;br /&gt;
occurs, whether it's searching for any SYNC mark, any header ID, any  valid&lt;br /&gt;
header, or reading a sector.&lt;br /&gt;
&lt;br /&gt;
These first errors are &amp;quot;seek&amp;quot; errors, where the disk controller is simply&lt;br /&gt;
reading headers and looking at descriptor bytes, checksums, format ID's and&lt;br /&gt;
reporting what errors it sees. These errors do *not* necessarily  apply  to&lt;br /&gt;
the exact sector being looked for. This fact  makes  duplication  of  these&lt;br /&gt;
errors very unreliable.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     03    21    Seek   No SYNC sequence found.&lt;br /&gt;
                        Each  sector  data  block  and  header  block   are&lt;br /&gt;
                        preceeded by SYNC marks. If *no* sync  sequence  is&lt;br /&gt;
                        found within 20 milliseconds (only ~1/10 of a  disk&lt;br /&gt;
                        rotation!) then this error is generated. This error&lt;br /&gt;
                        used to mean the entire track is bad, but  it  does&lt;br /&gt;
                        not have to be the case. Only a small area  of  the&lt;br /&gt;
                        track needs to be without  a  SYNC  mark  and  this&lt;br /&gt;
                        error will be generated.&lt;br /&gt;
                        Converting this error to a D64 is very  problematic&lt;br /&gt;
                        because it depends on where the physical head is on&lt;br /&gt;
                        the disk when a read attempt is made. If it  is  on&lt;br /&gt;
                        valid header/sectors then it  won't  occur.  If  it&lt;br /&gt;
                        happens over an area without SYNC  marks,  it  will&lt;br /&gt;
                        happen.&lt;br /&gt;
     02    20    Seek   Header descriptor byte not found (HEX $08, GCR $52)&lt;br /&gt;
                        Each sector is preceeded by an  8-byte  GCR  header&lt;br /&gt;
                        block, which starts with the value  $52  (GCR).  If&lt;br /&gt;
                        this value is not found  after  90  attempts,  this&lt;br /&gt;
                        error is generated.&lt;br /&gt;
                        Basically, what a track  has  is  SYNC  marks,  and&lt;br /&gt;
                        possibly valid data blocks,  but  no  valid  header&lt;br /&gt;
                        descriptors.&lt;br /&gt;
     09    27    Seek   Checksum error in header block&lt;br /&gt;
                        The  header  block  contains  a   checksum   value,&lt;br /&gt;
                        calculated by XOR'ing the TRACK,  SECTOR,  ID1  and&lt;br /&gt;
                        ID2 values. If this checksum is wrong,  this  error&lt;br /&gt;
                        is generated.&lt;br /&gt;
     0B    29    Seek   Disk sector ID mismatch&lt;br /&gt;
                        The ID's from the header  block  of  the  currently&lt;br /&gt;
                        read sector are compared against the ones from  the&lt;br /&gt;
                        low-level header of 18/0. If there is  a  mismatch,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
     02    20    Seek   Header block not found&lt;br /&gt;
                        This error can be reported again when searching for&lt;br /&gt;
                        the correct header block. An image of the header is&lt;br /&gt;
                        built and searched for, but not found after 90 read&lt;br /&gt;
                        attempts.  Note  the  difference  from  the   first&lt;br /&gt;
                        occurance. The first one only searches for a  valid&lt;br /&gt;
                        ID, not the whole header.&lt;br /&gt;
&lt;br /&gt;
Note that error 20 occurs twice during this phase. The first time is when&lt;br /&gt;
a header ID is being searched for, the second is  when  the  proper  header&lt;br /&gt;
pattern for the sector being searched for is not found.&lt;br /&gt;
&lt;br /&gt;
From this point on, all the errors apply to the specific sector  you  are&lt;br /&gt;
looking for. If a read passed all the previous checks, then we are  at  the&lt;br /&gt;
sector being searched for.&lt;br /&gt;
&lt;br /&gt;
Note that the entire sector is read before  these  errors  are  detected.&lt;br /&gt;
Therefore the data, checksum and off bytes are available.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     04    22    Read   Data descriptor byte not found (HEX $07, GCR $55)&lt;br /&gt;
                        Each sector data block is preceeded  by  the  value&lt;br /&gt;
                        $07, the &amp;quot;data block&amp;quot; descriptor. If this value  is&lt;br /&gt;
                        not there, this error is  generated.  Each  encoded&lt;br /&gt;
                        sector  has  actually  260  bytes.  First  is   the&lt;br /&gt;
                        descriptor byte, then  follows  the  256  bytes  of&lt;br /&gt;
                        data, a checksum, and two &amp;quot;off&amp;quot; bytes.&lt;br /&gt;
     05    23    Read   Checksum error in data block&lt;br /&gt;
                        The checksum of  the  data  read  of  the  disk  is&lt;br /&gt;
                        calculated, and compared against the one stored  at&lt;br /&gt;
                        the end of the sector. If  there's  a  discrepancy,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
     0F    74    Read   Drive Not Ready (no disk in drive or no device 1)&lt;br /&gt;
&lt;br /&gt;
These errors only  apply  when  writing  to  a  disk.  I  don't  see  the&lt;br /&gt;
usefulness of having these as they cannot be present when only *reading*  a&lt;br /&gt;
disk.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     06    24    Write  Write verify (on format)&lt;br /&gt;
     07    25    Write  Write verify error&lt;br /&gt;
                        Once the GCR-encoded sector  is  written  out,  the&lt;br /&gt;
                        drive waits for the sector to come around again and&lt;br /&gt;
                        verifies the whole 325-byte GCR block.  Any  errors&lt;br /&gt;
                        encountered will generate this error.&lt;br /&gt;
     08    26    Write  Write protect on&lt;br /&gt;
                        Self explanatory. Remove the write-protect tab, and&lt;br /&gt;
                        try again.&lt;br /&gt;
     0A    28    Write  Write error&lt;br /&gt;
                        In actual fact, this error never occurs, but it  is&lt;br /&gt;
                        included for completeness.&lt;br /&gt;
&lt;br /&gt;
This is not an error at all, but when gets reported when the  read  of  a&lt;br /&gt;
sector is ok.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     01    00    N/A    No error.&lt;br /&gt;
                        Self explanatory. No errors were  detected  in  the&lt;br /&gt;
                        reading and decoding of the sector.&lt;br /&gt;
&lt;br /&gt;
The advantage with using the 35 track D64  format,  regardless  of  error&lt;br /&gt;
bytes, is that it can be converted directly back to a 1541 disk  by  either&lt;br /&gt;
using the proper cable and software on the PC, or send it down to  the  C64&lt;br /&gt;
and writing it back to a 1541. It is the best documented format since it is&lt;br /&gt;
also native to the C64, with many books explaining the disk layout and  the&lt;br /&gt;
internals of the 1541.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What it takes to support D64 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The D64 layout is reasonably robust,  being  that  it  is  an  electronic&lt;br /&gt;
representation of a physical 1541  disk.  It  shares  *most*  of  the  1541&lt;br /&gt;
attributes and it supports all file formats, since all C64 files came  from&lt;br /&gt;
here. The only file I have found that can't be copied to a D64 is a T64 FRZ&lt;br /&gt;
(FRoZen files), since you lose the extra file type attribute.&lt;br /&gt;
&lt;br /&gt;
Since the D64 layout seems to be an exact byte copy of a 1541 floppy,  it&lt;br /&gt;
would appear to be the perfect format for *any* emulator. However, it  does&lt;br /&gt;
not contain certain vital bits of information that, as a user, you normally&lt;br /&gt;
don't have access to.&lt;br /&gt;
&lt;br /&gt;
Preceeding each sector on a real  1541  disk  is  a  header  block  which&lt;br /&gt;
contains the sector ID bytes and checksum. From the  information  contained&lt;br /&gt;
in the header, the drive determines if there's  an  error  on  that  header&lt;br /&gt;
(27-checksum error, 29-disk ID mismatch). The sector itself  also  contains&lt;br /&gt;
info (data block signature, checksum) that result in  error  detection  (23&lt;br /&gt;
checksum, 22 data block not present, etc). The error bytes had to be  added&lt;br /&gt;
on to the D64 image, &amp;quot;extending&amp;quot;  the  format  to  take  into  account  the&lt;br /&gt;
missing info.&lt;br /&gt;
&lt;br /&gt;
The disk ID is important in the copy protection of  some  programs.  Some&lt;br /&gt;
programs fail to work properly since the D64 doesn't  contain  these  ID's.&lt;br /&gt;
These bytes would be an addition to the format which has  never  been  done&lt;br /&gt;
and would be difficult to do. (As an aside, the  4-pack  ZipCode  files  do&lt;br /&gt;
contain the original master disk ID, but these are lost in  the  conversion&lt;br /&gt;
of a ZipCode to a D64. Only storing *one* of the ID's is  not  enough,  all&lt;br /&gt;
the sector ID's should be kept.)&lt;br /&gt;
&lt;br /&gt;
The extended track 1541 disks also presented  a  problem,  as  there  are&lt;br /&gt;
several different formats (and how/where to store the extra BAM entries  in&lt;br /&gt;
a sector that was not designed for  them,  yet  still  remain  compatible).&lt;br /&gt;
Because of the additions to the format (error bytes and  40  tracks)  there&lt;br /&gt;
exists 4 different types of D64's, all recognizeable by their size.&lt;br /&gt;
&lt;br /&gt;
It is also the only format that uses the sector count for the  file  size&lt;br /&gt;
rather than  actual  bytes  used.  This  can  present  some  problems  when&lt;br /&gt;
converting/copying the to another format because you may have to  know  the&lt;br /&gt;
size before you begin (see LBR format).&lt;br /&gt;
&lt;br /&gt;
It also contains no consistent signature, useful for recognizing  if  D64&lt;br /&gt;
is really what it claims to be. In order to determine if a file is  a  D64,&lt;br /&gt;
you must check the file size.&lt;br /&gt;
&lt;br /&gt;
(Content taken from [http://unusedino.de/ec64/technical/formats/d64.html D64.TXT] in Peter Scheper's excellent compendium of C64 file format information).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Commodore computers]]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/CBMFS</id>
		<title>CBMFS</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/CBMFS"/>
				<updated>2013-05-20T21:12:10Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: format corrections &amp;amp; attribution&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FormatInfo&lt;br /&gt;
|formattype=electronic&lt;br /&gt;
|subcat=Filesystem&lt;br /&gt;
}}&lt;br /&gt;
The CBM File System was used by disk drives made by Commodore Business Machines for the  PET, VIC-20, C64 and C128 range of computers. These drives were called 'intelligent peripherals' meaning the DOS (Disk Operating System) was runs in the drive itself, not on the computer the drive was attached to.&lt;br /&gt;
&lt;br /&gt;
The most popular CBM drive was the 1541, which supported 35 tracks using GCR encoding. The D64 format is most frequently used to capture 1541 disk images, it consists of a sector-for-sector copy of a 1540/1541 disk.  The standard D64 is a 174848 byte file comprised of 256 byte sectors arranged in 35 tracks with a varying number of  sectors  per  track for a total of 683 sectors. Track counting starts at 1, not 0, and goes  up&lt;br /&gt;
to 35. Sector counting starts at 0, not 1, for the first sector,  therefore a track with 21 sectors will go from 0 to 20.&lt;br /&gt;
&lt;br /&gt;
The original media (a 5.25&amp;quot; disk) has the tracks  laid  out  in  circles, with track 1 on the very outside of the disk  (closest  to  the  sides)  to track 35 being on the inside of the disk (closest to the inner  hub  ring). Commodore, in their infinite wisdom, varied the number of sectors per track and data densities across the disk to optimize available storage, resulting in the chart below. It shows the sectors/track for a  standard  D64.  Since the outside diameter of a circle is  the  largest  (versus  closer  to  the center), the outside tracks have the largest amount of storage.&lt;br /&gt;
&lt;br /&gt;
        Track   Sectors/track   # Sectors   Storage in Bytes&lt;br /&gt;
        -----   -------------   ---------   ----------------&lt;br /&gt;
         1-17        21            357           7820&lt;br /&gt;
        18-24        19            133           7170&lt;br /&gt;
        25-30        18            108           6300&lt;br /&gt;
        31-40(*)     17             85           6020&lt;br /&gt;
                                   ---&lt;br /&gt;
                                   683 (for a 35 track image)&lt;br /&gt;
&lt;br /&gt;
  Track #Sect #SectorsIn D64 Offset   Track #Sect #SectorsIn D64 Offset&lt;br /&gt;
  ----- ----- ---------- ----------   ----- ----- ---------- ----------&lt;br /&gt;
    1     21       0       $00000      21     19     414       $19E00&lt;br /&gt;
    2     21      21       $01500      22     19     433       $1B100&lt;br /&gt;
    3     21      42       $02A00      23     19     452       $1C400&lt;br /&gt;
    4     21      63       $03F00      24     19     471       $1D700&lt;br /&gt;
    5     21      84       $05400      25     18     490       $1EA00&lt;br /&gt;
    6     21     105       $06900      26     18     508       $1FC00&lt;br /&gt;
    7     21     126       $07E00      27     18     526       $20E00&lt;br /&gt;
    8     21     147       $09300      28     18     544       $22000&lt;br /&gt;
    9     21     168       $0A800      29     18     562       $23200&lt;br /&gt;
   10     21     189       $0BD00      30     18     580       $24400&lt;br /&gt;
   11     21     210       $0D200      31     17     598       $25600&lt;br /&gt;
   12     21     231       $0E700      32     17     615       $26700&lt;br /&gt;
   13     21     252       $0FC00      33     17     632       $27800&lt;br /&gt;
   14     21     273       $11100      34     17     649       $28900&lt;br /&gt;
   15     21     294       $12600      35     17     666       $29A00&lt;br /&gt;
   16     21     315       $13B00      36(*)  17     683       $2AB00&lt;br /&gt;
   17     21     336       $15000      37(*)  17     700       $2BC00&lt;br /&gt;
   18     19     357       $16500      38(*)  17     717       $2CD00&lt;br /&gt;
   19     19     376       $17800      39(*)  17     734       $2DE00&lt;br /&gt;
   20     19     395       $18B00      40(*)  17     751       $2EF00&lt;br /&gt;
&lt;br /&gt;
  (*)Tracks 36-40 apply to 40-track images only&lt;br /&gt;
&lt;br /&gt;
The directory track should be contained totally on track 18. Sectors 1-18&lt;br /&gt;
contain the entries and sector 0 contains the BAM (Block Availability  Map)&lt;br /&gt;
and disk name/ID. Since the directory is only 18 sectors large (19 less one&lt;br /&gt;
for the BAM), and each sector can contain only  8  entries  (32  bytes  per&lt;br /&gt;
entry), the maximum number of directory entries is 18 * 8 = 144. The  first&lt;br /&gt;
directory sector is always 18/1, even though the t/s pointer at 18/0 (first&lt;br /&gt;
two bytes) might point somewhere else.  It  then  follows  the  same  chain&lt;br /&gt;
structure as a normal file, using a sector interleave of 3. This makes  the&lt;br /&gt;
chain links go 18/1, 18/4, 18/7 etc.&lt;br /&gt;
&lt;br /&gt;
Note that you can extend the directory off  of  track  18,  but  only  when&lt;br /&gt;
reading the disk or image. Attempting to write to a directory sector not on&lt;br /&gt;
track 18 will cause directory corruption.&lt;br /&gt;
&lt;br /&gt;
Each directory sector has the following layout (18/1 partial dump):&lt;br /&gt;
&lt;br /&gt;
    00: 12 04 81 11 00 4E 41 4D 45 53 20 26 20 50 4F 53 &amp;lt;- notice the T/S link&lt;br /&gt;
    10: 49 54 A0 A0 A0 00 00 00 00 00 00 00 00 00 15 00 &amp;lt;- to 18/4 ($12/$04)&lt;br /&gt;
    20: 00 00 84 11 02 41 44 44 49 54 49 4F 4E 41 4C 20 &amp;lt;- and how its not here&lt;br /&gt;
    30: 49 4E 46 4F A0 11 0C FE 00 00 00 00 00 00 61 01 &amp;lt;- ($00/$00)&lt;br /&gt;
&lt;br /&gt;
The first two bytes of the sector ($12/$04) indicate the location of  the&lt;br /&gt;
next track/sector of the directory (18/4). If the track is set to $00, then&lt;br /&gt;
it is the last sector of the directory. It is possible,  however  unlikely,&lt;br /&gt;
that the directory may *not* be competely on track 18 (some disks do  exist&lt;br /&gt;
like this). Just follow the chain anyhow.&lt;br /&gt;
&lt;br /&gt;
When the directory is done, the track value will be $00. The sector  link&lt;br /&gt;
should contain a value of $FF, meaning the whole sector is  allocated,  but&lt;br /&gt;
the actual value doesn't matter. The drive will return  all  the  available&lt;br /&gt;
entries anyways. This is a breakdown of a  standard  directory  sector  and&lt;br /&gt;
entry:&lt;br /&gt;
&lt;br /&gt;
  Bytes: $00-1F: First directory entry&lt;br /&gt;
          00-01: Track/Sector location of next directory sector ($00 $00 if&lt;br /&gt;
                 not the first entry in the sector)&lt;br /&gt;
             02: File type.&lt;br /&gt;
                 Typical values for this location are:&lt;br /&gt;
                   $00 - Scratched (deleted file entry)&lt;br /&gt;
                    80 - DEL&lt;br /&gt;
                    81 - SEQ&lt;br /&gt;
                    82 - PRG&lt;br /&gt;
                    83 - USR&lt;br /&gt;
                    84 - REL&lt;br /&gt;
                 Bit 0-3: The actual filetype&lt;br /&gt;
                          000 (0) - DEL&lt;br /&gt;
                          001 (1) - SEQ&lt;br /&gt;
                          010 (2) - PRG&lt;br /&gt;
                          011 (3) - USR&lt;br /&gt;
                          100 (4) - REL&lt;br /&gt;
                          Values 5-15 are illegal, but if used will produce&lt;br /&gt;
                          very strange results. The 1541 is inconsistent in&lt;br /&gt;
                          how it treats these bits. Some routines use all 4&lt;br /&gt;
                          bits, others ignore bit 3,  resulting  in  values&lt;br /&gt;
                          from 0-7.&lt;br /&gt;
                 Bit   4: Not used&lt;br /&gt;
                 Bit   5: Used only during SAVE-@ replacement&lt;br /&gt;
                 Bit   6: Locked flag (Set produces &amp;quot;&amp;gt;&amp;quot; locked files)&lt;br /&gt;
                 Bit   7: Closed flag  (Not  set  produces  &amp;quot;*&amp;quot;, or &amp;quot;splat&amp;quot;&lt;br /&gt;
                          files)&lt;br /&gt;
          03-04: Track/sector location of first sector of file&lt;br /&gt;
          05-14: 16 character filename (in PETASCII, padded with $A0)&lt;br /&gt;
          15-16: Track/Sector location of first side-sector block (REL file&lt;br /&gt;
                 only)&lt;br /&gt;
             17: REL file record length (REL file only, max. value 254)&lt;br /&gt;
          18-1D: Unused (except with GEOS disks)&lt;br /&gt;
          1E-1F: File size in sectors, low/high byte  order  ($1E+$1F*256).&lt;br /&gt;
                 The approx. filesize in bytes is &amp;lt;= #sectors * 254&lt;br /&gt;
          20-3F: Second dir entry. From now on the first two bytes of  each&lt;br /&gt;
                 entry in this sector  should  be  $00  $00,  as  they  are&lt;br /&gt;
                 unused.&lt;br /&gt;
          40-5F: Third dir entry&lt;br /&gt;
          60-7F: Fourth dir entry&lt;br /&gt;
          80-9F: Fifth dir entry&lt;br /&gt;
          A0-BF: Sixth dir entry&lt;br /&gt;
          C0-DF: Seventh dir entry&lt;br /&gt;
          E0-FF: Eighth dir entry&lt;br /&gt;
&lt;br /&gt;
Files, on a standard 1541, are stored using an interleave of 10. Assuming a&lt;br /&gt;
starting track/sector of 17/0, the chain  would  run  17/0,  17/10,  17/20,&lt;br /&gt;
17/8, 17/18, etc.&lt;br /&gt;
&lt;br /&gt;
Note: No GEOS entries are listed in the above description. See [[GEOS]] for GEOS info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The layout of the BAM area (sector 18/0) is a bit more complicated...&lt;br /&gt;
&lt;br /&gt;
      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F&lt;br /&gt;
      -----------------------------------------------&lt;br /&gt;
  00: 12 01 41 00 12 FF F9 17 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  10: 15 FF FF 1F 12 FF F9 17 00 00 00 00 00 00 00 00&lt;br /&gt;
  20: 00 00 00 00 0E FF 74 03 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  30: 0E 3F FC 11 07 E1 80 01 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  40: 15 FF FF 1F 15 FF FF 1F 0D C0 FF 07 13 FF FF 07&lt;br /&gt;
  50: 13 FF FF 07 11 FF CF 07 13 FF FF 07 12 7F FF 07&lt;br /&gt;
  60: 13 FF FF 07 0A 75 55 01 00 00 00 00 00 00 00 00&lt;br /&gt;
  70: 00 00 00 00 00 00 00 00 01 08 00 00 03 02 48 00&lt;br /&gt;
  80: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01&lt;br /&gt;
  90: 53 48 41 52 45 57 41 52 45 20 31 20 20 A0 A0 A0&lt;br /&gt;
  A0: A0 A0 56 54 A0 32 41 A0 A0 A0 A0 00 00 00 00 00&lt;br /&gt;
  B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
&lt;br /&gt;
  Bytes:$00-01: Track/Sector location of the first directory sector (should&lt;br /&gt;
                be set to 18/1 but it doesn't matter, and don't trust  what&lt;br /&gt;
                is there, always go to 18/1 for first directory entry)&lt;br /&gt;
            02: Disk DOS version type (see note below)&lt;br /&gt;
                  $41 (&amp;quot;A&amp;quot;)&lt;br /&gt;
            03: Unused&lt;br /&gt;
         04-8F: BAM entries for each track, in groups  of  four  bytes  per&lt;br /&gt;
                track, starting on track 1 (see below for more details)&lt;br /&gt;
         90-9F: Disk Name (padded with $A0)&lt;br /&gt;
         A0-A1: Filled with $A0&lt;br /&gt;
         A2-A3: Disk ID&lt;br /&gt;
            A4: Usually $A0&lt;br /&gt;
         A5-A6: DOS type, usually &amp;quot;2A&amp;quot;&lt;br /&gt;
         A7-AA: Filled with $A0&lt;br /&gt;
         AB-FF: Normally unused ($00), except for 40 track extended format,&lt;br /&gt;
                see the following two entries:&lt;br /&gt;
         AC-BF: DOLPHIN DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
         C0-D3: SPEED DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
&lt;br /&gt;
Note: The BAM entries for SPEED, DOLPHIN and  ProLogic  DOS  use  the  same layout as standard BAM entries.&lt;br /&gt;
&lt;br /&gt;
One of the interesting things from the BAM sector is the byte  at  offset&lt;br /&gt;
$02, the DOS version byte. If it is set to anything other than $41 or  $00,&lt;br /&gt;
then we have what is called &amp;quot;soft write protection&amp;quot;. Any attempt  to  write&lt;br /&gt;
to the disk will return the &amp;quot;DOS Version&amp;quot; error code 73  ,&amp;quot;CBM  DOS  V  2.6&lt;br /&gt;
1541&amp;quot;. The 1541 is simply telling  you  that  it  thinks  the  disk  format&lt;br /&gt;
version is incorrect. This message will normally come  up  when  you  first&lt;br /&gt;
turn on the 1541 and read the error channel. If you write a $00  or  a  $41&lt;br /&gt;
into 1541 memory location $00FF (for device 0),  then  you  can  circumvent&lt;br /&gt;
this type of write-protection, and change the DOS version back to  what  it&lt;br /&gt;
should be.&lt;br /&gt;
&lt;br /&gt;
The BAM entries require a bit (no pun intended) more of a breakdown. Take&lt;br /&gt;
the first entry at bytes $04-$07 ($12 $FF $F9 $17). The first byte ($12) is&lt;br /&gt;
the number of free sectors on that track. Since we are looking at the track&lt;br /&gt;
1 entry, this means it has 18 (decimal) free sectors. The next three  bytes&lt;br /&gt;
represent the bitmap of which sectors are used/free. Since it is 3 bytes (8&lt;br /&gt;
bits/byte) we have 24 bits of storage. Remember that at  most,  each  track&lt;br /&gt;
only has 21 sectors, so there are a few unused bits.&lt;br /&gt;
&lt;br /&gt;
   Bytes: 04-07: 12 FF F9 17   Track 1 BAM&lt;br /&gt;
          08-0B: 15 FF FF FF   Track 2 BAM&lt;br /&gt;
          0C-0F: 15 FF FF 1F   Track 3 BAM&lt;br /&gt;
          ...&lt;br /&gt;
          8C-8F: 11 FF FF 01   Track 35 BAM&lt;br /&gt;
&lt;br /&gt;
These entries must be viewed in binary to make any sense. We will use the&lt;br /&gt;
first entry (track 1) at bytes 04-07:&lt;br /&gt;
&lt;br /&gt;
     FF=11111111, F9=11111001, 17=00010111&lt;br /&gt;
&lt;br /&gt;
In order to make any sense from the binary notation, flip the bits around.&lt;br /&gt;
&lt;br /&gt;
                   111111 11112222&lt;br /&gt;
        01234567 89012345 67890123&lt;br /&gt;
        --------------------------&lt;br /&gt;
        11111111 10011111 11101000&lt;br /&gt;
        ^                     ^&lt;br /&gt;
    sector 0              sector 20&lt;br /&gt;
&lt;br /&gt;
Since we are on the first track, we have 21 sectors, and only use  up  to&lt;br /&gt;
the bit 20 position. If a bit is on (1), the  sector  is  free.  Therefore,&lt;br /&gt;
track 1 has sectors 9,10 and 19 used, all the rest are free.  Any  leftover&lt;br /&gt;
bits that refer to sectors that don't exist, like bits 21-23 in  the  above&lt;br /&gt;
example, are set to allocated.&lt;br /&gt;
&lt;br /&gt;
Each filetype has its own unique properties, but most follow  one  simple&lt;br /&gt;
structure. The first file sector is pointed to by the directory and follows&lt;br /&gt;
a t/s chain, until the track value reaches  $00.  When  this  happens,  the&lt;br /&gt;
value in the sector link location indicates how much of the sector is used.&lt;br /&gt;
For example, the following chain indicates a file 6 sectors long, and  ends&lt;br /&gt;
when we encounter the $00/$34 chain. At this point the last sector occupies&lt;br /&gt;
from bytes $02-$34.&lt;br /&gt;
&lt;br /&gt;
    1       2       3       4       5       6&lt;br /&gt;
  ----    -----   -----   -----   -----   -----&lt;br /&gt;
  17/0    17/10   17/20   17/1    17/11    0/52&lt;br /&gt;
 (11/00) (11/0A) (11/14) (11/01) (11/0B)  (0/34)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Variations on the D64 layout ==&lt;br /&gt;
&lt;br /&gt;
     &lt;br /&gt;
These are some variations of the D64 layout:&lt;br /&gt;
&lt;br /&gt;
1. Standard 35 track layout but with 683 error bytes added on to the  end&lt;br /&gt;
of the file. Each byte of the  error  info  corresponds  to  a  single&lt;br /&gt;
sector stored in the D64, indicating if the  sector  on  the  original&lt;br /&gt;
disk contained an error. The first byte is for track 1/0, and the last&lt;br /&gt;
byte is for track 35/16.&lt;br /&gt;
&lt;br /&gt;
2. A 40 track layout, following the same layout as a 35 track  disk,  but &lt;br /&gt;
with 5 extra tracks. These contain 17 sectors each, like tracks 31-35.&lt;br /&gt;
Some of the PC utilities do allow you to create and  work  with  these&lt;br /&gt;
files. This can also have error bytes attached like variant #1.&lt;br /&gt;
&lt;br /&gt;
3. The Commodore 128 allowed for &amp;quot;auto-boot&amp;quot; disks. With  this,  t/s  1/0&lt;br /&gt;
holds a specific byte sequence which the computer recognizes  as  boot&lt;br /&gt;
code. See the document C128BOOT.TXT for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a small chart detailing the standard file sizes of  D64  images,&lt;br /&gt;
35 or 40 tracks, with or without error bytes.&lt;br /&gt;
&lt;br /&gt;
     Disk type                  Size&lt;br /&gt;
     ---------                  ------&lt;br /&gt;
     35 track, no errors        174848&lt;br /&gt;
     35 track, 683 error bytes  175531&lt;br /&gt;
     40 track, no errors        196608&lt;br /&gt;
     40 track, 768 error bytes  197376&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table (provided by Wolfgang Moser) outlines the differences&lt;br /&gt;
between the standard 1541 DOS and the various &amp;quot;speeder&amp;quot; DOS's  that  exist.&lt;br /&gt;
The 'header 7/8' category is the 'fill bytes' as  the  end  of  the  sector&lt;br /&gt;
header of  a  real  1541  disk  See  [[G64]]  for  a  better&lt;br /&gt;
explanation of these bytes.&lt;br /&gt;
&lt;br /&gt;
        Disk format             |Tracks|Header 7/8|Dos type|DiskDos&lt;br /&gt;
                                |      |allsechdrs|        |vs.type&lt;br /&gt;
       ============================================================&lt;br /&gt;
        Original CBM DOS v2.6   |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        SpeedDOS+               |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfessionalDOS Initial |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
          (Version 1/Prototype) |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfDOS Release         |  40  | $0f  $0f |  &amp;quot;4A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  40  | $0d  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        PrologicDOS 1541        |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        PrologicDOS 1541        |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
        ProSpeed 1571 2.0       |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        ProSpeed 1571 2.0       |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The location of the extra BAM information in sector 18/0,  for  40  track&lt;br /&gt;
images, will be different depending on what standard the  disks  have  been&lt;br /&gt;
formatted with. SPEED DOS stores them from $C0 to $D3, DOLPHIN  DOS  stores&lt;br /&gt;
them from $AC to $BF and PrologicDOS stored them right after  the  existing&lt;br /&gt;
BAM entries from $90-A3. PrologicDOS also  moves  the  disk  label  and  ID&lt;br /&gt;
forward from the standard location of $90 to $A4. 64COPY and Star Commander&lt;br /&gt;
let you select from several different types of extended  disk  formats  you&lt;br /&gt;
want to create/work with.&lt;br /&gt;
&lt;br /&gt;
All three of the speeder DOS's mentioned above don't alter  the  standard&lt;br /&gt;
sector interleave of 10 for files and 3 for directories. The reason is that&lt;br /&gt;
they use a memory cache installed in the drive which reads the entire track&lt;br /&gt;
in one pass. This alleviates the need for custom interleave values. They do&lt;br /&gt;
seem to alter the algorithm that finds the next available  free  sector  so&lt;br /&gt;
that the interleave value can deviate from 10 under certain  circumstances,&lt;br /&gt;
but I don't know why they would bother.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Speed DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $C0-D3.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 00 00 00 00  ??00?2A?????????&lt;br /&gt;
  00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00C0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00D0: 11 FF FF 01 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Dolphin DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $AC-BF.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 11 FF FF 01  ??00?2A?????????&lt;br /&gt;
  00B0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ???????????????? &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a PrologicDOS BAM sector. Note that the disk  name&lt;br /&gt;
and ID are now located at $A4 instead of starting at $90.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00A0: 11 FF FF 01 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00B0: A0 A0 A0 A0 A0 A0 30 30 A0 32 50 A0 A0 A0 A0 00  ??????00?2P?????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00ED: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the meaning of the error bytes added onto the end of any extended&lt;br /&gt;
D64. The CODE is the same as that generated by the 1541 drive controller...&lt;br /&gt;
it reports these numbers, not the error code we usually see when  an  error&lt;br /&gt;
occurs.&lt;br /&gt;
&lt;br /&gt;
Some of what comes  below  is  taken  from  Immers/Neufeld  book  &amp;quot;Inside&lt;br /&gt;
Commodore DOS&amp;quot;. Note the descriptions are not  completely  accurate  as  to&lt;br /&gt;
what the drive DOS is actually doing to seek/read/decode/write sectors, but&lt;br /&gt;
serve as simple examples only. The &amp;quot;type&amp;quot; field is where the error  usually&lt;br /&gt;
occurs, whether it's searching for any SYNC mark, any header ID, any  valid&lt;br /&gt;
header, or reading a sector.&lt;br /&gt;
&lt;br /&gt;
These first errors are &amp;quot;seek&amp;quot; errors, where the disk controller is simply&lt;br /&gt;
reading headers and looking at descriptor bytes, checksums, format ID's and&lt;br /&gt;
reporting what errors it sees. These errors do *not* necessarily  apply  to&lt;br /&gt;
the exact sector being looked for. This fact  makes  duplication  of  these&lt;br /&gt;
errors very unreliable.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     03    21    Seek   No SYNC sequence found.&lt;br /&gt;
                        Each  sector  data  block  and  header  block   are&lt;br /&gt;
                        preceeded by SYNC marks. If *no* sync  sequence  is&lt;br /&gt;
                        found within 20 milliseconds (only ~1/10 of a  disk&lt;br /&gt;
                        rotation!) then this error is generated. This error&lt;br /&gt;
                        used to mean the entire track is bad, but  it  does&lt;br /&gt;
                        not have to be the case. Only a small area  of  the&lt;br /&gt;
                        track needs to be without  a  SYNC  mark  and  this&lt;br /&gt;
                        error will be generated.&lt;br /&gt;
                        Converting this error to a D64 is very  problematic&lt;br /&gt;
                        because it depends on where the physical head is on&lt;br /&gt;
                        the disk when a read attempt is made. If it  is  on&lt;br /&gt;
                        valid header/sectors then it  won't  occur.  If  it&lt;br /&gt;
                        happens over an area without SYNC  marks,  it  will&lt;br /&gt;
                        happen.&lt;br /&gt;
     02    20    Seek   Header descriptor byte not found (HEX $08, GCR $52)&lt;br /&gt;
                        Each sector is preceeded by an  8-byte  GCR  header&lt;br /&gt;
                        block, which starts with the value  $52  (GCR).  If&lt;br /&gt;
                        this value is not found  after  90  attempts,  this&lt;br /&gt;
                        error is generated.&lt;br /&gt;
                        Basically, what a track  has  is  SYNC  marks,  and&lt;br /&gt;
                        possibly valid data blocks,  but  no  valid  header&lt;br /&gt;
                        descriptors.&lt;br /&gt;
     09    27    Seek   Checksum error in header block&lt;br /&gt;
                        The  header  block  contains  a   checksum   value,&lt;br /&gt;
                        calculated by XOR'ing the TRACK,  SECTOR,  ID1  and&lt;br /&gt;
                        ID2 values. If this checksum is wrong,  this  error&lt;br /&gt;
                        is generated.&lt;br /&gt;
     0B    29    Seek   Disk sector ID mismatch&lt;br /&gt;
                        The ID's from the header  block  of  the  currently&lt;br /&gt;
                        read sector are compared against the ones from  the&lt;br /&gt;
                        low-level header of 18/0. If there is  a  mismatch,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
     02    20    Seek   Header block not found&lt;br /&gt;
                        This error can be reported again when searching for&lt;br /&gt;
                        the correct header block. An image of the header is&lt;br /&gt;
                        built and searched for, but not found after 90 read&lt;br /&gt;
                        attempts.  Note  the  difference  from  the   first&lt;br /&gt;
                        occurance. The first one only searches for a  valid&lt;br /&gt;
                        ID, not the whole header.&lt;br /&gt;
&lt;br /&gt;
Note that error 20 occurs twice during this phase. The first time is when&lt;br /&gt;
a header ID is being searched for, the second is  when  the  proper  header&lt;br /&gt;
pattern for the sector being searched for is not found.&lt;br /&gt;
&lt;br /&gt;
From this point on, all the errors apply to the specific sector  you  are&lt;br /&gt;
looking for. If a read passed all the previous checks, then we are  at  the&lt;br /&gt;
sector being searched for.&lt;br /&gt;
&lt;br /&gt;
Note that the entire sector is read before  these  errors  are  detected.&lt;br /&gt;
Therefore the data, checksum and off bytes are available.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     04    22    Read   Data descriptor byte not found (HEX $07, GCR $55)&lt;br /&gt;
                        Each sector data block is preceeded  by  the  value&lt;br /&gt;
                        $07, the &amp;quot;data block&amp;quot; descriptor. If this value  is&lt;br /&gt;
                        not there, this error is  generated.  Each  encoded&lt;br /&gt;
                        sector  has  actually  260  bytes.  First  is   the&lt;br /&gt;
                        descriptor byte, then  follows  the  256  bytes  of&lt;br /&gt;
                        data, a checksum, and two &amp;quot;off&amp;quot; bytes.&lt;br /&gt;
     05    23    Read   Checksum error in data block&lt;br /&gt;
                        The checksum of  the  data  read  of  the  disk  is&lt;br /&gt;
                        calculated, and compared against the one stored  at&lt;br /&gt;
                        the end of the sector. If  there's  a  discrepancy,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
     0F    74    Read   Drive Not Ready (no disk in drive or no device 1)&lt;br /&gt;
&lt;br /&gt;
These errors only  apply  when  writing  to  a  disk.  I  don't  see  the&lt;br /&gt;
usefulness of having these as they cannot be present when only *reading*  a&lt;br /&gt;
disk.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     06    24    Write  Write verify (on format)&lt;br /&gt;
     07    25    Write  Write verify error&lt;br /&gt;
                        Once the GCR-encoded sector  is  written  out,  the&lt;br /&gt;
                        drive waits for the sector to come around again and&lt;br /&gt;
                        verifies the whole 325-byte GCR block.  Any  errors&lt;br /&gt;
                        encountered will generate this error.&lt;br /&gt;
     08    26    Write  Write protect on&lt;br /&gt;
                        Self explanatory. Remove the write-protect tab, and&lt;br /&gt;
                        try again.&lt;br /&gt;
     0A    28    Write  Write error&lt;br /&gt;
                        In actual fact, this error never occurs, but it  is&lt;br /&gt;
                        included for completeness.&lt;br /&gt;
&lt;br /&gt;
This is not an error at all, but when gets reported when the  read  of  a&lt;br /&gt;
sector is ok.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     01    00    N/A    No error.&lt;br /&gt;
                        Self explanatory. No errors were  detected  in  the&lt;br /&gt;
                        reading and decoding of the sector.&lt;br /&gt;
&lt;br /&gt;
The advantage with using the 35 track D64  format,  regardless  of  error&lt;br /&gt;
bytes, is that it can be converted directly back to a 1541 disk  by  either&lt;br /&gt;
using the proper cable and software on the PC, or send it down to  the  C64&lt;br /&gt;
and writing it back to a 1541. It is the best documented format since it is&lt;br /&gt;
also native to the C64, with many books explaining the disk layout and  the&lt;br /&gt;
internals of the 1541.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What it takes to support D64 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The D64 layout is reasonably robust,  being  that  it  is  an  electronic&lt;br /&gt;
representation of a physical 1541  disk.  It  shares  *most*  of  the  1541&lt;br /&gt;
attributes and it supports all file formats, since all C64 files came  from&lt;br /&gt;
here. The only file I have found that can't be copied to a D64 is a T64 FRZ&lt;br /&gt;
(FRoZen files), since you lose the extra file type attribute.&lt;br /&gt;
&lt;br /&gt;
Since the D64 layout seems to be an exact byte copy of a 1541 floppy,  it&lt;br /&gt;
would appear to be the perfect format for *any* emulator. However, it  does&lt;br /&gt;
not contain certain vital bits of information that, as a user, you normally&lt;br /&gt;
don't have access to.&lt;br /&gt;
&lt;br /&gt;
Preceeding each sector on a real  1541  disk  is  a  header  block  which&lt;br /&gt;
contains the sector ID bytes and checksum. From the  information  contained&lt;br /&gt;
in the header, the drive determines if there's  an  error  on  that  header&lt;br /&gt;
(27-checksum error, 29-disk ID mismatch). The sector itself  also  contains&lt;br /&gt;
info (data block signature, checksum) that result in  error  detection  (23&lt;br /&gt;
checksum, 22 data block not present, etc). The error bytes had to be  added&lt;br /&gt;
on to the D64 image, &amp;quot;extending&amp;quot;  the  format  to  take  into  account  the&lt;br /&gt;
missing info.&lt;br /&gt;
&lt;br /&gt;
The disk ID is important in the copy protection of  some  programs.  Some&lt;br /&gt;
programs fail to work properly since the D64 doesn't  contain  these  ID's.&lt;br /&gt;
These bytes would be an addition to the format which has  never  been  done&lt;br /&gt;
and would be difficult to do. (As an aside, the  4-pack  ZipCode  files  do&lt;br /&gt;
contain the original master disk ID, but these are lost in  the  conversion&lt;br /&gt;
of a ZipCode to a D64. Only storing *one* of the ID's is  not  enough,  all&lt;br /&gt;
the sector ID's should be kept.)&lt;br /&gt;
&lt;br /&gt;
The extended track 1541 disks also presented  a  problem,  as  there  are&lt;br /&gt;
several different formats (and how/where to store the extra BAM entries  in&lt;br /&gt;
a sector that was not designed for  them,  yet  still  remain  compatible).&lt;br /&gt;
Because of the additions to the format (error bytes and  40  tracks)  there&lt;br /&gt;
exists 4 different types of D64's, all recognizeable by their size.&lt;br /&gt;
&lt;br /&gt;
It is also the only format that uses the sector count for the  file  size&lt;br /&gt;
rather than  actual  bytes  used.  This  can  present  some  problems  when&lt;br /&gt;
converting/copying the to another format because you may have to  know  the&lt;br /&gt;
size before you begin (see LBR format).&lt;br /&gt;
&lt;br /&gt;
It also contains no consistent signature, useful for recognizing  if  D64&lt;br /&gt;
is really what it claims to be. In order to determine if a file is  a  D64,&lt;br /&gt;
you must check the file size.&lt;br /&gt;
&lt;br /&gt;
(Content taken from [http://unusedino.de/ec64/technical/formats/d64.html D64.TXT] in Peter Scheper's excellent compendium of C64 file format information).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Commodore computers]]&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	<entry>
		<id>http://fileformats.archiveteam.org/wiki/CBMFS</id>
		<title>CBMFS</title>
		<link rel="alternate" type="text/html" href="http://fileformats.archiveteam.org/wiki/CBMFS"/>
				<updated>2013-05-20T20:53:47Z</updated>
		
		<summary type="html">&lt;p&gt;Jonnosan: Created page with &amp;quot;The CBM File System was used by disk drives made by Commodore Business Machines for the  PET, VIC-20, C64 and C128 range of computers. These drives were called 'intelligent pe...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The CBM File System was used by disk drives made by Commodore Business Machines for the  PET, VIC-20, C64 and C128 range of computers. These drives were called 'intelligent peripherals' meaning the DOS (Disk Operating System) was runs in the drive itself, not on the computer the drive was attached to.&lt;br /&gt;
&lt;br /&gt;
The most popular CBM drive was the 1541, which supported 35 tracks using GCR encoding. The D64 format is most frequently used to capture 1541 disk images, it consists of a sector-for-sector copy of a 1540/1541 disk.  The standard D64 is a 174848 byte file comprised of 256 byte sectors arranged in 35 tracks with a varying number of  sectors  per  track for a total of 683 sectors. Track counting starts at 1, not 0, and goes  up&lt;br /&gt;
to 35. Sector counting starts at 0, not 1, for the first sector,  therefore a track with 21 sectors will go from 0 to 20.&lt;br /&gt;
&lt;br /&gt;
The original media (a 5.25&amp;quot; disk) has the tracks  laid  out  in  circles, with track 1 on the very outside of the disk  (closest  to  the  sides)  to track 35 being on the inside of the disk (closest to the inner  hub  ring). Commodore, in their infinite wisdom, varied the number of sectors per track and data densities across the disk to optimize available storage, resulting in the chart below. It shows the sectors/track for a  standard  D64.  Since the outside diameter of a circle is  the  largest  (versus  closer  to  the center), the outside tracks have the largest amount of storage.&lt;br /&gt;
&lt;br /&gt;
        Track   Sectors/track   # Sectors   Storage in Bytes&lt;br /&gt;
        -----   -------------   ---------   ----------------&lt;br /&gt;
         1-17        21            357           7820&lt;br /&gt;
        18-24        19            133           7170&lt;br /&gt;
        25-30        18            108           6300&lt;br /&gt;
        31-40(*)     17             85           6020&lt;br /&gt;
                                   ---&lt;br /&gt;
                                   683 (for a 35 track image)&lt;br /&gt;
&lt;br /&gt;
  Track #Sect #SectorsIn D64 Offset   Track #Sect #SectorsIn D64 Offset&lt;br /&gt;
  ----- ----- ---------- ----------   ----- ----- ---------- ----------&lt;br /&gt;
    1     21       0       $00000      21     19     414       $19E00&lt;br /&gt;
    2     21      21       $01500      22     19     433       $1B100&lt;br /&gt;
    3     21      42       $02A00      23     19     452       $1C400&lt;br /&gt;
    4     21      63       $03F00      24     19     471       $1D700&lt;br /&gt;
    5     21      84       $05400      25     18     490       $1EA00&lt;br /&gt;
    6     21     105       $06900      26     18     508       $1FC00&lt;br /&gt;
    7     21     126       $07E00      27     18     526       $20E00&lt;br /&gt;
    8     21     147       $09300      28     18     544       $22000&lt;br /&gt;
    9     21     168       $0A800      29     18     562       $23200&lt;br /&gt;
   10     21     189       $0BD00      30     18     580       $24400&lt;br /&gt;
   11     21     210       $0D200      31     17     598       $25600&lt;br /&gt;
   12     21     231       $0E700      32     17     615       $26700&lt;br /&gt;
   13     21     252       $0FC00      33     17     632       $27800&lt;br /&gt;
   14     21     273       $11100      34     17     649       $28900&lt;br /&gt;
   15     21     294       $12600      35     17     666       $29A00&lt;br /&gt;
   16     21     315       $13B00      36(*)  17     683       $2AB00&lt;br /&gt;
   17     21     336       $15000      37(*)  17     700       $2BC00&lt;br /&gt;
   18     19     357       $16500      38(*)  17     717       $2CD00&lt;br /&gt;
   19     19     376       $17800      39(*)  17     734       $2DE00&lt;br /&gt;
   20     19     395       $18B00      40(*)  17     751       $2EF00&lt;br /&gt;
&lt;br /&gt;
  (*)Tracks 36-40 apply to 40-track images only&lt;br /&gt;
&lt;br /&gt;
The directory track should be contained totally on track 18. Sectors 1-18&lt;br /&gt;
contain the entries and sector 0 contains the BAM (Block Availability  Map)&lt;br /&gt;
and disk name/ID. Since the directory is only 18 sectors large (19 less one&lt;br /&gt;
for the BAM), and each sector can contain only  8  entries  (32  bytes  per&lt;br /&gt;
entry), the maximum number of directory entries is 18 * 8 = 144. The  first&lt;br /&gt;
directory sector is always 18/1, even though the t/s pointer at 18/0 (first&lt;br /&gt;
two bytes) might point somewhere else.  It  then  follows  the  same  chain&lt;br /&gt;
structure as a normal file, using a sector interleave of 3. This makes  the&lt;br /&gt;
chain links go 18/1, 18/4, 18/7 etc.&lt;br /&gt;
&lt;br /&gt;
Note that you can extend the directory off  of  track  18,  but  only  when&lt;br /&gt;
reading the disk or image. Attempting to write to a directory sector not on&lt;br /&gt;
track 18 will cause directory corruption.&lt;br /&gt;
&lt;br /&gt;
Each directory sector has the following layout (18/1 partial dump):&lt;br /&gt;
&lt;br /&gt;
    00: 12 04 81 11 00 4E 41 4D 45 53 20 26 20 50 4F 53 &amp;lt;- notice the T/S link&lt;br /&gt;
    10: 49 54 A0 A0 A0 00 00 00 00 00 00 00 00 00 15 00 &amp;lt;- to 18/4 ($12/$04)&lt;br /&gt;
    20: 00 00 84 11 02 41 44 44 49 54 49 4F 4E 41 4C 20 &amp;lt;- and how its not here&lt;br /&gt;
    30: 49 4E 46 4F A0 11 0C FE 00 00 00 00 00 00 61 01 &amp;lt;- ($00/$00)&lt;br /&gt;
&lt;br /&gt;
The first two bytes of the sector ($12/$04) indicate the location of  the&lt;br /&gt;
next track/sector of the directory (18/4). If the track is set to $00, then&lt;br /&gt;
it is the last sector of the directory. It is possible,  however  unlikely,&lt;br /&gt;
that the directory may *not* be competely on track 18 (some disks do  exist&lt;br /&gt;
like this). Just follow the chain anyhow.&lt;br /&gt;
&lt;br /&gt;
When the directory is done, the track value will be $00. The sector  link&lt;br /&gt;
should contain a value of $FF, meaning the whole sector is  allocated,  but&lt;br /&gt;
the actual value doesn't matter. The drive will return  all  the  available&lt;br /&gt;
entries anyways. This is a breakdown of a  standard  directory  sector  and&lt;br /&gt;
entry:&lt;br /&gt;
&lt;br /&gt;
  Bytes: $00-1F: First directory entry&lt;br /&gt;
          00-01: Track/Sector location of next directory sector ($00 $00 if&lt;br /&gt;
                 not the first entry in the sector)&lt;br /&gt;
             02: File type.&lt;br /&gt;
                 Typical values for this location are:&lt;br /&gt;
                   $00 - Scratched (deleted file entry)&lt;br /&gt;
                    80 - DEL&lt;br /&gt;
                    81 - SEQ&lt;br /&gt;
                    82 - PRG&lt;br /&gt;
                    83 - USR&lt;br /&gt;
                    84 - REL&lt;br /&gt;
                 Bit 0-3: The actual filetype&lt;br /&gt;
                          000 (0) - DEL&lt;br /&gt;
                          001 (1) - SEQ&lt;br /&gt;
                          010 (2) - PRG&lt;br /&gt;
                          011 (3) - USR&lt;br /&gt;
                          100 (4) - REL&lt;br /&gt;
                          Values 5-15 are illegal, but if used will produce&lt;br /&gt;
                          very strange results. The 1541 is inconsistent in&lt;br /&gt;
                          how it treats these bits. Some routines use all 4&lt;br /&gt;
                          bits, others ignore bit 3,  resulting  in  values&lt;br /&gt;
                          from 0-7.&lt;br /&gt;
                 Bit   4: Not used&lt;br /&gt;
                 Bit   5: Used only during SAVE-@ replacement&lt;br /&gt;
                 Bit   6: Locked flag (Set produces &amp;quot;&amp;gt;&amp;quot; locked files)&lt;br /&gt;
                 Bit   7: Closed flag  (Not  set  produces  &amp;quot;*&amp;quot;, or &amp;quot;splat&amp;quot;&lt;br /&gt;
                          files)&lt;br /&gt;
          03-04: Track/sector location of first sector of file&lt;br /&gt;
          05-14: 16 character filename (in PETASCII, padded with $A0)&lt;br /&gt;
          15-16: Track/Sector location of first side-sector block (REL file&lt;br /&gt;
                 only)&lt;br /&gt;
             17: REL file record length (REL file only, max. value 254)&lt;br /&gt;
          18-1D: Unused (except with GEOS disks)&lt;br /&gt;
          1E-1F: File size in sectors, low/high byte  order  ($1E+$1F*256).&lt;br /&gt;
                 The approx. filesize in bytes is &amp;lt;= #sectors * 254&lt;br /&gt;
          20-3F: Second dir entry. From now on the first two bytes of  each&lt;br /&gt;
                 entry in this sector  should  be  $00  $00,  as  they  are&lt;br /&gt;
                 unused.&lt;br /&gt;
          40-5F: Third dir entry&lt;br /&gt;
          60-7F: Fourth dir entry&lt;br /&gt;
          80-9F: Fifth dir entry&lt;br /&gt;
          A0-BF: Sixth dir entry&lt;br /&gt;
          C0-DF: Seventh dir entry&lt;br /&gt;
          E0-FF: Eighth dir entry&lt;br /&gt;
&lt;br /&gt;
Files, on a standard 1541, are stored using an interleave of 10. Assuming a&lt;br /&gt;
starting track/sector of 17/0, the chain  would  run  17/0,  17/10,  17/20,&lt;br /&gt;
17/8, 17/18, etc.&lt;br /&gt;
&lt;br /&gt;
Note: No GEOS entries are listed in the above description. See the [[GEOS]] for GEOS info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The layout of the BAM area (sector 18/0) is a bit more complicated...&lt;br /&gt;
&lt;br /&gt;
      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F&lt;br /&gt;
      -----------------------------------------------&lt;br /&gt;
  00: 12 01 41 00 12 FF F9 17 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  10: 15 FF FF 1F 12 FF F9 17 00 00 00 00 00 00 00 00&lt;br /&gt;
  20: 00 00 00 00 0E FF 74 03 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  30: 0E 3F FC 11 07 E1 80 01 15 FF FF 1F 15 FF FF 1F&lt;br /&gt;
  40: 15 FF FF 1F 15 FF FF 1F 0D C0 FF 07 13 FF FF 07&lt;br /&gt;
  50: 13 FF FF 07 11 FF CF 07 13 FF FF 07 12 7F FF 07&lt;br /&gt;
  60: 13 FF FF 07 0A 75 55 01 00 00 00 00 00 00 00 00&lt;br /&gt;
  70: 00 00 00 00 00 00 00 00 01 08 00 00 03 02 48 00&lt;br /&gt;
  80: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01&lt;br /&gt;
  90: 53 48 41 52 45 57 41 52 45 20 31 20 20 A0 A0 A0&lt;br /&gt;
  A0: A0 A0 56 54 A0 32 41 A0 A0 A0 A0 00 00 00 00 00&lt;br /&gt;
  B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
  F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00&lt;br /&gt;
&lt;br /&gt;
  Bytes:$00-01: Track/Sector location of the first directory sector (should&lt;br /&gt;
                be set to 18/1 but it doesn't matter, and don't trust  what&lt;br /&gt;
                is there, always go to 18/1 for first directory entry)&lt;br /&gt;
            02: Disk DOS version type (see note below)&lt;br /&gt;
                  $41 (&amp;quot;A&amp;quot;)&lt;br /&gt;
            03: Unused&lt;br /&gt;
         04-8F: BAM entries for each track, in groups  of  four  bytes  per&lt;br /&gt;
                track, starting on track 1 (see below for more details)&lt;br /&gt;
         90-9F: Disk Name (padded with $A0)&lt;br /&gt;
         A0-A1: Filled with $A0&lt;br /&gt;
         A2-A3: Disk ID&lt;br /&gt;
            A4: Usually $A0&lt;br /&gt;
         A5-A6: DOS type, usually &amp;quot;2A&amp;quot;&lt;br /&gt;
         A7-AA: Filled with $A0&lt;br /&gt;
         AB-FF: Normally unused ($00), except for 40 track extended format,&lt;br /&gt;
                see the following two entries:&lt;br /&gt;
         AC-BF: DOLPHIN DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
         C0-D3: SPEED DOS track 36-40 BAM entries (only for 40 track)&lt;br /&gt;
&lt;br /&gt;
Note: The BAM entries for SPEED, DOLPHIN and  ProLogic  DOS  use  the  same layout as standard BAM entries.&lt;br /&gt;
&lt;br /&gt;
One of the interesting things from the BAM sector is the byte  at  offset&lt;br /&gt;
$02, the DOS version byte. If it is set to anything other than $41 or  $00,&lt;br /&gt;
then we have what is called &amp;quot;soft write protection&amp;quot;. Any attempt  to  write&lt;br /&gt;
to the disk will return the &amp;quot;DOS Version&amp;quot; error code 73  ,&amp;quot;CBM  DOS  V  2.6&lt;br /&gt;
1541&amp;quot;. The 1541 is simply telling  you  that  it  thinks  the  disk  format&lt;br /&gt;
version is incorrect. This message will normally come  up  when  you  first&lt;br /&gt;
turn on the 1541 and read the error channel. If you write a $00  or  a  $41&lt;br /&gt;
into 1541 memory location $00FF (for device 0),  then  you  can  circumvent&lt;br /&gt;
this type of write-protection, and change the DOS version back to  what  it&lt;br /&gt;
should be.&lt;br /&gt;
&lt;br /&gt;
The BAM entries require a bit (no pun intended) more of a breakdown. Take&lt;br /&gt;
the first entry at bytes $04-$07 ($12 $FF $F9 $17). The first byte ($12) is&lt;br /&gt;
the number of free sectors on that track. Since we are looking at the track&lt;br /&gt;
1 entry, this means it has 18 (decimal) free sectors. The next three  bytes&lt;br /&gt;
represent the bitmap of which sectors are used/free. Since it is 3 bytes (8&lt;br /&gt;
bits/byte) we have 24 bits of storage. Remember that at  most,  each  track&lt;br /&gt;
only has 21 sectors, so there are a few unused bits.&lt;br /&gt;
&lt;br /&gt;
   Bytes: 04-07: 12 FF F9 17   Track 1 BAM&lt;br /&gt;
          08-0B: 15 FF FF FF   Track 2 BAM&lt;br /&gt;
          0C-0F: 15 FF FF 1F   Track 3 BAM&lt;br /&gt;
          ...&lt;br /&gt;
          8C-8F: 11 FF FF 01   Track 35 BAM&lt;br /&gt;
&lt;br /&gt;
These entries must be viewed in binary to make any sense. We will use the&lt;br /&gt;
first entry (track 1) at bytes 04-07:&lt;br /&gt;
&lt;br /&gt;
     FF=11111111, F9=11111001, 17=00010111&lt;br /&gt;
&lt;br /&gt;
In order to make any sense from the binary notation, flip the bits around.&lt;br /&gt;
&lt;br /&gt;
                   111111 11112222&lt;br /&gt;
        01234567 89012345 67890123&lt;br /&gt;
        --------------------------&lt;br /&gt;
        11111111 10011111 11101000&lt;br /&gt;
        ^                     ^&lt;br /&gt;
    sector 0              sector 20&lt;br /&gt;
&lt;br /&gt;
Since we are on the first track, we have 21 sectors, and only use  up  to&lt;br /&gt;
the bit 20 position. If a bit is on (1), the  sector  is  free.  Therefore,&lt;br /&gt;
track 1 has sectors 9,10 and 19 used, all the rest are free.  Any  leftover&lt;br /&gt;
bits that refer to sectors that don't exist, like bits 21-23 in  the  above&lt;br /&gt;
example, are set to allocated.&lt;br /&gt;
&lt;br /&gt;
Each filetype has its own unique properties, but most follow  one  simple&lt;br /&gt;
structure. The first file sector is pointed to by the directory and follows&lt;br /&gt;
a t/s chain, until the track value reaches  $00.  When  this  happens,  the&lt;br /&gt;
value in the sector link location indicates how much of the sector is used.&lt;br /&gt;
For example, the following chain indicates a file 6 sectors long, and  ends&lt;br /&gt;
when we encounter the $00/$34 chain. At this point the last sector occupies&lt;br /&gt;
from bytes $02-$34.&lt;br /&gt;
&lt;br /&gt;
    1       2       3       4       5       6&lt;br /&gt;
  ----    -----   -----   -----   -----   -----&lt;br /&gt;
  17/0    17/10   17/20   17/1    17/11    0/52&lt;br /&gt;
 (11/00) (11/0A) (11/14) (11/01) (11/0B)  (0/34)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Variations on the D64 layout&lt;br /&gt;
&lt;br /&gt;
     &lt;br /&gt;
These are some variations of the D64 layout:&lt;br /&gt;
&lt;br /&gt;
1. Standard 35 track layout but with 683 error bytes added on to the  end&lt;br /&gt;
 of the file. Each byte of the  error  info  corresponds  to  a  single&lt;br /&gt;
 sector stored in the D64, indicating if the  sector  on  the  original&lt;br /&gt;
 disk contained an error. The first byte is for track 1/0, and the last&lt;br /&gt;
 byte is for track 35/16.&lt;br /&gt;
&lt;br /&gt;
2. A 40 track layout, following the same layout as a 35 track  disk,  but &lt;br /&gt;
with 5 extra tracks. These contain 17 sectors each, like tracks 31-35.&lt;br /&gt;
Some of the PC utilities do allow you to create and  work  with  these&lt;br /&gt;
files. This can also have error bytes attached like variant #1.&lt;br /&gt;
&lt;br /&gt;
3. The Commodore 128 allowed for &amp;quot;auto-boot&amp;quot; disks. With  this,  t/s  1/0&lt;br /&gt;
holds a specific byte sequence which the computer recognizes  as  boot&lt;br /&gt;
code. See the document C128BOOT.TXT for more info.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a small chart detailing the standard file sizes of  D64  images,&lt;br /&gt;
35 or 40 tracks, with or without error bytes.&lt;br /&gt;
&lt;br /&gt;
     Disk type                  Size&lt;br /&gt;
     ---------                  ------&lt;br /&gt;
     35 track, no errors        174848&lt;br /&gt;
     35 track, 683 error bytes  175531&lt;br /&gt;
     40 track, no errors        196608&lt;br /&gt;
     40 track, 768 error bytes  197376&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following table (provided by Wolfgang Moser) outlines the differences&lt;br /&gt;
between the standard 1541 DOS and the various &amp;quot;speeder&amp;quot; DOS's  that  exist.&lt;br /&gt;
The 'header 7/8' category is the 'fill bytes' as  the  end  of  the  sector&lt;br /&gt;
header of  a  real  1541  disk  See  [[G64]]  for  a  better&lt;br /&gt;
explanation of these bytes.&lt;br /&gt;
&lt;br /&gt;
        Disk format             |Tracks|Header 7/8|Dos type|DiskDos&lt;br /&gt;
                                |      |allsechdrs|        |vs.type&lt;br /&gt;
       ============================================================&lt;br /&gt;
        Original CBM DOS v2.6   |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        SpeedDOS+               |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfessionalDOS Initial |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
          (Version 1/Prototype) |  40  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        ProfDOS Release         |  40  | $0f  $0f |  &amp;quot;4A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        Dolphin-DOS 2.0/3.0     |  40  | $0d  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
        PrologicDOS 1541        |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        PrologicDOS 1541        |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
        ProSpeed 1571 2.0       |  35  | $0f  $0f |  &amp;quot;2A&amp;quot;  |$41/'A'&lt;br /&gt;
        ProSpeed 1571 2.0       |  40  | $0f  $0f |  &amp;quot;2P&amp;quot;  |$50/'P'&lt;br /&gt;
       ------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The location of the extra BAM information in sector 18/0,  for  40  track&lt;br /&gt;
images, will be different depending on what standard the  disks  have  been&lt;br /&gt;
formatted with. SPEED DOS stores them from $C0 to $D3, DOLPHIN  DOS  stores&lt;br /&gt;
them from $AC to $BF and PrologicDOS stored them right after  the  existing&lt;br /&gt;
BAM entries from $90-A3. PrologicDOS also  moves  the  disk  label  and  ID&lt;br /&gt;
forward from the standard location of $90 to $A4. 64COPY and Star Commander&lt;br /&gt;
let you select from several different types of extended  disk  formats  you&lt;br /&gt;
want to create/work with.&lt;br /&gt;
&lt;br /&gt;
All three of the speeder DOS's mentioned above don't alter  the  standard&lt;br /&gt;
sector interleave of 10 for files and 3 for directories. The reason is that&lt;br /&gt;
they use a memory cache installed in the drive which reads the entire track&lt;br /&gt;
in one pass. This alleviates the need for custom interleave values. They do&lt;br /&gt;
seem to alter the algorithm that finds the next available  free  sector  so&lt;br /&gt;
that the interleave value can deviate from 10 under certain  circumstances,&lt;br /&gt;
but I don't know why they would bother.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Speed DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $C0-D3.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 00 00 00 00  ??00?2A?????????&lt;br /&gt;
  00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00C0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00D0: 11 FF FF 01 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a Dolphin DOS BAM sector. Note the location of the&lt;br /&gt;
extra BAM info from $AC-BF.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00A0: A0 A0 30 30 A0 32 41 A0 A0 A0 A0 00 11 FF FF 01  ??00?2A?????????&lt;br /&gt;
  00B0: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ???????????????? &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below is a HEX dump of a PrologicDOS BAM sector. Note that the disk  name&lt;br /&gt;
and ID are now located at $A4 instead of starting at $90.&lt;br /&gt;
&lt;br /&gt;
        00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F       ASCII&lt;br /&gt;
        -----------------------------------------------  ----------------&lt;br /&gt;
  0070: 12 FF FF 03 12 FF FF 03 12 FF FF 03 11 FF FF 01  ????????????????&lt;br /&gt;
  0080: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  0090: 11 FF FF 01 11 FF FF 01 11 FF FF 01 11 FF FF 01  ????????????????&lt;br /&gt;
  00A0: 11 FF FF 01 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0 A0  ????????????????&lt;br /&gt;
  00B0: A0 A0 A0 A0 A0 A0 30 30 A0 32 50 A0 A0 A0 A0 00  ??????00?2P?????&lt;br /&gt;
  00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
  00ED: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ????????????????&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is the meaning of the error bytes added onto the end of any extended&lt;br /&gt;
D64. The CODE is the same as that generated by the 1541 drive controller...&lt;br /&gt;
it reports these numbers, not the error code we usually see when  an  error&lt;br /&gt;
occurs.&lt;br /&gt;
&lt;br /&gt;
Some of what comes  below  is  taken  from  Immers/Neufeld  book  &amp;quot;Inside&lt;br /&gt;
Commodore DOS&amp;quot;. Note the descriptions are not  completely  accurate  as  to&lt;br /&gt;
what the drive DOS is actually doing to seek/read/decode/write sectors, but&lt;br /&gt;
serve as simple examples only. The &amp;quot;type&amp;quot; field is where the error  usually&lt;br /&gt;
occurs, whether it's searching for any SYNC mark, any header ID, any  valid&lt;br /&gt;
header, or reading a sector.&lt;br /&gt;
&lt;br /&gt;
These first errors are &amp;quot;seek&amp;quot; errors, where the disk controller is simply&lt;br /&gt;
reading headers and looking at descriptor bytes, checksums, format ID's and&lt;br /&gt;
reporting what errors it sees. These errors do *not* necessarily  apply  to&lt;br /&gt;
the exact sector being looked for. This fact  makes  duplication  of  these&lt;br /&gt;
errors very unreliable.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     03    21    Seek   No SYNC sequence found.&lt;br /&gt;
&lt;br /&gt;
                        Each  sector  data  block  and  header  block   are&lt;br /&gt;
                        preceeded by SYNC marks. If *no* sync  sequence  is&lt;br /&gt;
                        found within 20 milliseconds (only ~1/10 of a  disk&lt;br /&gt;
                        rotation!) then this error is generated. This error&lt;br /&gt;
                        used to mean the entire track is bad, but  it  does&lt;br /&gt;
                        not have to be the case. Only a small area  of  the&lt;br /&gt;
                        track needs to be without  a  SYNC  mark  and  this&lt;br /&gt;
                        error will be generated.&lt;br /&gt;
&lt;br /&gt;
                        Converting this error to a D64 is very  problematic&lt;br /&gt;
                        because it depends on where the physical head is on&lt;br /&gt;
                        the disk when a read attempt is made. If it  is  on&lt;br /&gt;
                        valid header/sectors then it  won't  occur.  If  it&lt;br /&gt;
                        happens over an area without SYNC  marks,  it  will&lt;br /&gt;
                        happen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     02    20    Seek   Header descriptor byte not found (HEX $08, GCR $52)&lt;br /&gt;
&lt;br /&gt;
                        Each sector is preceeded by an  8-byte  GCR  header&lt;br /&gt;
                        block, which starts with the value  $52  (GCR).  If&lt;br /&gt;
                        this value is not found  after  90  attempts,  this&lt;br /&gt;
                        error is generated.&lt;br /&gt;
&lt;br /&gt;
                        Basically, what a track  has  is  SYNC  marks,  and&lt;br /&gt;
                        possibly valid data blocks,  but  no  valid  header&lt;br /&gt;
                        descriptors.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     09    27    Seek   Checksum error in header block&lt;br /&gt;
&lt;br /&gt;
                        The  header  block  contains  a   checksum   value,&lt;br /&gt;
                        calculated by XOR'ing the TRACK,  SECTOR,  ID1  and&lt;br /&gt;
                        ID2 values. If this checksum is wrong,  this  error&lt;br /&gt;
                        is generated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     0B    29    Seek   Disk sector ID mismatch&lt;br /&gt;
&lt;br /&gt;
                        The ID's from the header  block  of  the  currently&lt;br /&gt;
                        read sector are compared against the ones from  the&lt;br /&gt;
                        low-level header of 18/0. If there is  a  mismatch,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     02    20    Seek   Header block not found&lt;br /&gt;
&lt;br /&gt;
                        This error can be reported again when searching for&lt;br /&gt;
                        the correct header block. An image of the header is&lt;br /&gt;
                        built and searched for, but not found after 90 read&lt;br /&gt;
                        attempts.  Note  the  difference  from  the   first&lt;br /&gt;
                        occurance. The first one only searches for a  valid&lt;br /&gt;
                        ID, not the whole header.&lt;br /&gt;
&lt;br /&gt;
Note that error 20 occurs twice during this phase. The first time is when&lt;br /&gt;
a header ID is being searched for, the second is  when  the  proper  header&lt;br /&gt;
pattern for the sector being searched for is not found.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From this point on, all the errors apply to the specific sector  you  are&lt;br /&gt;
looking for. If a read passed all the previous checks, then we are  at  the&lt;br /&gt;
sector being searched for.&lt;br /&gt;
&lt;br /&gt;
Note that the entire sector is read before  these  errors  are  detected.&lt;br /&gt;
Therefore the data, checksum and off bytes are available.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     04    22    Read   Data descriptor byte not found (HEX $07, GCR $55)&lt;br /&gt;
&lt;br /&gt;
                        Each sector data block is preceeded  by  the  value&lt;br /&gt;
                        $07, the &amp;quot;data block&amp;quot; descriptor. If this value  is&lt;br /&gt;
                        not there, this error is  generated.  Each  encoded&lt;br /&gt;
                        sector  has  actually  260  bytes.  First  is   the&lt;br /&gt;
                        descriptor byte, then  follows  the  256  bytes  of&lt;br /&gt;
                        data, a checksum, and two &amp;quot;off&amp;quot; bytes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     05    23    Read   Checksum error in data block&lt;br /&gt;
&lt;br /&gt;
                        The checksum of  the  data  read  of  the  disk  is&lt;br /&gt;
                        calculated, and compared against the one stored  at&lt;br /&gt;
                        the end of the sector. If  there's  a  discrepancy,&lt;br /&gt;
                        this error is generated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     0F    74    Read   Drive Not Ready (no disk in drive or no device 1)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These errors only  apply  when  writing  to  a  disk.  I  don't  see  the&lt;br /&gt;
usefulness of having these as they cannot be present when only *reading*  a&lt;br /&gt;
disk.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     06    24    Write  Write verify (on format)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     07    25    Write  Write verify error&lt;br /&gt;
&lt;br /&gt;
                        Once the GCR-encoded sector  is  written  out,  the&lt;br /&gt;
                        drive waits for the sector to come around again and&lt;br /&gt;
                        verifies the whole 325-byte GCR block.  Any  errors&lt;br /&gt;
                        encountered will generate this error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     08    26    Write  Write protect on&lt;br /&gt;
&lt;br /&gt;
                        Self explanatory. Remove the write-protect tab, and&lt;br /&gt;
                        try again.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     0A    28    Write  Write error&lt;br /&gt;
&lt;br /&gt;
                        In actual fact, this error never occurs, but it  is&lt;br /&gt;
                        included for completeness.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is not an error at all, but when gets reported when the  read  of  a&lt;br /&gt;
sector is ok.&lt;br /&gt;
&lt;br /&gt;
    Code  Error  Type   1541 error description&lt;br /&gt;
    ----  -----  ----   ------------------------------&lt;br /&gt;
     01    00    N/A    No error.&lt;br /&gt;
&lt;br /&gt;
                        Self explanatory. No errors were  detected  in  the&lt;br /&gt;
                        reading and decoding of the sector.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The advantage with using the 35 track D64  format,  regardless  of  error&lt;br /&gt;
bytes, is that it can be converted directly back to a 1541 disk  by  either&lt;br /&gt;
using the proper cable and software on the PC, or send it down to  the  C64&lt;br /&gt;
and writing it back to a 1541. It is the best documented format since it is&lt;br /&gt;
also native to the C64, with many books explaining the disk layout and  the&lt;br /&gt;
internals of the 1541.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
What it takes to support D64:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The D64 layout is reasonably robust,  being  that  it  is  an  electronic&lt;br /&gt;
representation of a physical 1541  disk.  It  shares  *most*  of  the  1541&lt;br /&gt;
attributes and it supports all file formats, since all C64 files came  from&lt;br /&gt;
here. The only file I have found that can't be copied to a D64 is a T64 FRZ&lt;br /&gt;
(FRoZen files), since you lose the extra file type attribute.&lt;br /&gt;
&lt;br /&gt;
Since the D64 layout seems to be an exact byte copy of a 1541 floppy,  it&lt;br /&gt;
would appear to be the perfect format for *any* emulator. However, it  does&lt;br /&gt;
not contain certain vital bits of information that, as a user, you normally&lt;br /&gt;
don't have access to.&lt;br /&gt;
&lt;br /&gt;
Preceeding each sector on a real  1541  disk  is  a  header  block  which&lt;br /&gt;
contains the sector ID bytes and checksum. From the  information  contained&lt;br /&gt;
in the header, the drive determines if there's  an  error  on  that  header&lt;br /&gt;
(27-checksum error, 29-disk ID mismatch). The sector itself  also  contains&lt;br /&gt;
info (data block signature, checksum) that result in  error  detection  (23&lt;br /&gt;
checksum, 22 data block not present, etc). The error bytes had to be  added&lt;br /&gt;
on to the D64 image, &amp;quot;extending&amp;quot;  the  format  to  take  into  account  the&lt;br /&gt;
missing info.&lt;br /&gt;
&lt;br /&gt;
The disk ID is important in the copy protection of  some  programs.  Some&lt;br /&gt;
programs fail to work properly since the D64 doesn't  contain  these  ID's.&lt;br /&gt;
These bytes would be an addition to the format which has  never  been  done&lt;br /&gt;
and would be difficult to do. (As an aside, the  4-pack  ZipCode  files  do&lt;br /&gt;
contain the original master disk ID, but these are lost in  the  conversion&lt;br /&gt;
of a ZipCode to a D64. Only storing *one* of the ID's is  not  enough,  all&lt;br /&gt;
the sector ID's should be kept.)&lt;br /&gt;
&lt;br /&gt;
The extended track 1541 disks also presented  a  problem,  as  there  are&lt;br /&gt;
several different formats (and how/where to store the extra BAM entries  in&lt;br /&gt;
a sector that was not designed for  them,  yet  still  remain  compatible).&lt;br /&gt;
Because of the additions to the format (error bytes and  40  tracks)  there&lt;br /&gt;
exists 4 different types of D64's, all recognizeable by their size.&lt;br /&gt;
&lt;br /&gt;
It is also the only format that uses the sector count for the  file  size&lt;br /&gt;
rather than  actual  bytes  used.  This  can  present  some  problems  when&lt;br /&gt;
converting/copying the to another format because you may have to  know  the&lt;br /&gt;
size before you begin (see LBR format).&lt;br /&gt;
&lt;br /&gt;
It also contains no consistent signature, useful for recognizing  if  D64&lt;br /&gt;
is really what it claims to be. In order to determine if a file is  a  D64,&lt;br /&gt;
you must check the file size.&lt;/div&gt;</summary>
		<author><name>Jonnosan</name></author>	</entry>

	</feed>