{"id":1018,"date":"2019-03-19T12:40:35","date_gmt":"2019-03-19T19:40:35","guid":{"rendered":"https:\/\/www.pagetable.com\/?p=1018"},"modified":"2019-03-19T12:40:35","modified_gmt":"2019-03-19T19:40:35","slug":"commodore-peripheral-bus-overview","status":"publish","type":"post","link":"https:\/\/www.pagetable.com\/?p=1018","title":{"rendered":"Commodore Peripheral Bus: Overview"},"content":{"rendered":"<p>The well-known Serial Bus (aka Serial &ldquo;IEC&rdquo; Bus) of the Commodore 64 that connects to disk drives such as the 1541 is just one variant of a whole family of busses and protocols used by the line of 8 bit Commodore machines from the PET to the C65. This is the first article of a <strong>multi-part series<\/strong> on the <strong>Commodore Peripheral Bus family<\/strong>.<\/p>\n<p>The following figure compares the different protocol stacks. There are three different connectors with their unique byte transfer protocols: IEEE-488, Serial, and TCBM. Fast Serial and JiffyDOS are optimized, but backwards-compatible protocols for existing cables, and CBDOS integrates the drive directly into the computer. The higher level protocols are the same across all Commodore 8 bit machines, including the &ldquo;KERNAL&rdquo; operating system APIs.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"docs\/cbmbus\/cbmbus.png\" height=\"241\" width=\"601\" alt=\"\" \/><\/p>\n<p>These are the properties and tradeoffs of the different variants of the protocol stack<sup id=\"fnref:1\"><a href=\"#fn:1\" rel=\"footnote\">1<\/a><\/sup>:<\/p>\n<table>\n<thead>\n<tr>\n<th>                         <\/th>\n<th> IEEE-488 <\/th>\n<th> Serial        <\/th>\n<th> Fast Serial   <\/th>\n<th> JiffyDOS    <\/th>\n<th> TCBM                   <\/th>\n<th> CBDOS       <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td> Data Wires              <\/td>\n<td> 13       <\/td>\n<td> 3             <\/td>\n<td> 4             <\/td>\n<td> 3           <\/td>\n<td> 12                     <\/td>\n<td> &#8211;           <\/td>\n<\/tr>\n<tr>\n<td> Speed (KB\/sec)          <\/td>\n<td> 2.1      <\/td>\n<td> 0.4           <\/td>\n<td> 2.1           <\/td>\n<td> 2.1         <\/td>\n<td> 2.4                    <\/td>\n<td> &infin;     <\/td>\n<\/tr>\n<tr>\n<td> Controller Code (bytes) <\/td>\n<td> 334      <\/td>\n<td> 434           <\/td>\n<td> 708           <\/td>\n<td> 739         <\/td>\n<td> 262                    <\/td>\n<td> 0           <\/td>\n<\/tr>\n<tr>\n<td> Comments                <\/td>\n<td> compatible with industry standard <\/td>\n<td> very slow <\/td>\n<td> requires decidated bit shifting hardware <\/td>\n<td> <\/td>\n<td> point-to-point <\/td>\n<td>drive integrated into computer <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>All variants are based on the IEEE-488 standard and therefore share (mostly) the same basic architecture:<br \/>\n* All participants are <strong>daisy-chained<\/strong>.<br \/>\n* <strong>One dedicated controller<\/strong> (the computer) does bus arbitration of <strong>up to 31 devices<\/strong>.<br \/>\n* <strong>One-to-many<\/strong>: Any participant can send data to any set of participants.<br \/>\n* A device has <strong>multiple channels<\/strong> for different functions.<br \/>\n* Data transmission is <strong>byte stream<\/strong> based.<\/p>\n<p>The different variants and layers will be described in multiple articles.<\/p>\n<hr\/>\n<blockquote>\n<p><strong><em>NOTE:<\/em><\/strong>  I am releasing one part every week, at which time links will be added to the bullet points below. The articles will also be announced on my Twitter account <a href=\"https:\/\/twitter.com\/pagetable\">@pagetable<\/a> and my Mastodon account <a href=\"https:\/\/mastodon.social\/@pagetable\">@pagetable&#64;mastodon.social<\/a>.<\/p>\n<\/blockquote>\n<hr\/>\n<ul>\n<li><strong>Part 0: Overview and Introduction<\/strong><br \/>\n<em>That&rsquo;s this part.<\/em><\/li>\n<li><strong><a href=\"https:\/\/www.pagetable.com\/?p=1023\">Part 1: IEEE-488<\/a><\/strong> [PET\/CBM Series; 1977]<br \/>\nThis part covers layers 1 (electrical) and 2 (byte transfer) of IEEE-488, an 8-bit parallel bus with three handshake lines, an ATN line for bus arbitration and very relaxed timing requirements.<\/li>\n<li><strong><a href=\"https:\/\/www.pagetable.com\/?p=1031\">Part 2: The TALK\/LISTEN Layer<\/a><\/strong><br \/>\nThis part talks about layer 3 (TALK\/LISTEN), which is shared between all bus variants.<\/li>\n<li><strong><a href=\"https:\/\/www.pagetable.com\/?p=1038\">Part 3: The Commodore DOS Layer<\/a><\/strong><br \/>\nThis part describes layer 4 (Commodore DOS), which is shared between all bus variants.<\/li>\n<li><strong><a href=\"https:\/\/www.pagetable.com\/?p=1135\">Part 4: Standard Serial (IEC)<\/a><\/strong> [VIC-20, C64; 1981]<br \/>\nThe VIC-20 introduced a serial version of layers 1 and 2 with one clock and one data line for serial data transmission, and an ATN line for bus arbitration. It has some strict timing requirements. This bus is supported by all members of the home computer line: VIC-20, C64, Plus\/4 Series, C128 and C65.<\/li>\n<li><strong><a href=\"https:\/\/www.pagetable.com\/?p=1324\">Part 5: TCBM<\/a><\/strong> [C16, C116, Plus\/4; 1984]<br \/>\nThe Plus\/4 Series introduced a 1-to-1 bus between the computer and one drive, with 8 bit parallel data, two handshake lines, and two status lines from the drive to the computer. It was the short-lived planned successor of the Standard Serial bus, but was then replaced by Fast Serial.<\/li>\n<li><strong>Part 6: JiffyDOS<\/strong> [1985] <em>(coming soon)<\/em><br \/>\nJiffyDOS, a 3rd party ROM patch for computers and drives, replaces layer 2 byte transmission of Standard Serial by using the clock and data lines in a more efficient way. Bus arbitration is unchanged. The controller detects a device&rsquo;s JiffyDOS support and can fall back to the Standard Serial protocol.<\/li>\n<li><strong>Part 7: Fast Serial<\/strong> [C128; 1986] <em>(coming soon)<\/em><br \/>\nThe C128 introduced Fast Serial, which replaces layer 2 byte transmission of Standard Serial by using a previously unused wire in the Serial connector as a third line for data transmission. Bus arbitration is unchanged. The controller detects a device&rsquo;s Fast Serial support and can fall back to the Standard Serial protocol.<\/li>\n<li><strong>Part 8: CBDOS<\/strong> [C65; 1991] <em>(coming soon)<\/em><br \/>\nThe unreleased C65 added CBDOS (&ldquo;computer-based DOS&rdquo;) by integrating one or more drive controllers into the computer. There are no layers 1 and 2, and layer 3 sits directly on top of function calls that call into the DOS code running on the same CPU.<\/li>\n<\/ul>\n<blockquote>\n<p>This article series is an Open Source project. Corrections, clarifications and additions are <strong>highly<\/strong> appreciated. I will regularly update the articles from the repository at <a href=\"https:\/\/github.com\/mist64\/cbmbus_doc\">https:\/\/github.com\/mist64\/cbmbus_doc<\/a>.<\/p>\n<\/blockquote>\n<p><!---\n\nf0ed-f0f4 (7)\nf8ea-f911 (39)\nfb97-fc9a (259)\n----\n+305\n\n\n\n\n* size\n    * controller!\n    * IEEE: CBM2\n    * Serial: C64\n    * Fast: C128\n    * TCBM: EC8B-ED18, EDD4-EDEA, EDFA-EE5D\n        * = 99 + 22 + 141 = 262\n\n>2000 a9 08 20 b4 ff a9 6f 20 96 ff a2 00 20 a5 ff ca d0 fa 60\nbreak 2000\nbreak 2012\nbreak 2015\ng\nsys8192\ng\n\n# inc $d020\n>2000 a9 08 20 b4 ff a9 6f 20 96 ff a2 00 20 a5 ff ee 20 d0 ca d0 f7 60\n\n# jsr $ffd2\n>2000 a9 08 20 b4 ff a9 6f 20 96 ff a2 00 20 a5 ff 20 d2 ff ca d0 f7 60\n\n# sta $0400,x (C64)\n>2000 a9 00 20 bd ff a9 01 a2 08 a0 0f 20 ba ff 20 c0 ff a9 08 20 b4 ff a9 6f 20 96 ff a2 00 20 a5 ff 9d 00 04 e8 d0 f7 60\n\n# sta $0400,x (C128; 16 bytes only)\n>2000 a9 00 20 bd ff a9 01 a2 08 a0 0f 20 ba ff 20 c0 ff a9 08 20 b4 ff a9 6f 20 96 ff a2 f0 20 a5 ff 9d 00 04 e8 d0 f7 60\n\n# sta $0c00,x (Plus\/4)\n>2000 a9 00 20 bd ff a9 01 a2 08 a0 0f 20 ba ff 20 c0 ff a9 08 20 b4 ff a9 6f 20 96 ff a2 00 20 a5 ff 9d 00 0c e8 d0 f7 60\n\n# sta $1e00,x (VIC-20)\n>1000 a9 00 20 bd ff a9 01 a2 08 a0 0f 20 ba ff 20 c0 ff a9 08 20 b4 ff a9 6f 20 96 ff a2 00 20 a5 ff 9d 00 1e e8 d0 f7 60\nbreak 1000\nbreak 1026\n\n# two loops (C64)\n>2000 a9 00 20 bd ff a9 01 a2 08 a0 0f 20 ba ff 20 c0 ff a9 08 20 b4 ff a9 6f 20 96 ff a2 00 20 a5 ff 9d 00 04 e8 d0 f7 20 a5 ff 9d 00 04 e8 d0 f7 60\nbreak 2027\nbreak 2031\n\n# IEEE cart\n>2000 a9 08 20 d7 cb a9 6f 20 27 cc a2 00 20 b4 cc ca d0 fa 60\n\n# IEEE cart; sta $0400,x\n\n>2000 a9 08 20 d7 cb a9 6f 20 27 cc a2 00 20 b4 cc 9d 00 04 e8 d0 f7 60\n\n* VIC-20 Serial\n    * VIC-20\/1540     2614 -> 0.38\n* C64 Serial\n    * VIC-20\/1541     2941 -> 0.34\n    * VIC-20\/1581     2767 -> 0.36\n    * C64\/1541:       2616 -> 0.38\n    * C64\/1581:       2426 -> 0.41\n    * C64\/J1541:      2274 -> 0.44\n    * Plus\/4, 1541:   5163 -> 0.34\n* JiffyDOS\n    * C64J\/1541:       472 -> 2.1\n* Fast Serial\n    * C128\/1571:       487 -> 2.1\n* TCBM\n    * Plus\/4, 1551:    746 -> 2.4(1.3)\n* IEEE-488\n    * IEEE-488 cart:   479 -> 2.1\n\n\n12567 cycles\n199 lines\n$ec -> $7b\n236 -> 123\n235 -> 312 -> 123\n\n# Misc\n\n* interesting historical detail:\n    * they started with a complex industry standard\n    * didn't support all use features, but allowed users to do so\n    * newer variants tried to pull over some of the unused features as well\n        * Serial supports one-to-many\n        * Serial supports device-to-device\n    * they were only slowly removed\n        * Fast Serial breaks SRQ\n        * Fast Serial breaks device-to-device for different protocol versions\n        * TCBM amnd CBDOS break device-to-device and one-to-many\n\n--><\/p>\n<div class=\"footnotes\">\n<hr\/>\n<ol>\n<li id=\"fn:1\">\n<p>The speeds have been measured by repeatedly reading the status channel of a disk drive. IEEE-488, Serial and JiffyDOS were measured on a 1 MHz C64 and Fast Serial on a C128, which executes all (Fast) Serial code in 1 MHz mode. TCBM was measured on a 1.77 MHz Plus\/4 with the screen on, which makes the effective CPU speed similar to the C64. This is the code: a9 00 20 bd ff a9 01 a2 08 a0 0f 20 ba ff 20 c0 ff a9 08 20 b4 ff a9 6f 20 96 ff a2 00 20 a5 ff 9d 00 04 e8 d0 f7 60. Both Fast Serial and JiffyDOS can reach higher speeds in the special case of loading files using custom protocols. Controller code size was measured on CBM2 for IEEE-488, on C64 for Serial and JiffyDOS, and on C128 for Fast Serial. Code sizes are approximate and do not include the LOAD and SAVE code.<a href=\"#fnref:1\" rev=\"footnote\">&#8617;<\/a><\/p>\n<\/li>\n<\/ol>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The well-known Serial Bus (aka Serial &ldquo;IEC&rdquo; Bus) of the Commodore 64 that connects to disk drives such as the 1541 is just one variant of a whole family of busses and protocols used by the line of 8 bit Commodore machines from the PET to the C65. This is the first article of a &#8230; <a title=\"Commodore Peripheral Bus: Overview\" class=\"read-more\" href=\"https:\/\/www.pagetable.com\/?p=1018\" aria-label=\"Read more about Commodore Peripheral Bus: Overview\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9,13,16],"tags":[],"class_list":["post-1018","post","type-post","status-publish","format-standard","hentry","category-commodore","category-commodore-peripheral-bus","category-floppy-disks","category-github"],"_links":{"self":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/1018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1018"}],"version-history":[{"count":0,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/1018\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}