<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
>

<channel>
	<title>KwartzLab Makerspace &#187; Member Blogs</title>
	<atom:link href="http://www.kwartzlab.ca/category/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kwartzlab.ca</link>
	<description>Home of Kwartzlab Makerspace in Kitchener/Waterloo, Ontario</description>
	<lastBuildDate>Sun, 19 May 2013 23:30:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
<!-- podcast_generator="Blubrry PowerPress/4.0.7" -->
	<itunes:summary>Regular discussions with hackers, makers and artists at the Kwartzlab Makerspace. We talk about what projects people are working on, what events are coming up and how you can get involved.</itunes:summary>
	<itunes:author>kwartzlab</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.kwartzlab.ca/wp-content/uploads/powerpress/light_box_logo.jpg" />
	<itunes:owner>
		<itunes:name>kwartzlab</itunes:name>
		<itunes:email>podcast@kwartzlab.ca</itunes:email>
	</itunes:owner>
	<managingEditor>podcast@kwartzlab.ca (kwartzlab)</managingEditor>
	<itunes:subtitle>A hackerspace radio show</itunes:subtitle>
	<itunes:keywords>kwartzlab, hackerspace, makerspace, diy, hardware, software, maker, hacker, artist, roundtable</itunes:keywords>
	<image>
		<title>KwartzLab Makerspace &#187; Member Blogs</title>
		<url>http://www.kwartzlab.ca/wp-content/uploads/powerpress/light_box_logo.jpg</url>
		<link>http://www.kwartzlab.ca/category/blog/</link>
	</image>
	<itunes:category text="Technology" />
	<itunes:category text="Arts" />
	<itunes:category text="Games &amp; Hobbies">
		<itunes:category text="Hobbies" />
	</itunes:category>
		<rawvoice:location>Kitchener, ON</rawvoice:location>
		<item>
		<title>First Glimpse into the Soul of a Tamagotchi</title>
		<link>http://www.kwartzlab.ca/2013/05/first-glimpse-soul-tamagotchi/</link>
		<comments>http://www.kwartzlab.ca/2013/05/first-glimpse-soul-tamagotchi/#comments</comments>
		<pubDate>Sun, 19 May 2013 19:36:05 +0000</pubDate>
		<dc:creator>Natalie Silvanovich</dc:creator>
				<category><![CDATA[Member Blogs]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3585</guid>
		<description><![CDATA[I dumped the ROM of a Tamagotchi using the code execution ability I posted previously.  I wrote 6502 code that dumped each byte of the memory space of the Tamagotchi, and output it over port A (which is usually the Tamagotchi button input) via SPI. It would have been more convenient to dump the ROM [...]]]></description>
				<content:encoded><![CDATA[<p>I dumped the ROM of a Tamagotchi using the code execution ability I <a href="http://www.kwartzlab.ca/2013/05/code-execution-tamagotchi/">posted previously</a>.  I wrote 6502 code that dumped each byte of the memory space of the Tamagotchi, and output it over port A (which is usually the Tamagotchi button input) via SPI.</p>
<div id="attachment_3587" class="wp-caption aligncenter" style="width: 235px"><a href="http://www.kwartzlab.ca/2013/05/first-glimpse-soul-tamagotchi/porta-2/" rel="attachment wp-att-3587"><img class="size-medium wp-image-3587 " alt="Writing out the in port will likely shorten this Tamagotchi's lifespan. Sometimes Tamagotchis must suffer in the pursuit of science" src="http://www.kwartzlab.ca/wp-content/uploads/2013/05/porta1-225x400.jpg" width="225" height="400" /></a><p class="wp-caption-text">Writing out the in port will likely shorten this Tamagotchi&#8217;s lifespan. Oh well &#8230;</p></div>
<p><span id="more-3585"></span></p>
<p>It would have been more convenient to dump the ROM via IR or the SPI ports at the top of the Tamagotchi, but unfortunately, I don&#8217;t have any information on how to write to those ports. There is an application note describing how to write to port A on the General Plus site, though.</p>
<p>I started by dumping the entire memory space, from 0&#215;0000 to 0xffff, which included all mapped memory, such as ROM, RAM and ports. This only dumped some of the ROM, though, as the GPLB52x microcontroller supports paging outside of 6502 paging. The first 16 kilobytes of the ROM are always mapped to 0xc000-0xffff, and then the rest of the ROM is split into 19 pages that can be mapped to 0&#215;4000-0xbfff as needed. To dump the entire ROM, I needed to figure out how to page.</p>
<p>Loading oxc000-0xffff into IDA, it became apparent how to page pretty quickly.</p>
<div id="attachment_3596" class="wp-caption aligncenter" style="width: 630px"><a href="http://www.kwartzlab.ca/2013/05/first-glimpse-soul-tamagotchi/code-3/" rel="attachment wp-att-3596"><img class=" wp-image-3596  " alt="Tamagotchi startup code (0xcc00 is the reset vector)" src="http://www.kwartzlab.ca/wp-content/uploads/2013/05/code1.png" width="620" height="378" /></a><p class="wp-caption-text">Tamagotchi startup code (0xcc00 is the reset vector)</p></div>
<p>The address 0&#215;3000 was written to quite often before jumps, and there were several subroutines that pushed and restored this value before jumping to another subroutine. Trying this in my dumping code, I was able to dump the entire ROM!</p>
<p>Doing a quick analysis, pages 0 through 6 appear to be code, pages 7, 8 and 9 are empty, pages 11-18 contain image data, page 10 contains some image data and some other data and I&#8217;m not sure what 19 contains (if I had to guess it would probably be audio).</p>
<p>Decoding the image data, you can already find out some interesting things. For example, here&#8217;s some of the images from page 18:</p>
<div id="attachment_3590" class="wp-caption aligncenter" style="width: 681px"><a href="http://www.kwartzlab.ca/2013/05/first-glimpse-soul-tamagotchi/p18pics/" rel="attachment wp-att-3590"><img class=" wp-image-3590  " alt="Pictures from page 18" src="http://www.kwartzlab.ca/wp-content/uploads/2013/05/p18pics.png" width="671" height="314" /></a><p class="wp-caption-text">Pictures from page 18 (click to see full size)</p></div>
<p>In blue are all the possible Tamagotchi characters you can get on the Tama-Go! And in red below are the images from the factory test program, one of which I&#8217;ve never seen before, suggesting that there&#8217;s features of this program that haven&#8217;t been found yet.</p>
<p>For the Tamagotchi fans in the room, I&#8217;ve posted all the images I dumped <a href="https://github.com/natashenka/Tamagotchi-Hack/tree/master/codedump/images">here</a>. I&#8217;ll be posting the rest of the code as I make sense of it.</p>
<p>In the mean time, here are some of the cuter highlights of the ROM dump.</p>
<p><a href="http://www.kwartzlab.ca/2013/05/first-glimpse-soul-tamagotchi/cute/" rel="attachment wp-att-3591"><img class="aligncenter size-full wp-image-3591" alt="" src="http://www.kwartzlab.ca/wp-content/uploads/2013/05/cute.png" width="153" height="74" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/05/first-glimpse-soul-tamagotchi/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>Code Execution on a Tamagotchi</title>
		<link>http://www.kwartzlab.ca/2013/05/code-execution-tamagotchi/</link>
		<comments>http://www.kwartzlab.ca/2013/05/code-execution-tamagotchi/#comments</comments>
		<pubDate>Tue, 07 May 2013 04:34:16 +0000</pubDate>
		<dc:creator>Natalie Silvanovich</dc:creator>
				<category><![CDATA[Member Blogs]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3529</guid>
		<description><![CDATA[I achieved arbitrary code execution on a Tamagotchi using a bug in figure ROM processing. This capability should allow me to dump the Tamagotchi code ROM after some analysis, as well as allow me to &#8216;hack&#8217; my Tamagotchi using the full capabilities of the microprocessor. I mentioned in an earlier post that I saw some &#8216;freezing&#8217; behaviour [...]]]></description>
				<content:encoded><![CDATA[<p>I achieved arbitrary code execution on a Tamagotchi using a bug in figure ROM processing. This capability should allow me to dump the Tamagotchi code ROM after some analysis, as well as allow me to &#8216;hack&#8217; my Tamagotchi using the full capabilities of the microprocessor.</p>
<div id="attachment_3530" class="wp-caption aligncenter" style="width: 338px"><a href="http://www.kwartzlab.ca/2013/05/code-execution-tamagotchi/yay/" rel="attachment wp-att-3530"><img class="size-full wp-image-3530" alt="Hip hip horray!!" src="http://www.kwartzlab.ca/wp-content/uploads/2013/05/yay.png" width="328" height="320" /></a><p class="wp-caption-text">Hip hip hooray!!</p></div>
<p><span id="more-3529"></span></p>
<p>I mentioned in an <a href="http://www.kwartzlab.ca/2013/01/tama-go-rom-format/">earlier post</a> that I saw some &#8216;freezing&#8217; behaviour in the figure game functionality. Game logic is controlled in its entirety by a single bit &#8216;game code&#8217;, which I suspected was the index of a jump table containing all Tamagotchi functionality, and invalid game codes, especially those in the middle of the 0-255 range cause the Tamagotchi to freeze, requiring reset.</p>
<p>Looking into how 6502 (the Tamagotchi microcontroller architecture) works, I thought this might be a sign that the microcontroller was veering off into unexpected code.  Memory in 6502 is mapped into a single address space, and there&#8217;s no MMU or other memory protection. If unmapped memory is accessed, it returns 0 or some other garbage value. Invalid instructions do not cause a reset, but execute undefined behaviour taking a non-deterministic amount of time. This meant that freezing was unlikely to be due to an error being detected by the microcontroller (of course, it was possible that an error was being detected by the code on the microcontroller, and it handled the error by going into a tight loop, but this struck me as unlikely, as the Tamagotchi tends to handle detected errors by resetting). It also meant that exploiting a bug in 6502 should be reasonably forgiving,  as  if the PC ends up somewhere before the intended address, it will likely execute any garbage instructions in sequence, and end up at the right address anyhow.</p>
<p>My first thought was that maybe the invalid &#8220;game codes&#8221; corresponded to indexes outside of the jump table, so the microcontroller was jumping to addresses that were actually other data. Since LCD RAM is the only memory that can be controlled by a figure, I was hoping that maybe one of these values would cause a jump into LCD RAM. So   I filled up my LCD with a NOP slide and shell code and hoped.</p>
<div id="attachment_3531" class="wp-caption aligncenter" style="width: 624px"><a href="http://www.kwartzlab.ca/2013/05/code-execution-tamagotchi/s/" rel="attachment wp-att-3531"><img class=" wp-image-3531 " alt="Shellcode works better when and annoying Tamagotchi doesn't stand in front of it" src="http://www.kwartzlab.ca/wp-content/uploads/2013/05/s.jpg" width="614" height="614" /></a><p class="wp-caption-text">Shellcode works better when an annoying Tamagotchi doesn&#8217;t stand in front of it</p></div>
<p>I tried all 255 indexes, but none of them worked. I did notice two interesting things, though. First, the indexes in the middle of the range weren&#8217;t all invalid. Some of them showed valid screens, although these screens didn&#8217;t always work. This meant that I probably wasn&#8217;t jumping to an unintended address, but something else was happening to cause freezing, such as the stack wasn&#8217;t set up correctly for the jump. Secondly, the index 0xCC had some interesting behaviour. If bit 3 of the 68th byte in the LCD RAM was set, it played a repeated beeping, and would detect when the figure was removed, and return to the main screen. If this bit wasn&#8217;t set, it would play no sound, and freeze. Based on the sound, I guessed that this was the location the Tamagotchi jumps to when playing a sound when a key is pressed. So the logic would be &#8220;check if sound is enabled (probably based on an address on the stack), and if set play the sound and return to the address on the stack otherwise return to  a different address on the stack&#8221;. Except the stack was messed up, so it was checking the LCD RAM for the bit, and returning to the address where it started instead of the correct address.</p>
<p>I found this perplexing. Considering that this behavior confirmed that pointers to the LCD RAM were being put on the stack before the jump, I found it surprising that none of the  255 possibilities were causing code execution. Eventually, I suspected my shellcode might be wrong. Since I have no sample microcontroller to test code on, and don&#8217;t know the locations of the ports, I thought this was likely. My original code was supposed to flash the IR LED, but I moved to the less ambition jumping to reset (since practically nothing will reset a 6502 microcontroller, this would be a good indicator of code execution). I also checked my code with the SunPlus compiler. And found I was using entirely the wrong instruction set. With the right instruction to byte value mapping, the Tamagotchi reset on the third &#8220;game code&#8221; I tried, 0xd4.</p>
<p>Playing with different instructions, I found the code execution was very unreliable, especially when calling longer instructions like stores and loads. Eventually, I figured out that the Tamagotchi LCD does not use one contiguous piece of LCD RAM, but uses at least two separate pieces. Jumping to one of these locations immediately after starting execution made it much more reliable.</p>
<p>Below is an example of changing the LCD using stores and loads. The area circled in blue is the first code that gets executed, and the area circled in green is the code in the contiguous memory it jumps to. The white boxes (circled in red) are the contiguous pieces of memory, set to be white using STA. The entire row is part of the memory, but I only set one byte (four pixels) per row.</p>
<div id="attachment_3532" class="wp-caption aligncenter" style="width: 539px"><a href="http://www.kwartzlab.ca/2013/05/code-execution-tamagotchi/circles/" rel="attachment wp-att-3532"><img class=" wp-image-3532   " alt="Yes, I'm aware this is the lamest POC ever" src="http://www.kwartzlab.ca/wp-content/uploads/2013/05/circles.jpg" width="529" height="529" /></a><p class="wp-caption-text">Yes, I&#8217;m aware this is the lamest POC ever</p></div>
<p>For people trying this at home, the LCD RAM locations so far are:</p>
<p>Rows 1-7: 0x10cc-0&#215;1107</p>
<p>Rows 8-18: 0&#215;1120-0x117C</p>
<p>Row 17: 0x10B4-0x10CB</p>
<p>Row 18-31: ???</p>
<p>Next step: chain this together to dump the code!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/05/code-execution-tamagotchi/feed/</wfw:commentRss>
		<slash:comments>77</slash:comments>
		</item>
		<item>
		<title>Call for Makers</title>
		<link>http://www.kwartzlab.ca/2013/03/call-makers/</link>
		<comments>http://www.kwartzlab.ca/2013/03/call-makers/#comments</comments>
		<pubDate>Thu, 28 Mar 2013 22:52:21 +0000</pubDate>
		<dc:creator>markp</dc:creator>
				<category><![CDATA[Member Blogs]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3484</guid>
		<description><![CDATA[Are you or your organization doing something awesome with technology, art, crafts, science, food, or music? Show it off at the Waterloo Maker Faire on Saturday June 15th at Kitchener City Hall! Any groups or individuals interested in participating should complete the simple application at http://makerfairewaterloo.com/ by the end of April.]]></description>
				<content:encoded><![CDATA[<p>Are you or your organization doing something awesome with technology, art, crafts, science, food, or music? Show it off at the Waterloo Maker Faire on Saturday June 15th at Kitchener City Hall!</p>
<p><a href="http://www.kwartzlab.ca/wp-content/uploads/2013/03/WMMF-CallForMakers.png"><br />
<img class="aligncenter size-medium wp-image-3485" alt="WMMF-CallForMakers" src="http://www.kwartzlab.ca/wp-content/uploads/2013/03/WMMF-CallForMakers-400x400.png" width="400" height="400" /><br />
</a></p>
<p>Any groups or individuals interested in participating should complete the simple application at <a title="makerfairewaterloo.com" href="http://makerfairewaterloo.com">http://makerfairewaterloo.com/</a> by the end of April.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/03/call-makers/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Reflections on my first Serious Teaching Experience</title>
		<link>http://www.kwartzlab.ca/2013/03/reflections-my-first-serious-teaching-experience/</link>
		<comments>http://www.kwartzlab.ca/2013/03/reflections-my-first-serious-teaching-experience/#comments</comments>
		<pubDate>Sat, 23 Mar 2013 03:11:40 +0000</pubDate>
		<dc:creator>singpolyma</dc:creator>
				<category><![CDATA[Member Blogs]]></category>
		<category><![CDATA[education]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3479</guid>
		<description><![CDATA[This article is cross-posted It&#8217;s no secret that I&#8217;m not impressed with the current state of University education. I&#8217;ve spent a long time griping about the various issues, and pointing out ways I would do it differently. None of that makes any difference, however, until I actually do something about it. While my issues are [...]]]></description>
				<content:encoded><![CDATA[<p><strong>This article is <a href="https://singpolyma.net/2013/03/reflections-on-my-first-serious-teaching-experience/">cross-posted</a></strong></p>
<p>It&#8217;s no secret that I&#8217;m <a href="https://singpolyma.net/2008/10/on-universities/">not impressed with the current state of University education</a>.  I&#8217;ve spent a long time griping about the various issues, and pointing out ways I would do it differently.  None of that makes any difference, however, until I actually do something about it.</p>
<p>While my issues are with post-secondary education generally, my primary expertise (especially of late) is in <a href="http://en.wikipedia.org/wiki/Computer_science">Computer Science</a> and <a href="http://en.wikipedia.org/wiki/Software_development">Software development</a>.  So, I developed <a href="https://github.com/singpolyma/cs-top-and-bottom">a curriculum</a>, found <a href="http://kwartzlab.ca">a community</a>, and started teaching a class.</p>
<p>Teaching one class does not constitute a solution, but it <em>does</em> provide a learning experience for me.  The class is over half done now, and in the rest of this post I will be examing things I have tried and what I have learned.</p>
<h2>Hands-on Learning</h2>
<p>Since my approach is focused entirely on education, I did not assign any exercizes early on.  I provided students with the tools needed to play with the concepts on their own, and set them free to hack.  This turned out to be <strong>too open-ended</strong>.  When encountering a new concept for the first time, many students simply had no concept of what direction they should take their explorations in.</p>
<p>I am now providing some concrete exercizes to the students, but really I need to find a way to integrate more hands-on learning into the class itself.  This is made more difficult because of the pacing I chose for this version.</p>
<h2>Pacing</h2>
<p>Probably the biggest experiment in this first version of the course is the pacing I am using.  The class is an overview of Computer Science from both the perspective of functional abstractions and low-level machine implementation.  It is designed to give students a flavour of what parts of Computer Science they might find interesting for further study.  I am doing the whole thing in <strong>8 weeks</strong>.</p>
<p>The amount of material I am covering would normally be covered in two or more <em>semesters</em> at a University.  Why am I doing this?  For two reasons: so that students have less time to get bogged down on individual details (since, as an overview course, this is not about depth), and also to find out how fast one can reasonably progress without hopelessly confusing students.</p>
<p>While I cannot be sure without more experiments, I am also beginning to suspect that the pacing <em>increases</em> student engagement (at least for the sorts of students I have solicited).  New material every single class means that students do not have an opportunity to tune out because &#8220;we already talked about this&#8221;.</p>
<p>While the pacing is definitely hurting the students&#8217; ability to deeply absorb the subject matter, I conduct informal experiments periodically to determine understanding.  Students in general seem to be grasping concepts, and find themselves coming back up to speed on items they failed to retain quickly enough to demonstrate a level of penetration.</p>
<h2>Students</h2>
<p>For this course, primarily because of the pacing, I solicited students with prior knowledge of computer internals and programming.  I started out with a good mix of students from various backgrounds, but certain students (about half of the 10 I started with) dropped the course fairly early on.</p>
<p>Students who stuck with the course were precisely those students who had both enough knowledge of computer internals to handle the pace, and enough of a deficiency in prior experience with Computer Science-related material to be interested in an overview.  I hope to run both slower and more in-depth courses in the future in order to serve other sorts of students.</p>
<p>While prior knowledge of the basics seems to be helping the students&#8217; ability to comprehend new material, it also occassionally poses a distraction, since I cannot present any idea as strictly new.  I need to improve my ability to communicate an idea that is &#8220;new&#8221; in the context of a course, without speaking as though no one present has ever heard of it before.</p>
<h2>From the Top and Bottom</h2>
<p>The concept of my particular curriculum for this course is to start at the &#8220;most&#8221; abstract and &#8220;most&#8221; machine-specific concepts, and work inward.  This is in stark contrast to most first-year Computer Science courses, which start out in practical programming, move on to machine specifics, and then later on do algorithms and (maybe) more abstract (actual) Computer Science.</p>
<p>Students have indeed struggled with the seemingly-abstract concepts, especially early on when they may not yet even have a basis on which to understand &#8220;why they care&#8221; about the abstractions that are possible.  This is partly because of my failure to spur adequate hands-on learning, and partly because of the ordering.  On the other hand, the juxtaposition of abstractions and related implementation details has already more than once resulted in realizations about the nature of the abstractions (&#8220;that product type is just like a struct!&#8221;)</p>
<h2>Next Steps</h2>
<p>I still have to finish teaching this class, and will report more at that time.  Some of my students (and also other members of the Kwartzlab community) have expressed interest in an Operating Systems implementation course, based on my <a href="https://singpolyma.net/category/singpolyma-kernel/">Writing a Simple OS Kernel</a> series of posts.  I hope to run this course mid-summer, and structure it purely as a project course.  This should give me more experience with the ways that hands-on learning can be effectively brought directly into a class.</p>
<p>I am also excited about the idea of running other more in-depth courses, based on community interest.  From a &#8220;Computer Science for Programmers&#8221; side I would like to run a course I&#8217;m calling &#8220;Advance Abstractions&#8221; (dealing with advanced concepts in control flow and data modelling) and also a non-course structured as various talks by various contributors on specific data structures and algorithms.</p>
<p>I would also like to run the &#8220;slow version&#8221; of this same course, targetted at complete beginners.  The problem with this version is that it requires participants to have more time to dedicate to the course.  We&#8217;ll see where that goes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/03/reflections-my-first-serious-teaching-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Satellite in the Shed at KI-X</title>
		<link>http://www.kwartzlab.ca/2013/03/satellite-shed-ki-x/</link>
		<comments>http://www.kwartzlab.ca/2013/03/satellite-shed-ki-x/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 00:42:08 +0000</pubDate>
		<dc:creator>Darcy Casselman</dc:creator>
				<category><![CDATA[Member Blogs]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3471</guid>
		<description><![CDATA[The Knowledge Integration eXhibit is running this week at the University of Waterloo. One of the exhibits, Satellite in the Shed, discusses the history and significance of the DIY movement and what it means for the resilience of our society. The exhibit includes and interview by our own Robert &#8220;Gus&#8221; Gissing and photos of the [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/flyingsquirrel/8552382424/" title="satellite in the shed by flying squirrel, on Flickr"><img src="https://farm9.staticflickr.com/8392/8552382424_8c0fd9ec01.jpg" width="500" height="375" alt="satellite in the shed"></a></p>
<p>The <a href="https://uwaterloo.ca/knowledge-integration/events/knowledge-integration-exhibition-2013">Knowledge Integration eXhibit</a> is running this week at the University of Waterloo.  One of the exhibits, <a href="https://satelliteintheshed.wordpress.com/">Satellite in the Shed</a>, discusses the history and significance of the DIY movement and what it means for the resilience of our society.</p>
<p><a href="http://www.flickr.com/photos/flyingsquirrel/8552412457/" title="IMG_2454 by flying squirrel, on Flickr"><img src="https://farm9.staticflickr.com/8380/8552412457_48d21c8a12.jpg" width="500" height="375" alt="IMG_2454"></a></p>
<p>The exhibit includes and interview by our own <a href="http://www.kwartzlab.ca/author/Gus/">Robert &#8220;Gus&#8221; Gissing</a> and photos of the works of Bernie Rohde.</p>
<p>It also includes other cool projects, like a <a href="https://satelliteintheshed.wordpress.com/2013/03/05/exercise-bike/">a homemade exercise bike</a>, a video game controller and a <a href="https://satelliteintheshed.wordpress.com/2013/03/04/haptic-wrist-rangefinder-pt-2-bits-pieces-2/">haptic rangefinder glove</a>.</p>
<p><a href="http://www.flickr.com/photos/flyingsquirrel/8553516664/" title="IMG_2455 by flying squirrel, on Flickr"><img src="https://farm9.staticflickr.com/8391/8553516664_2a0741d699.jpg" width="500" height="375" alt="IMG_2455"></a></p>
<p><a href="http://www.flickr.com/photos/flyingsquirrel/8552413327/" title="IMG_2461 by flying squirrel, on Flickr"><img src="https://farm9.staticflickr.com/8107/8552413327_68ca50b53c.jpg" width="500" height="375" alt="IMG_2461"></a></p>
<p>The exhibit only runs one more day, Wednesday, March 12, noon to 6pm.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/03/satellite-shed-ki-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tamagotchi Sound (or Why Tamagotchi &#8220;Gangnam Style&#8221; is Techinically Infeasible)</title>
		<link>http://www.kwartzlab.ca/2013/03/tamagotchi-sound-or-why-tamagotchi-gangnam-style-techinically-infeasible/</link>
		<comments>http://www.kwartzlab.ca/2013/03/tamagotchi-sound-or-why-tamagotchi-gangnam-style-techinically-infeasible/#comments</comments>
		<pubDate>Mon, 04 Mar 2013 05:25:27 +0000</pubDate>
		<dc:creator>Natalie Silvanovich</dc:creator>
				<category><![CDATA[Member Blogs]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3429</guid>
		<description><![CDATA[I looked into the sound capabilities of Tamagotchi items. Unfortunately, while the hardware seems able to play a wide range of notes at different volumes, this functionality is not available through the figure. As I mentioned in my previous post, figure &#8216;items&#8217; are implemented using byte code with six byte instructions. One particular instruction, starting [...]]]></description>
				<content:encoded><![CDATA[<p>I looked into the sound capabilities of Tamagotchi items. Unfortunately, while the hardware seems able to play a wide range of notes at different volumes, this functionality is not available through the figure.</p>
<div id="attachment_3432" class="wp-caption aligncenter" style="width: 539px"><a href="http://www.kwartzlab.ca/2013/03/tamagotchi-sound-or-why-tamagotchi-gangnam-style-techinically-infeasible/img_00000334/" rel="attachment wp-att-3432"><img class=" wp-image-3432  " alt="IMG_00000334" src="http://www.kwartzlab.ca/wp-content/uploads/2013/03/IMG_00000334.jpg" width="529" height="529" /></a><p class="wp-caption-text">Tamagotchi Sound</p></div>
<p><span id="more-3429"></span></p>
<p>As I mentioned in my <a title="Tamagotchi Items" href="http://www.kwartzlab.ca/2013/02/tamagotchi-items/">previous post</a>, figure &#8216;items&#8217; are implemented using byte code with six byte instructions. One particular instruction, starting with 0xFEFF controls sound.</p>
<p>The first two bytes of the instruction are always the same, and are likely used to identify it, while the last three bytes are always zero (I checked all the figure dumps I have so far to check this). This leaves one byte to identify the sound. I tried changing this value, and found that it cause the Tamagotchi to play different complete sounds. For example, one value caused the Tamagotchi to beep once, while another code caused it to play &#8220;Yankee Doodle&#8221; in it&#8217;s entirety. Values 0-0&#215;30(ish) played sounds that the Tamagotchi normally plays while running, such as the reset noise and the call noise. Values 0&#215;30-0&#215;52 played a wealth of public-domain music, ranging from &#8220;Fur-Elise&#8221; to &#8220;La Cucaracha&#8221; to &#8220;The Turkey in the Straw&#8221;. After that, codes 0&#215;53-0x5f played a C-major scale. These are all the notes that are available for custom sound.</p>
<p>This is problematic in two ways. First, there are no sharps or flats, so a Tamagotchi figure can only play music that is playable on a major scale. This means that Tamagotchis are unable to dance to many popular tunes, including &#8220;Gangnam Style&#8221; and &#8220;The Macarena&#8221;. This isn&#8217;t a hardware limitation, as these notes are used in some of the complete songs the figure can play, but the functionality hasn&#8217;t been built into the figure.</p>
<p>The other difficulty is timing. The sound instruction does not contain any timing information. Instead, sound timing relies on the delays in image instructions. A sound instruction will not play until the delay in the pre-ceding image instruction is complete, and it will play until the next sound instruction is encountered (there may be several image delays in the mean time). If the sound is not yet complete, it will be interrupted, and not finish playing. There is no other way to change the timing of the sound.</p>
<p>This also means that there is no way to &#8216;hold&#8217; notes. I tried doing this by repeating notes with a very short delay, but there was no delay that would make the notes play cleanly without &#8220;buzzing&#8221; due to short breaks in the note. The sound is still reasonable, though. To decrease the delay, and get even better (but not perfect sound), I had the Tamagotchi load a one pixel image during delays, which reduced the inherent delay due to image loading, and the larger image was still visible, except in the one pixel.</p>
<p>This allowed me to create a music video starring my Tamagotchi, albeit one with limited notes and sound quality. A helpful member of <a href="http://www.pokemon-mini.net/">pmdev</a> suggested I do &#8220;Mad World&#8221;, as it can be played with only the notes available.</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='640' height='390' src='http://www.youtube.com/embed/mkYEP0Tt0U4?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0'></iframe></span></p>
<p>This song perfectly sums up the angst of being unable to dance &#8220;Gangnam Style&#8221;. All the more motivation to get code execution!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/03/tamagotchi-sound-or-why-tamagotchi-gangnam-style-techinically-infeasible/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tamagotchi Items</title>
		<link>http://www.kwartzlab.ca/2013/02/tamagotchi-items/</link>
		<comments>http://www.kwartzlab.ca/2013/02/tamagotchi-items/#comments</comments>
		<pubDate>Mon, 25 Feb 2013 06:48:02 +0000</pubDate>
		<dc:creator>Natalie Silvanovich</dc:creator>
				<category><![CDATA[Member Blogs]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3380</guid>
		<description><![CDATA[The one feature of Tamagotchi figures I haven&#8217;t looked at yet is items. When a figure is attached, Tamagotchis can buy items at shops and use them. Items vary vastly in what they can do, from headphones that cause your Tamagotchi to dance around in headphones until you remove the figure to refrigerators that make [...]]]></description>
				<content:encoded><![CDATA[<p>The one feature of Tamagotchi figures I haven&#8217;t looked at yet is items. When a figure is attached, Tamagotchis can buy items at shops and use them. Items vary vastly in what they can do, from headphones that cause your Tamagotchi to dance around in headphones until you remove the figure to refrigerators that make your Tamagotchi less hungry when they eat from them to vacations that show a clip of your Tamagotchi seeing the sights.</p>
<div id="attachment_3381" class="wp-caption aligncenter" style="width: 490px"><a href="http://www.kwartzlab.ca/2013/02/tamagotchi-items/im-240/" rel="attachment wp-att-3381"><img class="size-full wp-image-3381 " alt="USA Tour Item" src="http://www.kwartzlab.ca/wp-content/uploads/2013/02/im-240.bmp" width="48" height="31" /></a><p class="wp-caption-text">I took my Tamagotchi to see the statue of Lincoln. What did you do for your Tamagotchi today?</p></div>
<p><span id="more-3380"></span> Fortunately, the second wave of Tamagotchi figures contain flash, instead of mask ROM, so I was able to program a figure directly.</p>
<div id="attachment_3383" class="wp-caption aligncenter" style="width: 539px"><a href="http://www.kwartzlab.ca/2013/02/tamagotchi-items/img_00000298/" rel="attachment wp-att-3383"><img class=" wp-image-3383" title="Wave Two Figure Base" alt="Wave Two Figure Base" src="http://www.kwartzlab.ca/wp-content/uploads/2013/02/IMG_00000298.jpg" width="529" height="529" /></a><p class="wp-caption-text">Ignore the wire, these can be reprogrammed without modification</p></div>
<p style="text-align: left">I attached wires to a Tamagotchi case, and used my Arduino to reprogram the flash.</p>
<p style="text-align: center"><a href="http://www.kwartzlab.ca/2013/02/tamagotchi-items/img_00000300/" rel="attachment wp-att-3384"><img class="aligncenter  wp-image-3384" alt="Flash Programmer" src="http://www.kwartzlab.ca/wp-content/uploads/2013/02/IMG_00000300.jpg" width="529" height="529" /></a></p>
<p style="text-align: left">This made testing the figure ROM format much easier, as the flash was much less finicky than my flash-simulation rig, and I could use the figure on any Tamagotchi, not just one with the lines broken out.</p>
<p style="text-align: left">After _much_ testing, I figured out that items are implemented using an interpreted byte code. Each &#8216;instruction&#8217; is 6 bytes long. The format is as follows:</p>
<table width="663" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align: left" valign="top" width="209"><strong>Byte</strong></td>
<td valign="top" width="454"><strong>Comment</strong></td>
</tr>
<tr>
<td valign="top" width="209">0</td>
<td valign="top" width="454">This byte contains the &#8216;address&#8217; of what is being loaded</p>
<ul>
<li>The number of the image to be loaded (starting with the first item image), for an image</li>
<li>The number of the sprite to be loaded for a sprite</li>
<li>0xFE for a sound</li>
</ul>
</td>
</tr>
<tr>
<td valign="top" width="209">1</td>
<td valign="top" width="454">This byte contains the type of what is being loaded. Why it isn&#8217;t at byte 0, I have no idea</p>
<ul>
<li>0&#215;80 for an image</li>
<li>0&#215;00 for the sprite</li>
<li>0xFF for a sound</li>
</ul>
</td>
</tr>
<tr>
<td valign="top" width="209">2</td>
<td valign="top" width="454">This byte contains data based on the type</p>
<ul>
<li>The sound code for a sound</li>
<li>The x co-ordinate of an image or sprite</li>
</ul>
</td>
</tr>
<tr>
<td valign="top" width="209">3</td>
<td valign="top" width="454">This byte contains data based on the type</p>
<ul>
<li>0&#215;00 for a sound</li>
<li>The y co-ordinate of an image or sprite</li>
</ul>
</td>
</tr>
<tr>
<td valign="top" width="209">4</td>
<td valign="top" width="454">This byte contains data based on the type</p>
<ul>
<li>0&#215;00 for a sound</li>
<li>Unknown (but used) for an image or sprite</li>
</ul>
</td>
</tr>
<tr>
<td style="text-align: left" valign="top" width="209">5</td>
<td valign="top" width="454">This byte contains data based on the type</p>
<ul>
<li>0&#215;00 for a sound</li>
<li>The amount of time an image or sprite will be displayed</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p style="text-align: left">This isn&#8217;t comprehensive, there are still a few functions I am not sure how to do. For example, some items will give the Tamagotchi points or make them less hungry. There are likely different types for these. That said, this info was enough to make my Tamagotchi do the Harlem Shake:</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='640' height='390' src='http://www.youtube.com/embed/L8eQYCVnROA?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0'></iframe></span></p>
<p style="text-align: left">The audio on the video is a bit off, though, and this is due to limitations on the audio capabilities of the bytecode format (but not that Tamagotchi hardware). I&#8217;ll explore this further in a future post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/02/tamagotchi-items/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Kitchin&#8217; It In Kitchin&#8217; Er</title>
		<link>http://www.kwartzlab.ca/2013/02/kitchin-it-kitchin-er/</link>
		<comments>http://www.kwartzlab.ca/2013/02/kitchin-it-kitchin-er/#comments</comments>
		<pubDate>Tue, 12 Feb 2013 02:37:08 +0000</pubDate>
		<dc:creator>amackie</dc:creator>
				<category><![CDATA[Member Blogs]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3350</guid>
		<description><![CDATA[Oh hay thar mister kitchenette Lookin pretty sweet with your shiny blue walls, you cookie forge you The range has a hood, the hood has a range, and soon there will be cookies. Soon. So what else it can do? Maybe Taylor can elaborate what happened here &#60;blink&#62;THE KITCHEN HAS WATER!&#60;/blink&#62; &#160; Thanks to Taylor, [...]]]></description>
				<content:encoded><![CDATA[<p>Oh hay thar mister kitchenette<br />
<a href="http://www.kwartzlab.ca/2013/02/kitchin-it-kitchin-er/k0/" rel="attachment wp-att-3352"><img class="alignnone  wp-image-3352" title="om nom nom" alt="k0" src="http://www.kwartzlab.ca/wp-content/uploads/2013/02/k0.jpg" width="734" height="413" /></a><br />
Lookin pretty sweet with your shiny blue walls, you cookie forge you</p>
<p>The range has a hood, the hood has a range, and soon there will be cookies. Soon.<br />
So what else it can do?<br />
<a href="http://www.kwartzlab.ca/2013/02/kitchin-it-kitchin-er/k1/" rel="attachment wp-att-3353"><img class="alignnone  wp-image-3353" title="Like Niagara Falls, but with fewer wax museums" alt="k1" src="http://www.kwartzlab.ca/wp-content/uploads/2013/02/k1.jpg" width="691" height="518" /></a></p>
<p>Maybe Taylor can elaborate what happened here<br />
<a href="http://www.kwartzlab.ca/2013/02/kitchin-it-kitchin-er/k2/" rel="attachment wp-att-3351"><img class="alignnone  wp-image-3351" title="hay guyz no waterfights without proper eyewear k" alt="K2" src="http://www.kwartzlab.ca/wp-content/uploads/2013/02/K2.jpg" width="691" height="518" /></a></p>
<p>&lt;blink&gt;<strong><span style="color: #993300;">THE <span style="color: #339966;">KITCHEN</span> <span style="color: #0000ff;">HAS</span> <span style="color: #ff00ff;">WATER</span>!</span></strong>&lt;/blink&gt; <img src='http://www.kwartzlab.ca/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<p>Thanks to Taylor, Rob, Ben, Mark, Steph, Ed, Cedric, Karl, Bob, Kevin, and countless others who made it happen, and are continuing to finish the buildout!</p>
<p>Five days until the grand opening&#8230;lots of work left to do!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/02/kitchin-it-kitchin-er/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pandora Buildout Update</title>
		<link>http://www.kwartzlab.ca/2013/01/pandora-buildout-update/</link>
		<comments>http://www.kwartzlab.ca/2013/01/pandora-buildout-update/#comments</comments>
		<pubDate>Mon, 28 Jan 2013 04:02:25 +0000</pubDate>
		<dc:creator>amackie</dc:creator>
				<category><![CDATA[Member Blogs]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3286</guid>
		<description><![CDATA[We&#8217;re pressing ahead with building out Pandora and twisting it to our sinister ends! Yay! &#160; The front room is still busy and cluttered, but stuff is slowly starting to get put away. &#160; The clean shop is starting to look like a real work zone!  The laser cutter and soldering table is ready for [...]]]></description>
				<content:encoded><![CDATA[<p>We&#8217;re pressing ahead with building out Pandora and twisting it to our sinister ends! Yay!</p>
<p>&nbsp;</p>
<p>The front room is still busy and cluttered, but stuff is slowly starting to get put away.</p>
<p><a href="http://www.kwartzlab.ca/2013/01/pandora-buildout-update/dscn0259/" rel="attachment wp-att-3287"><img class="alignnone size-full wp-image-3287" alt="DSCN0259" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/DSCN0259.jpg" width="692" height="519" /></a></p>
<p>&nbsp;</p>
<p>The clean shop is starting to look like a real work zone!  The laser cutter and soldering table is ready for setup, and venting has been routed.  Also, <em>carpet!</em></p>
<p><a href="http://www.kwartzlab.ca/2013/01/pandora-buildout-update/dscn0256/" rel="attachment wp-att-3288"><img class="alignnone size-full wp-image-3288" alt="DSCN0256" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/DSCN0256.jpg" width="692" height="519" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Here&#8217;s the heavy equipment room.  Things are starting to find a home!</p>
<p><a href="http://www.kwartzlab.ca/2013/01/pandora-buildout-update/dscn0257/" rel="attachment wp-att-3289"><img class="alignnone size-full wp-image-3289" alt="DSCN0257" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/DSCN0257.jpg" width="692" height="519" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Heavy Lab, from the garage door. LOOK OUT COFFEE CUP, YOU&#8217;RE IN A SHIRT PRESS!</p>
<p><a href="http://www.kwartzlab.ca/2013/01/pandora-buildout-update/dscn0258/" rel="attachment wp-att-3290"><img class="alignnone size-full wp-image-3290" alt="DSCN0258" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/DSCN0258.jpg" width="692" height="519" /></a><br />
Upstairs is the clubhouse area. You&#8217;ll have to imagine the TV and couches, but they&#8217;re coming.</p>
<p><a href="http://www.kwartzlab.ca/2013/01/pandora-buildout-update/dscn0252/" rel="attachment wp-att-3291"><img class="alignnone size-full wp-image-3291" alt="DSCN0252" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/DSCN0252.jpg" width="692" height="519" /></a></p>
<p>&nbsp;</p>
<p>The kitchenette/cookie forge is coming along!  There&#8217;ll be a fridge to the left, and flooring underneath.</p>
<p><a href="http://www.kwartzlab.ca/2013/01/pandora-buildout-update/dscn0251/" rel="attachment wp-att-3292"><img class="alignnone size-full wp-image-3292" alt="DSCN0251" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/DSCN0251.jpg" width="692" height="519" /></a></p>
<p>&nbsp;</p>
<p>The storage area is assembled, and has allowed us to get a lot of bins &amp; boxes off the floor &amp; sorted!</p>
<p><a href="http://www.kwartzlab.ca/2013/01/pandora-buildout-update/dscn0253/" rel="attachment wp-att-3293"><img class="alignnone size-full wp-image-3293" alt="DSCN0253" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/DSCN0253.jpg" width="519" height="692" /></a></p>
<p>&nbsp;</p>
<p>And finally, the most exciting room of all, the newly-expanded bathroom!  Now with art!</p>
<p><a href="http://www.kwartzlab.ca/2013/01/pandora-buildout-update/dscn0248/" rel="attachment wp-att-3294"><img class="alignnone size-full wp-image-3294" alt="DSCN0248" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/DSCN0248.jpg" width="519" height="692" /></a></p>
<p>&nbsp;</p>
<p>Come on by and check it out for yourself next Tuesday night, because it&#8217;s changing day by day!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/01/pandora-buildout-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tama-Go ROM Format</title>
		<link>http://www.kwartzlab.ca/2013/01/tama-go-rom-format/</link>
		<comments>http://www.kwartzlab.ca/2013/01/tama-go-rom-format/#comments</comments>
		<pubDate>Mon, 21 Jan 2013 04:23:24 +0000</pubDate>
		<dc:creator>Natalie Silvanovich</dc:creator>
				<category><![CDATA[Member Blogs]]></category>

		<guid isPermaLink="false">http://www.kwartzlab.ca/?p=3271</guid>
		<description><![CDATA[I&#8217;ve been continuing to work out the format of the Tama-Go figure ROM. Using the figure simulation circuit I set up in my last post, and a digital logic analyzer, I&#8217;ve determined the purpose of most of the data in the figure ROM. &#160; I started by looking at the game functionality.  It turns out that [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been continuing to work out the format of the Tama-Go figure ROM. Using the figure simulation circuit I set up in my last post, and a digital logic analyzer, I&#8217;ve determined the purpose of most of the data in the figure ROM.</p>
<div id="attachment_3272" class="wp-caption aligncenter" style="width: 241px"><a href="http://www.kwartzlab.ca/2013/01/tama-go-rom-format/format/" rel="attachment wp-att-3272"><img class="size-medium wp-image-3272" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/format-231x400.png" alt="" width="231" height="400" /></a><p class="wp-caption-text">No one say &#8216;cross talk&#8217; and maybe it won&#8217;t happen</p></div>
<p>&nbsp;</p>
<p><span id="more-3271"></span>I started by looking at the game functionality.  It turns out that the functionality is fairly simple, and a very limited amount of the game logic is controlled by data fetched from the figure. The majority of data is images. Near the beginning of the ROM is a pointer table which contains the locations of images used by games, shops, items and other figure functionality. The location of this table is in turn controlled by another pointer at the head of the ROM. The Tama-Go fetches images by first fetching an image pointer from the table, and then fetching the image.</p>
<p>When &#8220;GAME&#8221; is selected, the Tama-Go starts fetching the needed images from the figure as they are displayed. Interestingly, they are fetched exactly when they are show, and are fetched multiple times if they are displayed multiple times. This suggests that the Tama-Go does not store the images fetched from the figure, but writes them directly to the LCD.</p>
<p>Only two pieces of data appear to affect the logic behavior of the game. The first are the &#8220;commands&#8221; at  addresses 0&#215;18 and 0&#215;19 (note I&#8217;m using a M<strong>a</strong>metchi figure, this might differ for other figures). These appear to control what game logic the Tama-Go executes when the specific game is selected. It turns out that if these are altered, the Tama-Go can not only jump into different games, but any screen on the Tamagotchi, such as the meal screen, going to the park or taking a bath. If the back button (C) is pressed on any of these screens, the Tama-Go jumps back to the screen it would normally go back to after the current screen, not the figure screen. This suggests that essentially the Tamagotchi acts as a large switch statement or jump table, with no memory of where it has previously jumped to.</p>
<p>I went through some of the possible command values, and found that many of them caused the Tamagotchi to freeze up and require a reset. This is likely because the commands do not exist, or the device is not in the right state for them to work correctly. It might be possible to exploit one of these invalid commands to dump the code of the Tamagotchi, although the lack of debugging information would make it difficult.</p>
<p>Of course, these commands can be used to &#8216;cheat&#8217; at Tamagotchi. The video below shows this functionality used to &#8216;evolve&#8217; the Tamagotchi (make it get older).</p>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='640' height='390' src='http://www.youtube.com/embed/dccig1h-K6s?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0'></iframe></span></p>
<p>There is also a series of bytes that gets read at the very end of the game. This seems to be related to how many points the Tamagotchi is awarded for playing the game. The Tama-Go appears to read more data the higher the game score is, so my guess is it&#8217;s some sort of cumulative algorithm for calculating the points awarded from the game score. Randomly tampering with these values caused my Tamagotchi to be awarded an extremely large number of points (which was useful in testing item functionality), but I&#8217;m still not clear how the values translate to points exactly.</p>
<div id="attachment_3273" class="wp-caption aligncenter" style="width: 505px"><a href="http://www.kwartzlab.ca/2013/01/tama-go-rom-format/points/" rel="attachment wp-att-3273"><img class="size-full wp-image-3273" src="http://www.kwartzlab.ca/wp-content/uploads/2013/01/points.png" alt="" width="495" height="515" /></a><p class="wp-caption-text">83009250 points has got to be enough for any Tamagotchi</p></div>
<p>Next, I looked at the shop functionality of the figure. This was also quite simple. The entire store functionality appears to be in the Tama-Go&#8217;s internal ROM, and it just fetched the images. The only interesting value was the item price, which can be altered in the ROM. This would probably be more useful had I not just given my Tamagotchi infinite points.</p>
<p>Lastly, I tried using an item, and this was quite interesting. The Tama-Go fetches one byte of non-image data from the figure, from inside the expected segment before using an item, and then fetches more than 200 bytes of non-image data from near the end of the ROM (not the segment, the entire ROM) while the item is being used. This is so bizzare, I tested it several times to make sure it was actually what was happening, and I&#8217;m confident that it is.</p>
<p>What I suspect is happening is that the first byte is a command similar to the game commands, jumping to code that relies on both image data and other data from the figure, which it then fetches. I&#8217;m not sure what this &#8220;other data&#8221; is. It could be the location of the images on the screen, it could be audio data (items make sounds) or it could be some type of metadata related to the behavior of the item (for example, whether it gives points, or the probability of behaving a certain way for items that don&#8217;t do the same thing every time). As for why this information is at such a strange location, my only guess is that its used by all three characters in the figure, so it can&#8217;t be a part of any of their segments. But this is wild speculation.</p>
<p>A complete list of memory addresses I&#8217;ve identified is below:</p>
<table width="663" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="209"><strong>Address Range (inclusive)</strong></td>
<td valign="top" width="454"><strong>Comment</strong></td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000001-0&#215;000003</td>
<td valign="top" width="454">Test command (detects if figure is properly attached)</td>
</tr>
<tr>
<td valign="top" width="209">0×000011-0×000013</td>
<td valign="top" width="454">Another test command, detects the ‘segment’ controlled by the jumper</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000013</td>
<td valign="top" width="454">Unknown, possibly version</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000014</td>
<td valign="top" width="454">Figure ID</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000015-0&#215;000017</td>
<td valign="top" width="454">Unknown</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000018-0&#215;000019</td>
<td valign="top" width="454">Game commands</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000020-000022</td>
<td valign="top" width="454">Pointer to background pointer (offset of 40 is added)</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000050-0&#215;000052</td>
<td valign="top" width="454">Walking sprite 1 pointer</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000053-0&#215;000055</td>
<td valign="top" width="454">Walking sprite 2 pointer</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000056-0&#215;000058</td>
<td valign="top" width="454">Happy sprite 1 pointer</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000059-0x00005B</td>
<td valign="top" width="454">Side smile sprite pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x00005c-0x00005f</td>
<td valign="top" width="454">Jumping for joy sprite pointer</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000068-0x00006a</td>
<td valign="top" width="454">Jumping sprite pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x00006e-0&#215;000070</td>
<td valign="top" width="454">Side walk sprite 1 pointer</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000071-0&#215;000073</td>
<td valign="top" width="454">Side walk sprite 2 pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x00008c-0x00008f</td>
<td valign="top" width="454">Startled sprite image pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x00009e-0x0000a0</td>
<td valign="top" width="454">After travel background pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x0000a4-0x0000a6</td>
<td valign="top" width="454">Travel image 1 pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x0000a7-0x0000a9</td>
<td valign="top" width="454">Travel image 2 pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x0000aa-0x0000ac</td>
<td valign="top" width="454">Ready image pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x0000ad-0x0000af</td>
<td valign="top" width="454">Go image pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x0000b6-0x0000b8</td>
<td valign="top" width="454">Hip hop game name pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x0000b9-0x0000bb</td>
<td valign="top" width="454">Speed runner game name pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x0000BC-0x0000C7</td>
<td valign="top" width="454">Store front pointers</td>
</tr>
<tr>
<td valign="top" width="209">0x0000CE-0x0000D0</td>
<td valign="top" width="454">Background image pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x0000d1-0x0000d3</td>
<td valign="top" width="454">Background image open pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x0000D4-0x000000eb</td>
<td valign="top" width="454">Hip hop image pointers</td>
</tr>
<tr>
<td valign="top" width="209">0x0000F5-0x00011d</td>
<td valign="top" width="454">Speed runner image pointers</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000119-0x00011b</td>
<td valign="top" width="454">Pointer to large Speed Runner image</td>
</tr>
<tr>
<td valign="top" width="209">0x00011f-0&#215;000127</td>
<td valign="top" width="454">Read as loading images for item (maybe logic)</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000148-0&#215;000170</td>
<td valign="top" width="454">Item prices (note probably a broader range)</td>
</tr>
<tr>
<td valign="top" width="209">0x0001a1-0x0001d4</td>
<td valign="top" width="454">Read at the end of Hip Hop game, appear to be related to scoring, but I’m not sure how. Appears to read farther the better you do. Corrupting them corrupts score display</td>
</tr>
<tr>
<td valign="top" width="209">0x00021d-0x00024c</td>
<td valign="top" width="454">Read at the end of speed runner</td>
</tr>
<tr>
<td valign="top" width="209">0x0002a2-0x0002db</td>
<td valign="top" width="454">Pointers to shop item images</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;000620- 0&#215;000629</td>
<td valign="top" width="454">Pointers to fun box images</td>
</tr>
<tr>
<td valign="top" width="209">0x0011bf</td>
<td valign="top" width="454">Fun box beginning</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;001251-0x0012B6</td>
<td valign="top" width="454">Walking sprite 1 image</td>
</tr>
<tr>
<td valign="top" width="209">0x0012B7-0x00131C</td>
<td valign="top" width="454">Walking sprite 2 image</td>
</tr>
<tr>
<td valign="top" width="209">0x001A49-0x001AAE</td>
<td valign="top" width="454">Startled sprite image</td>
</tr>
<tr>
<td valign="top" width="209">0x00131d-0&#215;001382</td>
<td valign="top" width="454">Happy sprite 1 image</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;001383-0x0013e8</td>
<td valign="top" width="454">Side smile sprite image</td>
</tr>
<tr>
<td valign="top" width="209">0x0013e9-0x00144e</td>
<td valign="top" width="454">Jumping for joy sprite image</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;001581-0x0015e6</td>
<td valign="top" width="454">Jumping sprite image</td>
</tr>
<tr>
<td valign="top" width="209">0x00164d-0x0016b6</td>
<td valign="top" width="454">Side walk sprite 1 image</td>
</tr>
<tr>
<td valign="top" width="209">0x0016b3-0x00171c</td>
<td valign="top" width="454">Side walk sprite 2 image</td>
</tr>
<tr>
<td valign="top" width="209">0x001cad-0x001e24</td>
<td valign="top" width="454">After travel background pointer</td>
</tr>
<tr>
<td valign="top" width="209">0x001f99-0x00210e</td>
<td valign="top" width="454">Travel image 1</td>
</tr>
<tr>
<td valign="top" width="209">0x00210f-0&#215;002284</td>
<td valign="top" width="454">Travel image 2</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;002285-0x0023fa</td>
<td valign="top" width="454">Ready image</td>
</tr>
<tr>
<td valign="top" width="209">0x0023fb-0&#215;002571</td>
<td valign="top" width="454">Go image</td>
</tr>
<tr>
<td valign="top" width="209">0x00285d-0x0028fa</td>
<td valign="top" width="454">Hip hop game name image</td>
</tr>
<tr>
<td valign="top" width="209">0x0028fb-0&#215;002998</td>
<td valign="top" width="454">Speed runner game name image</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;002999-0x002b2d</td>
<td valign="top" width="454">Store front images</td>
</tr>
<tr>
<td valign="top" width="209">0x002BAA-0x002C14</td>
<td valign="top" width="454">Background image</td>
</tr>
<tr>
<td valign="top" width="209">0x002C15-0x002C7F</td>
<td valign="top" width="454">Background image open</td>
</tr>
<tr>
<td valign="top" width="209">0x002c80-0x002cf8</td>
<td valign="top" width="454">Hip hop images</td>
</tr>
<tr>
<td valign="top" width="209">0x002f6f-0x002fd3</td>
<td valign="top" width="454">Large speed runner image</td>
</tr>
<tr>
<td valign="top" width="209">0x002d8f-0x002fd5</td>
<td valign="top" width="454">Speed runner images</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;003058-0&#215;003634</td>
<td valign="top" width="454">Item images</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;009052-0x0090bc</td>
<td valign="top" width="454">Fun box images</td>
</tr>
<tr>
<td valign="top" width="209">0&#215;0022499-0x00226e5</td>
<td valign="top" width="454">Read while playing with fun box, not image data</td>
</tr>
</tbody>
</table>
<p>And a list of game codes I&#8217;ve tried so far:</p>
<table width="329" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="75"><strong>Code</strong></td>
<td valign="top" width="253"><strong>Description</strong></td>
</tr>
<tr>
<td valign="top" width="75">FF</td>
<td valign="top" width="253">A game with squares</td>
</tr>
<tr>
<td valign="top" width="75">FE</td>
<td valign="top" width="253">Coin game</td>
</tr>
<tr>
<td valign="top" width="75">FD</td>
<td valign="top" width="253">Dropping game (cradles)</td>
</tr>
<tr>
<td valign="top" width="75">FcC</td>
<td valign="top" width="253">“Sorry Nothing” screen</td>
</tr>
<tr>
<td valign="top" width="75">FB</td>
<td valign="top" width="253">Away screen (and egg hatching)</td>
</tr>
<tr>
<td valign="top" width="75">FA</td>
<td valign="top" width="253">Park</td>
</tr>
<tr>
<td valign="top" width="75">F0</td>
<td valign="top" width="253">Remodelling store</td>
</tr>
<tr>
<td valign="top" width="75">F9</td>
<td valign="top" width="253">Odd , piano, then aliens, then IR</td>
</tr>
<tr>
<td valign="top" width="75">F8</td>
<td valign="top" width="253">Ready screen, can escape</td>
</tr>
<tr>
<td valign="top" width="75">F7</td>
<td valign="top" width="253">Ready screen, no escape</td>
</tr>
<tr>
<td valign="top" width="75">F6</td>
<td valign="top" width="253">Park with Violetchi</td>
</tr>
<tr>
<td valign="top" width="75">F5</td>
<td valign="top" width="253">Long jump game (with everything!)</td>
</tr>
<tr>
<td valign="top" width="75">F4</td>
<td valign="top" width="253">Shoot the bug</td>
</tr>
<tr>
<td valign="top" width="75">F2/F3</td>
<td valign="top" width="253">Also pair of games</td>
</tr>
<tr>
<td valign="top" width="75">F1</td>
<td valign="top" width="253">Ready screen, can escape</td>
</tr>
<tr>
<td valign="top" width="75">EF</td>
<td valign="top" width="253">Crying, returns to game choice screen</td>
</tr>
<tr>
<td valign="top" width="75">EE</td>
<td valign="top" width="253">Contrast screen</td>
</tr>
<tr>
<td valign="top" width="75">ED</td>
<td valign="top" width="253">Sound screen</td>
</tr>
<tr>
<td valign="top" width="75">EC</td>
<td valign="top" width="253">Pause Tamagotchi</td>
</tr>
<tr>
<td valign="top" width="75">EB</td>
<td valign="top" width="253">Tamagotchi runs away</td>
</tr>
<tr>
<td valign="top" width="75">EA</td>
<td valign="top" width="253"> Evolve!</td>
</tr>
<tr>
<td valign="top" width="75">E9</td>
<td valign="top" width="253"> Bath</td>
</tr>
<tr>
<td valign="top" width="75">E8</td>
<td valign="top" width="253">Figure “See you next time” screen</td>
</tr>
<tr>
<td valign="top" width="75">E7</td>
<td valign="top" width="253">Figure “Welcome” screen</td>
</tr>
<tr>
<td valign="top" width="75">E6</td>
<td valign="top" width="253">Reset screen</td>
</tr>
<tr>
<td valign="top" width="75">E5</td>
<td valign="top" width="253">Book (friends, memory screen)</td>
</tr>
<tr>
<td valign="top" width="75">E4</td>
<td valign="top" width="253">IR screen</td>
</tr>
<tr>
<td valign="top" width="75">E3</td>
<td valign="top" width="253">Tama says no</td>
</tr>
<tr>
<td valign="top" width="75">E2</td>
<td valign="top" width="253">Discipline screen</td>
</tr>
<tr>
<td valign="top" width="75">E1</td>
<td valign="top" width="253">Game shop item figure screen</td>
</tr>
<tr>
<td valign="top" width="75">E0</td>
<td valign="top" width="253">Tama comes back in door</td>
</tr>
<tr>
<td valign="top" width="75">DF</td>
<td valign="top" width="253">Bath</td>
</tr>
<tr>
<td valign="top" width="75">DE</td>
<td valign="top" width="253">Meal / snack</td>
</tr>
<tr>
<td valign="top" width="75">DD</td>
<td valign="top" width="253">Stats</td>
</tr>
<tr>
<td valign="top" width="75">DC</td>
<td valign="top" width="253">Clock</td>
</tr>
<tr>
<td valign="top" width="75">DD</td>
<td valign="top" width="253">main screen</td>
</tr>
<tr>
<td valign="top" width="75">DA</td>
<td valign="top" width="253">escape free egg (hatched, so restart)</td>
</tr>
<tr>
<td valign="top" width="75">D9</td>
<td valign="top" width="253">reset, not lock (can change details)</td>
</tr>
<tr>
<td valign="top" width="75">D8</td>
<td valign="top" width="253">stuck (must reset)</td>
</tr>
<tr>
<td valign="top" width="75">D7/D6/D5</td>
<td valign="top" width="253">frozen</td>
</tr>
<tr>
<td valign="top" width="75">99</td>
<td valign="top" width="253"> screen reverse</td>
</tr>
<tr>
<td valign="top" width="75">98</td>
<td valign="top" width="253">bottom icons light up (and stuck)</td>
</tr>
<tr>
<td valign="top" width="75">97</td>
<td valign="top" width="253">frozen</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kwartzlab.ca/2013/01/tama-go-rom-format/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
