{"id":121,"date":"2012-06-30T18:36:48","date_gmt":"2012-06-30T18:36:48","guid":{"rendered":"http:\/\/retroramblings.net\/?p=121"},"modified":"2012-06-30T18:49:00","modified_gmt":"2012-06-30T18:49:00","slug":"experimenting-with-tg68-7","status":"publish","type":"post","link":"http:\/\/retroramblings.net\/?p=121","title":{"rendered":"Experimenting with TG68"},"content":{"rendered":"<p><strong>Part 7 &#8211; The Mouse!<\/strong><\/p>\n<p>After implementing a pointer-shaped sprite, I naturally just had to bring that sprite under mouse control!\u00a0 So that&#8217;s exactly what I&#8217;ve done this time round.<\/p>\n<p>The peripheral controller has expanded somewhat, and now provides three programmable timers, and two PS\/2 ports.<\/p>\n<p>Since the DE1 board only has a single PS\/2 socket, I&#8217;ve used the second socket that&#8217;s part of the Minimig joystick\/mouse adapter I posted a few weeks ago.\u00a0 (The adapter has since taken up residence in a plastic box.)<\/p>\n<p><a href=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/MouseAdapter.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-122\" title=\"MouseAdapter\" src=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/MouseAdapter.jpg\" alt=\"\" width=\"640\" height=\"426\" srcset=\"http:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/MouseAdapter.jpg 640w, http:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/MouseAdapter-300x199.jpg 300w, http:\/\/retroramblings.net\/wp-content\/uploads\/2012\/06\/MouseAdapter-450x300.jpg 450w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>The PS\/2 ports occupy a single word each, at 0x810008 and 0x81000A, respectively, and the arrival of a byte at either port triggers an interrupt.\u00a0 (The low-level PS\/2 communiciation is handled by an open-source component borrowed from the Chameleon hwtest project.)<\/p>\n<p>The timers probably deserve a little bit of explanation too.\u00a0 They&#8217;re very simple &#8211; there are four counters, t0 through t3.\u00a0 There&#8217;s a divisor register for all four counters, at 0x810010 through 0x810016, and a control word at 0x81000e which contains interrupt enable bits and status bits for counters t1 through t3.\u00a0 T0 acts as a prescalar for the other three timers, so with the system clock set to 112.5MHz, setting T0&#8217;s divisor to 1125 gives the other three timers a 100KHz base clock.<\/p>\n<p>Another major change this time is that the project no longer launches straight into the graphics test.\u00a0 Instead it boots into a simple bootrom which listens on the UART at 115,200 baud, 8N1.<\/p>\n<p>Using these settings, it&#8217;s possible to user HyperTerminal to upload an S-Record (as produced by Easy68k) into the memory.\u00a0 The Firmware directory contains a handful of test projects &#8211; the most interesting of which is FrameBufferTest.S68.\u00a0 This is essentially the old graphics test, but with the sprite under PS\/2 mouse control.<\/p>\n<p>Full source and binary is, as always, <a href=\"http:\/\/retroramblings.net\/downloads\/DE1_TG68Test_Part7_Mouse.zip\">available here for anyone who might be interested.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part 7 &#8211; The Mouse! After implementing a pointer-shaped sprite, I naturally just had to bring that sprite under mouse control!\u00a0 So that&#8217;s exactly what I&#8217;ve done this time round. The peripheral controller has expanded somewhat, and now provides three &hellip; <a href=\"http:\/\/retroramblings.net\/?p=121\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry","category-fpga"],"_links":{"self":[{"href":"http:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=121"}],"version-history":[{"count":4,"href":"http:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":125,"href":"http:\/\/retroramblings.net\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions\/125"}],"wp:attachment":[{"href":"http:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/retroramblings.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}