{"id":1214,"date":"2017-04-15T10:23:34","date_gmt":"2017-04-15T09:23:34","guid":{"rendered":"http:\/\/www.randomorbit.co.uk\/?p=1214"},"modified":"2017-04-15T10:23:34","modified_gmt":"2017-04-15T09:23:34","slug":"retrochallenge-20174-interak-cf-card-part-2","status":"publish","type":"post","link":"https:\/\/www.randomorbit.co.uk\/?p=1214","title":{"rendered":"Retrochallenge 2017\/4 \u2013 Interak CF card \u2013 Part 2"},"content":{"rendered":"<p>In <a href=\"http:\/\/www.randomorbit.co.uk\/?p=1204\">part 1<\/a> I was able to build a CF card adapter for the Interak. Mostly this involved using RC2014 parts.<\/p>\n<p>Now it&#8217;s time to tell you about the testing and things are pretty weird.<\/p>\n<h2>A bit of background.<\/h2>\n<p>At the moment, my Interak-1 has no mass storage at all. No hard drive or floppy. Nor does it have a serial port that I can connect to my PC.<\/p>\n<p>It only has cassette, screen and keyboard. This is making testing challenging.<\/p>\n<p>In <a href=\"http:\/\/www.randomorbit.co.uk\/?p=1137\">an earlier post<\/a>, I described a USB keyboard adapter that I had built during last year&#8217;s Retrochallenge. This gives me a USB keyboard. At the end of the post I mentioned adding USB serial in so that I could use a serial terminal emulator to &#8220;squirt&#8221; data at the Interak as if it had been typed in.<\/p>\n<p>I did that mod and this is the method I am using for testing because no one wants to type in a couple of hundred bytes of hex manually that may well crash.<\/p>\n<p>It has no handshaking and so I have to be careful not to send too much at once but it&#8217;s working well.<\/p>\n<h2>First steps.<\/h2>\n<p>I am following in <a href=\"http:\/\/www.smbaker.com\/z80-retrocomputing-10-rc2014-compactflash-board\">Scott Baker&#8217;s footsteps<\/a> a bit here. Scott has added CF to the RC2014 and it&#8217;s his board design I am using. He describes the process of setting up the card and reading a sector as follows&#8230;<\/p>\n<pre><strong>Setup:<\/strong>\r\nread register 7 until the busy bit (0\u00d780) is unset\r\nwrite 1 to register 1\r\nwrite 0xEF to register 7\r\nwrite 0\u00d782 to register 1\r\nwrite 0xEF to register 7\r\n0xEF is the \u201cset feature\u201d command. Feature 1 enables 8-bit mode. Feature 0\u00d782 disables any write caching. You should do this whenever the compactflash is reset or power cycled.<\/pre>\n<pre><strong>Read a sector<\/strong>\r\nread register 7 until the busy bit (0\u00d780) is unset and the ready bit (0\u00d740) is set\r\nwrite 1 to register 2, to set the sector count to one sector\r\nwrite bits 0..7 of the block address to register 3\r\nwrite bits 8..15 of the block address to register 4\r\nwrite bits 16..23 of the block address to register 5\r\ntake bits 24..27 of the block address, or them with 0xE0, and write to register 6\r\nwrite 0\u00d720 to register 7. This is the \u201cread sectors\u201d command.\r\nread port I7 until the busy bit (0\u00d780) is unset and the DRQ bit (0\u00d708) is set\r\nread 512 bytes from register 0<\/pre>\n<p>By using the PORT command (P) of Zymon 2 (the Interak&#8217;s ROM monitor) I can carry out the above instructions and it seems to work well.<\/p>\n<p>Just a note. Zymon is a little quirky and it&#8217;s not the easiest thing to follow. I can&#8217;t put blank lines in for clarity, they get ignored. Also, the P command reads from (no parameter) or writes to (one parameter) an I\/O port. However, if I type, for example &#8220;P 67&#8221; to read the status byte on the CF card, Zymon puts the byte on the same line making it impossible to see whether or not I wrote to the port or read from it.<\/p>\n<p><a href=\"http:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2017\/04\/170415-IMG_20170415_095947.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-1215\" src=\"http:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2017\/04\/170415-IMG_20170415_095947-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2017\/04\/170415-IMG_20170415_095947-300x225.jpg 300w, https:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2017\/04\/170415-IMG_20170415_095947-768x576.jpg 768w, https:\/\/www.randomorbit.co.uk\/wordpress\/wp-content\/uploads\/2017\/04\/170415-IMG_20170415_095947-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>In this photo I set up the card ending with the line &#8220;P 67 EF&#8221;. I then do the read (up to line &#8220;P 67 20&#8221;). I get the status with &#8220;P 67&#8221;, the result is &#8220;58&#8221; &#8211; Drive ready + Drive seek complete + Data request read.<\/p>\n<p>The, the following &#8220;P 60&#8243;s show data being read from the first sector of the drive.<\/p>\n<p>Yea!<\/p>\n<p>Now the weird. I have tried doing this using a bit of assembler code and it doesn&#8217;t work.<\/p>\n<p>I&#8217;ll put the full details in my next post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In part 1 I was able to build a CF card adapter for the Interak. Mostly this involved using RC2014 parts. Now it&#8217;s time to tell you about the testing and things are pretty weird. A bit of background. At the moment, my Interak-1 has no mass storage at all. No hard drive or floppy. &hellip; <a href=\"https:\/\/www.randomorbit.co.uk\/?p=1214\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Retrochallenge 2017\/4 \u2013 Interak CF card \u2013 Part 2<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[47,122,33,125],"tags":[],"class_list":["post-1214","post","type-post","status-publish","format-standard","hentry","category-c93-blog-posts","category-interak","category-c84-retro-tech","category-retrochallenge-20174"],"featured_image_src":null,"author_info":{"display_name":"andy","author_link":"https:\/\/www.randomorbit.co.uk\/?author=1"},"_links":{"self":[{"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1214"}],"version-history":[{"count":1,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1214\/revisions"}],"predecessor-version":[{"id":1216,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1214\/revisions\/1216"}],"wp:attachment":[{"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.randomorbit.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}