{"id":1421,"date":"2020-08-22T10:17:36","date_gmt":"2020-08-22T08:17:36","guid":{"rendered":"https:\/\/www.pagetable.com\/?p=1421"},"modified":"2020-08-22T10:17:36","modified_gmt":"2020-08-22T08:17:36","slug":"cmdr-dos-commodore-dos-on-fat32","status":"publish","type":"post","link":"https:\/\/www.pagetable.com\/?p=1421","title":{"rendered":"CMDR-DOS: Commodore DOS on FAT32"},"content":{"rendered":"<p>All disk drives connected to the Serial Bus of a Commodore 64 speak the <a href=\"https:\/\/www.pagetable.com\/?p=1038\">Commodore DOS<\/a> protocol, from the popular 1541 5.25&#8243; drive to the modern <a href=\"https:\/\/sd2iec.de\">sd2iec<\/a> SD card interfaces. <strong>CMDR-DOS<\/strong> is a new and open source implementation of the Commodore DOS protocol, using SD cards with the FAT32 filesystem and supporting advances features like partitions, subdirectories and timestamps \u2013\u00a0and running on a 65c02!<\/p>\n<h2 id=\"commander-x16\">Commander X16<\/h2>\n<p>It is the built-in DOS of the <a href=\"https:\/\/www.commanderx16.com\">Commander X16<\/a>, and runs on the main CPU, so the KERNAL API (<code>talk<\/code>, <code>tksa<\/code>, <code>untlk<\/code>, <code>listn<\/code>, <code>secnd<\/code>, <code>unlsn<\/code>, <code>acptr<\/code>, <code>ciout<\/code>) calls directly into the DOS implementation. This allows <code>LOAD<\/code> speeds of about 140 KB\/sec on an 8 MHz system.<\/p>\n<p>Demo:<\/p>\n<p><img decoding=\"async\" src=\"docs\/cmdr-dos.gif\" alt=\"\" \/><\/p>\n<p>Transcript:<\/p>\n<pre style=\"overflow:scroll; height:200px;\"><code>DOS\"$=P\":REM THERE ARE TWO PARTITIONS ON THIS SD-CARD\n\n255 \"CMDR-DOS SD CARD\"  MBR\n1    \"PART1\"            FAT32\n2    \"PART2\"            FAT32\n\nREADY.\nDOS\"N1:SYSTEM,1616,FAT32\":REM FORMAT PARTITION 1\n\nREADY.\nDOS\"N2:DATA,1617,FAT32\":REM FORMAT PARTITION 2\n\nREADY.\nDOS\"$=P\":REM THE NEW NAMES OF THE TWO PARTITIONS\n\n255 \"CMDR-DOS SD CARD\"  MBR\n1    \"SYSTEM\"           FAT32\n2    \"DATA\"             FAT32\n\nREADY.\nDOS\"CP1\":REM SWITCH TO PARTITION 1\n\nREADY.\nDOS\"$\":REM SHOW DIRECTORY\n\n0 \"SYSTEM          \" FAT32\n99 MB FREE.\n\nREADY.\nOPEN1,8,2,\"HELLO,P,W\":PRINT#1,\"HELLO WORLD!\":CLOSE1:REM CREATE FILE\n\nREADY.\nDOS\"$\"\n\n0 \"SYSTEM          \" FAT32\n1    \"HELLO\"            PRG\n99 MB FREE.\n\nREADY.\nDOS\"C:WORLD=HELLO\":REM DUPLICATE FILE\n\nREADY.\nDOS\"$\"\n\n0 \"SYSTEM          \" FAT32\n1    \"HELLO\"            PRG\n1    \"WORLD\"            PRG\n99 MB FREE.\n\nREADY.\nDOS\"C:HELLO WORLD=HELLO,WORLD\":REM CONCATENATE FILES\n\nREADY.\nDOS\"$\"\n\n0 \"SYSTEM          \" FAT32\n1    \"HELLO\"            PRG\n1    \"WORLD\"            PRG\n1    \"HELLO WORLD\"      PRG\n99 MB FREE.\n\nREADY.\nDOS\"MD:SECRET\":REM CREATE SUBDIRECTORY\n\nREADY.\nDOS\"$\"\n\n0 \"SYSTEM          \" FAT32\n1    \"HELLO\"            PRG\n1    \"WORLD\"            PRG\n1    \"HELLO WORLD\"      PRG\n0    \"SECRET\"           DIR\n99 MB FREE.\n\nREADY.\nDOS\"$\/\/SECRET\/:\":REM SHOW SUBDIR CONTENTS\n\n0 \"SYSTEM          \" FAT32\n0    \".\"                DIR\n0    \"..\"               DIR\n99 MB FREE.\n\nREADY.\nDOS\"CD:SECRET\":REM CHANGE TO SUBDIR\n\nREADY.\nDOS\"$\"\n\n0 \"SYSTEM          \" FAT32\n0    \".\"                DIR\n0    \"..\"               DIR\n99 MB FREE.\n\nREADY.\nDOS\"C:SECRET HELLO=\/\/:HELLO\":REM COPY FILE FROM ROOT TO HERE\n\nREADY.\nDOS\"CD:_\":REM CHANGE BACK UP\n\nREADY.\nDOS\"CP2\":REM CHANGE TO PARTITION 2\n\nREADY.\nDOS\"$\n\n0 \"DATA            \" FAT32\n98 MB FREE.\n\nREADY.\nDOS\"C:DATA FILE=1\/\/SECRET\/:SECRET HELLO\":REM COPY FILE FROM PARTITION 1\n\nREADY.\nDOS\"$\n\n0 \"DATA            \" FAT32\n1    \"DATA FILE\"        PRG\n98 MB FREE.\n\nREADY.\nDOS\"$1:\":REM SHOW DIRECTORY OF PARTITION 1\n\n1 \"SYSTEM          \" FAT32\n1    \"HELLO\"            PRG\n1    \"WORLD\"            PRG\n1    \"HELLO WORLD\"      PRG\n0    \"SECRET\"           DIR\n99 MB FREE.\n\nREADY.\nDOS\"S1:H*\":REM DELETE ALL FILES THERE STARTING WITH H\n\nREADY.\nDOS:REM THIS WILL SAY THAT \"02\" FILES WERE DELETED\n01, FILES SCRATCHED,02,00\n\nREADY.\nDOS\"CP1\":REM CHANGE BACK TO PARTITION 1\n\nREADY.\nDOS\"$\n\n0 \"SYSTEM          \" FAT32\n1    \"WORLD\"            PRG\n0    \"SECRET\"           DIR\n99 MB FREE.\n\nREADY.\nDOS\"S:*\":REM DELETE ALL REMAINING FILES\n\nREADY.\nDOS:REM THIS WILL SAY THAT \"01\" FILE WAS DELETED\n01, FILES SCRATCHED,01,00\n\nREADY.\nDOS\"$\":REM THE DIRECTORY IS STILL THERE\n\n0 \"SYSTEM          \" FAT32\n0    \"SECRET\"           DIR\n99 MB FREE.\n\nREADY.\nDOS\"RD:SECRET\":REM DELETE IT\n\nREADY.\nDOS:REM \"00\" FILES DELETED, BECAUSE DIR WAS NOT EMPTY\n01, FILES SCRATCHED,00,00\n\nREADY.\nDOS\"S\/\/SECRET\/:*\":REM DELETE ALL FILES INSIDE\n\nREADY.\nDOS:REM \"01\" FILE DELETED\n01, FILES SCRATCHED,01,00\n\nREADY.\nDOS\"RD:SECRET\":REM NOW TRY DELING THE DIR AGAIN\n\nREADY.\nDOS:REM \"01\" FILES DELETED, IT WORKED THIS TIME\n01, FILES SCRATCHED,01,00\n\nREADY.\nDOS\"$\n\n0 \"SYSTEM          \" FAT32\n99 MB FREE.\n\nREADY.\nREM THAT'S IT. :)\n\nREADY.\n<\/code><\/pre>\n<h2 id=\"source\">Source<\/h2>\n<p>The implementation is part of the Commander X16 ROM and available here:<\/p>\n<p><a href=\"https:\/\/github.com\/commanderx16\/x16-rom\/tree\/master\/dos\">https:\/\/github.com\/commanderx16\/x16-rom\/tree\/master\/dos<\/a><\/p>\n<h2 id=\"future\">Future<\/h2>\n<p>The codebase is very versatile and could be reused for other kinds of projects:<\/p>\n<h3 id=\"other-new-retro-machines\">Other New Retro Machines<\/h3>\n<p>CMDR-DOS could be easily ported to other Commodore-like 65c02+ systems like the <a href=\"https:\/\/mega65.org\">MEGA65<\/a> and the <a href=\"https:\/\/www.c256foenix.com\">C256 Foenix<\/a>, providing a DOS interface to FAT32 on those platforms.<\/p>\n<h3 id=\"sd2iec-like-device\">sd2iec-like Device<\/h3>\n<p>Functionality-wise, the CMDR-DOS codebase is also very similar to what sd2iec does \u2013\u00a0minus the Commodore Serial part. It could be ported a device like the <a href=\"https:\/\/www.forum64.de\/index.php?thread\/102472-1581replica-gotek1581-1581-pc-drive-adapter\/\">1581replica<\/a>, with an SD card attached instead of a disk drive, and one would have a 65c02-based sdi2ec-like device.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>All disk drives connected to the Serial Bus of a Commodore 64 speak the Commodore DOS protocol, from the popular 1541 5.25&#8243; drive to the modern sd2iec SD card interfaces. CMDR-DOS is a new and open source implementation of the Commodore DOS protocol, using SD cards with the FAT32 filesystem and supporting advances features like &#8230; <a title=\"CMDR-DOS: Commodore DOS on FAT32\" class=\"read-more\" href=\"https:\/\/www.pagetable.com\/?p=1421\" aria-label=\"Read more about CMDR-DOS: Commodore DOS on FAT32\">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":[2,8,9,11,16,19,22,37],"tags":[],"class_list":["post-1421","post","type-post","status-publish","format-standard","hentry","category-2","category-commodore","category-commodore-peripheral-bus","category-dos","category-github","category-kernal","category-operating-systems","category-x16"],"_links":{"self":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/1421","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=1421"}],"version-history":[{"count":0,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=\/wp\/v2\/posts\/1421\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pagetable.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}