<?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/"
	>

<channel>
	<title>HackMii &#187; Other consoles</title>
	<atom:link href="http://hackmii.com/category/other-consoles/feed/" rel="self" type="application/rss+xml" />
	<link>http://hackmii.com</link>
	<description>Notes from inside your Wii</description>
	<lastBuildDate>Tue, 31 Aug 2010 20:25:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>&#8220;Pandora’s Xbox: The changing community of the modern console&#8221;</title>
		<link>http://hackmii.com/2010/05/pandora%e2%80%99s-xbox-the-changing-community-of-the-modern-console/</link>
		<comments>http://hackmii.com/2010/05/pandora%e2%80%99s-xbox-the-changing-community-of-the-modern-console/#comments</comments>
		<pubDate>Sun, 02 May 2010 01:48:13 +0000</pubDate>
		<dc:creator>bushing</dc:creator>
				<category><![CDATA[Other consoles]]></category>
		<category><![CDATA[Wii]]></category>
		<category><![CDATA[dsi]]></category>

		<guid isPermaLink="false">http://hackmii.com/?p=1015</guid>
		<description><![CDATA[We spoke with Matthew Braga a little while back for an article he was doing about console hacking &#8212; at the risk of sounding self-promotional, I thought he did a really nice job of it.  It was written before Sony pulled support for OtherOS from the PS3, which just makes it all the more [...]]]></description>
			<content:encoded><![CDATA[<p>We spoke with Matthew Braga a little while back for an article he was doing about console hacking &#8212; at the risk of sounding self-promotional, I thought he did a really nice job of it.  It was written before Sony pulled support for OtherOS from the PS3, which just makes it all the more poignant now.</p>
<p>Head over to his site, horriblefanfare.com, to <a href="http://horriblefanfare.com/2010/01/20/pandoras-xbox-the-changing-community-of-the-modern-console/">read the article</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hackmii.com/2010/05/pandora%e2%80%99s-xbox-the-changing-community-of-the-modern-console/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>bad words</title>
		<link>http://hackmii.com/2010/04/bad-words/</link>
		<comments>http://hackmii.com/2010/04/bad-words/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 10:07:54 +0000</pubDate>
		<dc:creator>bushing</dc:creator>
				<category><![CDATA[Other consoles]]></category>

		<guid isPermaLink="false">http://hackmii.com/?p=996</guid>
		<description><![CDATA[Now that I&#8217;ve established some context, maybe this will make some more sense.  The more games we have to try to run on our SPG/unSP emulator, the easier it will be to find and fix bugs, so when I had the opportunity to do so, I picked up a V.Smile Pocket on eBay that [...]]]></description>
			<content:encoded><![CDATA[<p>Now that I&#8217;ve established some context, maybe this will make some more sense.  The more games we have to try to run on our SPG/unSP emulator, the easier it will be to find and fix bugs, so when I had the opportunity to do so, I picked up a V.Smile Pocket on eBay that came with 11 cartridges, and I made some hardware to dump the cartridges.</p>
<p>There actually aren&#8217;t many strings in these cartridge images; mostly some library ID strings like &#8220;TVSYS TVLCD1.0&#8243; (apparently the internal name for this product), &#8220;OursLib V1.2.25 generated by TV3, 2005-05-24&#8243; and build dates.  This makes the few strings that do exist jump right out.   One of the games (<a href="http://www.amazon.com/gp/product/B000DZVIAI?ie=UTF8&#038;tag=hac08-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B000DZVIAI">Elmo&#8217;s World &#8211; Elmo&#8217;s Big Discoveries</a><img src="http://www.assoc-amazon.com/e/ir?t=hac08-20&#038;l=as2&#038;o=1&#038;a=B000DZVIAI" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />) has a list of &#8220;bad words&#8221;, which presumably is in there to keep you from entering them in as your character name.  (The Wii&#8217;s System Menu had a similar list, if I recall correctly, but we never actually found a place where it was used.)   It&#8217;s a fairly short list of 101 4-letter words (in alphabetical order), and many of them are quite appropriately forbidden for a toddler&#8217;s video game.  Some are pretty tame &#8212; here&#8217;s all the ones that begin with the letter &#8216;b&#8217;:</p>
<p><code>b.s. bare barf boff bong bonk boob bras brat bums burp bust butt</code></p>
<p>Well, whatever, it&#8217;s just some silly game, right?  It might just be part of some standard library they use.   (Nevermind the fact that there&#8217;s nothing like it in 9 of the other games that I looked at.)<br />
<span id="more-996"></span><br />
However, the game that is included for free when you buy the system &#8212; <a href="http://www.amazon.com/gp/product/B000W2ER4G?ie=UTF8&#038;tag=hac08-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B000W2ER4G">Alphabet Park Adventure</a><img src="http://www.assoc-amazon.com/e/ir?t=hac08-20&#038;l=as2&#038;o=1&#038;a=B000W2ER4G" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> &#8212; is special.  It has some strange strings at the beginning:<br />
<code>**! 80092000201101<br />
078800 V.Smile\084080 Wall-E Save the World\info.xml<br />
078800 V.Smile\084080 Wall-E Save the World\info.xml<br />
078800<br />
80-92000-201-001<br />
2008-08-26 V1 M04<br />
000000-1FFFFF<br />
200000-3FFFFF<br />
0123456789ABCDEF<br />
crack<br />
violate<br />
TV 1.0<br />
TVSYS TVLCD1.0<br />
</code></p>
<p>(I guess they cut-and-pasted a template from a Wall-E game, and maybe there&#8217;s some checksumming routine &#8212; there are 0&#215;400000 words in the cartridge.  Your guess is as good as mine as far as &#8220;crack&#8221; and &#8220;violate&#8221; go.)</p>
<p>From there, it just gets surreal.  There&#8217;s a list of 1,023 &#8220;bad words&#8221;, varying from the tame to the bizarre.   They&#8217;re in order first by word length, and then by alphabetical sort order within that length.  This means that the longest words (well, phrases) are at the end of the list.   I&#8217;ll provide a link to the full version of the full list below (warning &#8212; NSFW, by definition), but I&#8217;ll except some of the funnier ones here.</p>
<p>As far as I can tell, the list has a few straightforward categories:</p>
<ul>
<li>Obscene words</li>
<li>Vulgar slang</li>
<li>Drug references</li>
<li>Racist epithets</li>
</ul>
<p>All of those seem fairly reasonable.   Then it gets strange:</p>
<ul>
<li>Medical terms for anatomy, etc</li>
<li>Political terms that the Chinese don&#8217;t like</li>
<li>Words that I had to go look up in the dictionary</li>
<li>Phrases that have no real bad meaning in English, but might have some obscene connotation in Chinese</li>
</ul>
<p>Here are some of the last group here that seem most strange.   The oddest part is, I can&#8217;t even find a single place in the game (and it&#8217;s not a very big or complicated game) where you can enter any strings in at all &#8212; it&#8217;s mainly picking between 2 or 3 possible letters to fill in a blank.   It&#8217;s also only in my US version of the game, and not in bmx&#8217;s French version.</p>
<p><code><br />
bra bum gin god god gun hag hex jig jun pip pox s&#038;m sod std war wog won</p>
<p>gods jeon kill lama lord lure reds spaz vamp wuss</p>
<p>bantu beano bosom bowel chiez chuck civil jesus leper merde nonce nymph ovary pinko ponce s.o.b satan satyr snafu state uteri vulva</p>
<p>a-hole accost adisms bandit bazoom be-all canuck carnal cervix chaste christ cuddle despot devils dwarfs ethnic forces geisha get-in libyan maoism plwert rabies racist rouble russki tyrant uterus virgin yoruba</p>
<p>apphism asexual atrophy end-all f.o.a.d fascist geishas illicit inbreed lamaism leftism lucifer marxism midgets necking offense olisbos onanism rapture ratitse "red raf" "red rag" redskin russkis sadists satanic schmima synovia tibetan tyranny vachiez virgins warlock warlord wedlock witched witches</p>
<p>biopsies bundling campaign colonist despotic flattery flirting funkiest gangster impotent intimacy leninism lucifers lustierl movement procurer red-bait redskins succubus trysting tyrannic warlocks warlords witchery witching wizardry</p>
<p>anarchism anarchist blue-skin bolshevik communist demimonde democracy despotism despotist dissident elopement endocrine exploiter "idea lewd" infatuate "live show" plutocrat socialist splittism splittist tyrannize</p>
<p>abiotrophy antichrist capitalism capitalist chauvinism "colour bar" demimondes democratic despotical greaseball hegemonism "jerk water" kuomintang "mao zedong" militarism repatriate semifeudal "sex lupine" sex-appeal tyrannical tyrannizer warlordism witch-hunt</p>
<p>antichrists antifrition "bandit gang" bourgeoisie "brute force" "creep joint" greaseballs "hair circle" officialism sovereignty "sugar daddy" "sun yat-sen" "third world"</p>
<p>asexualitand bandits'lair concupiscent "conjugal bed" depucelation distributism distributist extramarital hysterectomy insurrection "iron curtain" "ku klux klan" "mao tse-tung" menstruation "stool pigeon"<br />
"white racism" "white terror"</p>
<p>"conjugal rite" "dalkon shield" "white primary" "han chauvinism" "lustful excess"</p>
<p>"white backlash" "chiang kai-shek" insurrectionary "the proletariat" "white supremacy"</p>
<p>bandit chieftain<br />
marxism-leninism<br />
sexual inadquacy<br />
sovereign rights<br />
chinese civil war<br />
sexual perversion<br />
white supremacism<br />
white supremacist<br />
concentration camp<br />
cotius intermammas<br />
mao zedong thought<br />
the xi'an incident<br />
white man's burden<br />
knee-chest position<br />
nocturnal pollution<br />
the communist party<br />
the return of macao<br />
the eight route army<br />
the republic of china<br />
chinese-british street<br />
the return of hongkong<br />
great-nation chauvinism<br />
nationalist party (kmt)<br />
the communist gangsters<br />
tibet autonomous region<br />
national autonomous area<br />
tiananmen square massacre<br />
big-nationality chauvinism<br />
the communist youth league<br />
national self-determination<br />
national liberation movement<br />
subversion and anti-subversion<br />
</code></p>
<p>Anyone know how I can get paid for making up word lists like this?  The full (NSFW!) list is <a href="http://static.hackmii.com/alphabet_park_pottymouth_nsfw.txt">available here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hackmii.com/2010/04/bad-words/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>SunPlus: The biggest chip company you&#8217;ve never heard of</title>
		<link>http://hackmii.com/2010/04/sunplus-the-biggest-chip-company-youve-never-heard-of/</link>
		<comments>http://hackmii.com/2010/04/sunplus-the-biggest-chip-company-youve-never-heard-of/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 08:43:14 +0000</pubDate>
		<dc:creator>bushing</dc:creator>
				<category><![CDATA[Other consoles]]></category>
		<category><![CDATA[Wii]]></category>

		<guid isPermaLink="false">http://hackmii.com/?p=818</guid>
		<description><![CDATA[Every once in a while, you stumble upon something that nobody else seems to have paid much attention to.  This all started with my investigation into a glorious product named the Vii.
I can&#8217;t really give a great justification as to why this thing was so damned interesting to me, but it seemed weird and [...]]]></description>
			<content:encoded><![CDATA[<p>Every once in a while, you stumble upon something that nobody else seems to have paid much attention to.  This all started with my investigation into a glorious product named <a href="http://www.engadget.com/2007/09/28/keepin-it-real-fake-part-lxxxii-the-chintendo-vii/">the Vii</a>.</p>
<p>I can&#8217;t really give a great justification as to why this thing was so damned interesting to me, but it seemed weird and quirky and nobody really knew much about it.   I thought it might be fun to try to emulate awesome games such as <a href="http://www.youtube.com/watch?v=34vS95cnYMA">&#8220;Fry Egg&#8221;</a> on the real Wii, but didn&#8217;t really know where to begin &#8212; aside from getting my hands on one.   When it finally <a href="http://www.lightinthebox.com/Wii-Baby---White-Vii-Sport-Game-Console--Remote-Controller--18-Games-Free-Shipping_p16309.html">arrived in the mail from China</a>, I opened it up to find myself faced with a couple of epoxy blobs:<br />
<a href="http://www.flickr.com/photos/bushing/4530607942/" title="Vii PCB rev2 top (photo) by bushing, on Flickr"><img src="http://farm5.static.flickr.com/4027/4530607942_957c886220.jpg" width="500" height="375" alt="Vii PCB rev2 top (photo)" /></a><br />
<span id="more-818"></span><br />
This was a bit depressing; there&#8217;s not much you can do with these, absent any sort of descriptive markings.  Fortunately for us, the makers of this &#8220;console&#8221; decided to add a cartridge port and a 9-pin joystick controller, and then include a &#8220;VC-1&#8243; cartridge full of crappy games (&#8220;Virtual Console&#8221;, I suppose).  It was here that we got lucky; the cartridge contained a standard NOR flash chip, which I was able to read out with a standard chip programmer.</p>
<p><a href="http://www.flickr.com/photos/bushing/3889584756/" title="Vii 7-in-1 VC-1 cart by bushing, on Flickr"><img src="http://farm4.static.flickr.com/3421/3889584756_eb232d2d4a.jpg" width="375" height="500" alt="Vii 7-in-1 VC-1 cart" /></a></p>
<p>Browsing through the contents of the flash chip, there was no recognizable text or known instruction set &#8212; but fortunately, we found this header:<br />
<code>0000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................<br />
*<br />
0000c00: 6368 6b73 756d 3a32 3441 3842 4339 4220  chksum:24A8BC9B<br />
0000c10: 7665 723a 2275 276e 5350 2049 4445 5665  ver:"u'nSP IDEVe<br />
0000c20: 7220 312e 362e 3222 2075 7365 723a 2273  r 1.6.2" user:"s<br />
0000c30: 756e 706c 7573 2220 626f 6479 3a22 5350  unplus" body:"SP<br />
0000c40: 4732 3433 2200 0000 0000 0000 0000 0000  G243"...........<br />
</code></p>
<p>u&#8217;nSP?  sunplus?  What is this crap?  Searching on Google didn&#8217;t find much (at the time &#8212; there&#8217;s a lot more now, partially by coincidence and partially as a consequence of the work we&#8217;ve done which we&#8217;ll get to shortly).   We started digging, and, well, to make a long story shorter &#8212; it turns out that there is one Chinese company with several names that makes chips that you could probably find in devices you already own.</p>
<h2>SPG</h2>
<p>The SPG2xx series use a custom instruction set (&#8220;u&#8217;nSP&#8221;), and are designed for something like the TV Plug-n-Play games; they are used in most (if not all) of those, as well as the Vii and the V.smile (if nothing else).  Segher took our dumped ROM and scant documentation and built a disassembler, and then a mostly-working emulator for this architecture (more on this below).   The top of the line SPG290 uses a different &#8220;s+core&#8221; architecture, and is used in the <a href="http://lostscrews.com/viewtopic.php?f=10&#038;t=55">Mattel Hyperscan</a>.</p>
<h2>SPMP</h2>
<p>The SPMP series chips are ARM-based SoCs that are used in cheap Chinese &#8220;Personal Media Players&#8221; that also generally come bundled with NES or GameBoy emulators; see <a href="http://marcansoft.com/blog/tag/spmp/">Marcan&#8217;s work</a> on these.</p>
<h2>I/O interfaces</h2>
<p>I&#8217;ve seen a lot of use of these chips in random USB I/O applications.  The external hard drive I use to back up my laptop has a <a href="http://w3.sunplus.com/ShowFeature.asp?body=SPIF215A">SunPlus USB-SATA bridge</a>.  They make <a href="http://www.google.com/search?q=sunplus+spca533">USB-to-CCD interfaces</a> (aka webcams!).</p>
<h2>Everything else</h2>
<p>They make chips that go into digital picture frames and portable DVD players, too.  In China, they&#8217;re used for more general control applications &#8212; they make general MCUs under the &#8220;<a href="http://www.generalplus.com/">GeneralPlus</a>&#8221; name, and it was actually here where we found the most info.   Although the datasheets for the SunPlus chips are pretty hard to find, the general-purpose chips have freely-available documentation, and many of them use the same instruction set.    On the <span style="text-decoration: line-through;">Generalplus</span>Sunplus MCU site (this all gets very confusing), you can find datasheets for <a href="http://mcu.sunplusmcu.com/product/data16.asp">other chips</a> that use the u&#8217;nSP instruction set, and even <a href="http://mcu.sunplusmcu.com/product/soft16.asp">an IDE</a> based on an old, hacked up, GPL-violating version of GCC that supports u&#8217;nSP!</p>
<p>Based on the ROMs we extracted from the Vii and some experiments, Segher was able to write a disassembler and then eventually an <a href="http://git.infradead.org/users/segher/unununium.git">SPG emulator</a>:</p>
<p><a href="http://www.flickr.com/photos/bushing/4529969547/" title="Unununium: Vii menu 2 by bushing, on Flickr"><img src="http://farm5.static.flickr.com/4040/4529969547_acf1a91c74.jpg" width="500" height="393" alt="Unununium: Vii menu 2" /></a></p>
<p>I can now play Vii games on my computer, woohoo!  Sadly, sound and &#8220;Viimote&#8221; support have yet to be implemented.   Further research showed that most (all?) of the Jakks Pacific TV Plug&#8217;n'Play games also use SPG chips, so after some hardware hacking, we were able to play a couple of them, too:</p>
<p><a href="http://www.flickr.com/photos/bushing/4530047931/" title="Unununium: Batman by bushing, on Flickr"><img src="http://farm5.static.flickr.com/4012/4530047931_35740e474c.jpg" width="500" height="385" alt="Unununium: Batman" /></a></p>
<p>Work lately has focused mostly on the V.tech V.smile, which has the advantage of being cheaply and widely available, and it takes cartridges which are just simple ROMs (or occasionally NOR flash chips) on a PCB &#8230; with any luck, we will soon have a SPG development kit for the masses, a need that I&#8217;m sure everyone will agree went unfulfilled for quite some time.</p>
<p><a href="http://www.flickr.com/photos/bushing/4530052533/" title="Unununium: V.smile Studio De Dessin by bushing, on Flickr"><img src="http://farm5.static.flickr.com/4038/4530052533_354fd35b90.jpg" width="500" height="385" alt="Unununium: V.smile Studio De Dessin" /></a></p>
<p>Not everything has to be cutting-edge to be fun. <img src='http://hackmii.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://hackmii.com/2010/04/sunplus-the-biggest-chip-company-youve-never-heard-of/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>The weird and wonderful CIC</title>
		<link>http://hackmii.com/2010/01/the-weird-and-wonderful-cic/</link>
		<comments>http://hackmii.com/2010/01/the-weird-and-wonderful-cic/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 04:43:22 +0000</pubDate>
		<dc:creator>Segher</dc:creator>
				<category><![CDATA[Other consoles]]></category>

		<guid isPermaLink="false">http://hackmii.com/?p=827</guid>
		<description><![CDATA[I have been spending some time on reverse engineering the Nintendo CIC ROMs.  The CIC is the &#8220;lockout&#8221; chip in NES/SNES/N64 cartridges, used to get an iron grip on the market prevent people from copying games.  It was manufactured by Sharp and is likely one of their old &#8220;one-chip microcomputers&#8221;, used in calculators [...]]]></description>
			<content:encoded><![CDATA[<p>I have been spending some time on reverse engineering the Nintendo CIC ROMs.  The CIC is the &#8220;lockout&#8221; chip in NES/SNES/N64 cartridges, used to <del>get an iron grip on the market</del> prevent people from copying games.  It was manufactured by Sharp and is likely one of their old &#8220;one-chip microcomputers&#8221;, used in calculators and TV remotes and the like.  I couldn&#8217;t find a document describing the instruction set it uses (or its architecture!), so I made it all up (combining information from lots of sources: old datasheets, old patents, and the low-res die photographs).</p>
<p>The N64 chips are different, and I haven&#8217;t seen a ROM dump of those yet, so all of the following is NES/SNES only.</p>
<p>There is one chip inside the console, and one in every cartridge; the code inside the chip decides what to do based on a pin strap (the console one will be the &#8220;lock&#8221;, and the cartridge one will be the &#8220;key&#8221;).  The two chips run off the same clock, and they run the same code, so they run in lockstep (sometimes they execute different codepaths, but the code is careful to take the same number of cycles on both paths in these cases).  The chips communicate over two wires, one from key to lock, one from lock to key.  Both chips calculate what bits they will send, and what the other guy should send; if what they receive is not the same as what they should have received, they panic, and the lock chip resets the console.<br />
<span id="more-827"></span><br />
Here is the pinout of the CIC:</p>
<pre>              +------------------+
 DATA_OUT &lt;-- | 1 P0.0    +5V 16 |
  DATA_IN --&gt; | 2 P0.1        15 |  ?
     SEED --&gt; | 3 P0.2        14 |  ?
LOCK/-KEY --&gt; | 4 P0.3        13 |  ?
              | 5 Xout   P1.3 12 | &lt;-- RESET_SPEED_B
              | 6 Xin    P1.2 11 | &lt;-- RESET_SPEED_A
              | 7 RESET  P1.1 10 | --&gt; SLAVE_CIC_RESET
              | 8 GND    P1.0  9 | --&gt; -HOST_RESET
              +------------------+</pre>
<p>The LOCK/-KEY pin is the strap pin I talked about above.  The SEED pin has a capacitor connected to it; the discharge time of that is supposedly somewhat random, the lock chip times it and uses that as a random generator, to decide which of 16 possible streams to generate.  It tells the key chip which one it chose.</p>
<p>The lock chip can reset the key chip (pin 10 on the lock is wired to pin 7 on the key), and it can reset the console.  The RESET_SPEED pins are used on the 3195 to decide at what speed to &#8220;blink&#8221; the reset line (it&#8217;s connected to a LED as well): about 0.4s, 0.6s, 0.8s, 1.0s each of on/off.</p>
<p>There are dumps of the ROMs <a href="http://www.nesmuseum.com/10nes/nescicrom.txt">here</a>, <a href="http://www.nesmuseum.com/10nes/D411_ROM.txt">here</a>, and <a href="http://www.neviksti.com/CIC/3195A_rom_bits_final.txt">here</a>.  All credits for doing these go to neviksti; thanks!</p>
<p>All the bits in those dumps are inverted (0 vs. 1); if you want to play along with the disassembler I&#8217;ll give a link to in a second, you&#8217;ll need to fix that; also, that third ROM is 768 bytes, which I don&#8217;t handle in my little conversion script, so you&#8217;ll need to remove the extra columns (they are empty anyway).  Or enhance the script if you want to.</p>
<p>Okay then, here is <a href="http://git.infradead.org/users/segher/dis-cic.git">that disassembler</a>.  Usage should be self-explanatory.</p>
<p>This ancient CPU looks mighty strange to modern eyes.  Let me try to explain the architecture:</p>
<p>First, it is a 4-bit CPU.  Yessir.  It has an accumulator register, A, and a secondary register, X, both 4 bits.  All RAM accesses are done via a single pointer register B, which is 6 bits; the CIC chip only has 32 nybbles of RAM though.  There is also a carry flag, C.</p>
<p>Then, there is the process counter, PC.  It is 10 bits, but there are only 512 bytes of ROM (except on the 3195, it has 768).  The ROM is divided into banks of 128 bytes.  When the CPU increments PC, it never touches the bank number.</p>
<p>Well, &#8220;increments&#8221;.  To save chip area, they didn&#8217;t use a binary counter, but a polynomial counter; &#8220;incrementing&#8221; works by shifting the PC by one bit to the right, and setting the the top bit to 1 if and only if the bottom two bits were the same.</p>
<p>There are no conditional branch instructions; instead, various instructions can skip the next instruction if some condition is true (the instruction still takes time, it just doesn&#8217;t do anything).  Oh, all instructions take one cycle; except for the two byte instructions, which take two cycles.</p>
<p>Finally, there is a four entry stack for the PC; it&#8217;s not in RAM, it is separate.</p>
<p>Now the instruction set:</p>
<pre>"skip" means "do not execute next instruction"
"M" means "the RAM nybble addressed by B"
"BL" means "the low four bits of B"
"BM" means "the high two bits of B"
"PN" means "I/O port number BL"
"x.y" means "bit y of x"

00+N  adi N     "add immediate", A := A + N, skip if overflow   (00 is nop)
10+N  skai N    "skip acc immediate", skip if A = N
20+N  lbli N    "load B low immediate", BL := N
30+N  ldi N     "load immediate", A := N

40    l         "load", A := M
41    x         "exchange", swap A with M
42    xi        "exchange and increment", swap A with M, increment BL, skip if overflow
43    xd        "exchange and decrement", swap A with M, decrement BL, skip if underflow
44    nega      "negate acc", A := -A (two's complement)
46    out       "output", PN := A
47    out0      "output zero", PN := 0
48    sc        "set carry", C := 1
49    rc        "reset carry", C := 0
4a    s         "store", M := A
4c    rit       "return", pop PC from stack
4d    ritsk     "return and skip", pop PC from stack, skip
52    li        "load and increment", A := M, increment BL, skip if overflow
54    coma      "complement acc", A := ~A (ones' complement)
55    in        "input", A := PN
57    xal       "exchange acc and low", swap A with BL
5c    lxa       "load X with acc", X := A
5d    xax       "exchange X and acc", swap X with A
5e     ?        SPECIAL MYSTERY INSTRUCTION

60+N  skm N     "skip memory", skip if M.N = 1
64+N  ska N     "skip acc", skip if A.N = 1
68+N  rm N      "reset memory", M.N := 0
6c+N  sm N      "set memory", M.N := 1

70    ad        "add", A := A + M
72    adc       "add with carry", A := A + M + C
73    adcsk     "add with carry and skip", A := A + M + C, skip if overflow

74+N  lbmi N    "load B high immediate", BM := N

78+N NN  tl NNN    "transfer long", PC := NNN
7c+N NN  tml NNN   "transfer module long", push PC+2, PC := NNN
80+NN    t NN      "transfer", low bits of PC := NN</pre>
<p>It would seem that on the 3195, the sc and rc instructions are swapped, as are the coma and nega instructions.</p>
<p>If you look at the code in the ROMs, you&#8217;ll notice something strange with the ldi instructions: sometimes it runs two in a row.  Descriptions for similar CPUs say that if you have two or more ldi instructions in a row, all but the first are skipped.  The code still doesn&#8217;t make sense then; I suspect that this CPU does this skip only if some condition that I do not know yet is true.</p>
<p>This architecture is quite different from what we are used to today, and so it requires quite different programs; I&#8217;ll leave it to you to discover all the intricacies yourself though, it&#8217;s more fun that way!</p>
<p>I put a commented disassembly of these ROMs <a href="http://segher.ircgeeks.net/cic-roms/">here</a>.  Some of that is a work in progress.</p>
<p>I hope you all find this as fascinating as I did!</p>
<p>[edit: fixed op 52 "li" description]</p>
]]></content:encoded>
			<wfw:commentRss>http://hackmii.com/2010/01/the-weird-and-wonderful-cic/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>
