<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>BrassTacks (wpc)</title>
	<atom:link href="http://jaoswald.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jaoswald.wordpress.com</link>
	<description>Joe Oswald's Project/Hacking Blog</description>
	<lastBuildDate>Sun, 24 May 2009 10:05:10 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
		<url>http://www.gravatar.com/blavatar/d5ae876fdc1b0765e1953f0b65b7c674?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>BrassTacks (wpc)</title>
		<link>http://jaoswald.wordpress.com</link>
	</image>
			<item>
		<title>Another Symbolics keyboard adapter</title>
		<link>http://jaoswald.wordpress.com/2009/05/24/another-symbolics-keyboard-adapter/</link>
		<comments>http://jaoswald.wordpress.com/2009/05/24/another-symbolics-keyboard-adapter/#comments</comments>
		<pubDate>Sun, 24 May 2009 09:59:20 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[Lisp Machine]]></category>
		<category><![CDATA[Symbolics]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/?p=81</guid>
		<description><![CDATA[Hans Hübner has been at it again, and has developed code to allow a Teensy AVR development board to adapt a Symbolics keyboard to USB.
I ordered a Teensy board of my own, and was hoping to develop a small adapter to avoid cutting up my keyboard cable, but Teensy does not work with my old Mac [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=81&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hans Hübner has been at it again, and has developed code to allow a <a href="http://www.pjrc.com/teensy/" target="_blank">Teensy AVR development board</a> to adapt a <a href="http://netzhansa.blogspot.com/2009/04/how-to-convert-your-symbolics-keyboard.html" target="_blank">Symbolics keyboard to USB</a>.</p>
<p>I ordered a Teensy board of my own, and was hoping to develop a small adapter to avoid cutting up my keyboard cable, but Teensy does not work with my old Mac OS X 10.4 system.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=81&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2009/05/24/another-symbolics-keyboard-adapter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
		<item>
		<title>News on Symbolics keyboard adapters</title>
		<link>http://jaoswald.wordpress.com/2008/06/09/news-on-symbolics-keyboard-adapters/</link>
		<comments>http://jaoswald.wordpress.com/2008/06/09/news-on-symbolics-keyboard-adapters/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 16:37:27 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[Keyboard]]></category>
		<category><![CDATA[Lisp Machine]]></category>
		<category><![CDATA[Symbolics]]></category>
		<category><![CDATA[keyboard adapter]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Symbolics Keyboard]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/?p=70</guid>
		<description><![CDATA[I wanted to post a link referring to recent progress on adapting Symbolics keyboards to modern PCs. Hans Hübner announced that the kbdbabel project (apparently based on 8051 microcontrollers) was able to be adapted to support the slim-line (Rev. C) Symbolics keyboard, adapting it to PS/2 protocol.
My own work in this area ground to a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=70&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I wanted to post a link referring to recent progress on adapting Symbolics keyboards to modern PCs. Hans Hübner announced that the <a title="adapters for old keyboards" href="http://kbdbabel.org/" target="_blank">kbdbabel project</a> (apparently based on 8051 microcontrollers) was able to be adapted to <a title="Symbolics keyboard to PS/2 adapter" href="http://netzhansa.blogspot.com/2008/05/symbolics-keyboard-on-ps2-port.html" target="_blank">support the slim-line (Rev. C) Symbolics keyboard, adapting it to PS/2 protocol</a>.</p>
<p>My own work in this area ground to a halt pretty soon after I received the ADB adapter from DKS. I&#8217;m happy to see that others have been able to make progress!</p>
<p>UPDATE: Rainer Joswig has commented on his experience using the <a href="http://lispm.dyndns.org/news?ID=NEWS-2008-07-27-1">kbdbabel adapter to connect a Symbolics keyboard to a Macbook running Mac OS X</a>.</p>
<p>UPDATE 2: Hans has developed a <a href="http://jaoswald.wordpress.com/2009/05/24/another-symbolics-keyboard-adapter/" target="_self">USB adapter solution</a>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jaoswald.wordpress.com/70/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jaoswald.wordpress.com/70/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=70&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2008/06/09/news-on-symbolics-keyboard-adapters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
		<item>
		<title>COMFY-6502: hosting at github</title>
		<link>http://jaoswald.wordpress.com/2008/05/06/comfy-6502-hosting-at-github/</link>
		<comments>http://jaoswald.wordpress.com/2008/05/06/comfy-6502-hosting-at-github/#comments</comments>
		<pubDate>Tue, 06 May 2008 02:50:56 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[COMFY]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[6502]]></category>
		<category><![CDATA[COMFY-6502]]></category>
		<category><![CDATA[Common Lisp]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/?p=69</guid>
		<description><![CDATA[Mostly to support my own development on multiple computers, I&#8217;ve moved my Common Lisp port of COMFY-6502 to github. I chose the name cl-comfy-6502 for the repository, although the &#8220;cl&#8221; prefix is a bit ugly.
The current snapshot of COMFY-6502.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=69&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Mostly to support my own development on multiple computers, I&#8217;ve moved my Common Lisp port of COMFY-6502 to github. I chose the name cl-comfy-6502 for the repository, although the &#8220;cl&#8221; prefix is a bit ugly.</p>
<p>The <a title="30 April 2008 snapshot of Common Lisp COMFY-6502" href="http://github.com/jaoswald/cl-comfy-6502/tree/4f60b2a1d493f731f4702d29439112b31fa76f03" target="_blank">current snapshot of COMFY-6502</a>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jaoswald.wordpress.com/69/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jaoswald.wordpress.com/69/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=69&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2008/05/06/comfy-6502-hosting-at-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
		<item>
		<title>Adventuring into embedded ARM</title>
		<link>http://jaoswald.wordpress.com/2008/04/17/adventuring-into-embedded-arm/</link>
		<comments>http://jaoswald.wordpress.com/2008/04/17/adventuring-into-embedded-arm/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 02:27:38 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[ARM]]></category>
		<category><![CDATA[LN2410SBC]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/?p=68</guid>
		<description><![CDATA[After trying for a while to install Linux on my old Palm Tungsten E and failing, because of hardware issues (perhaps explaining why I replaced it with an E2 way back, although my memory is dim on that), I bought an LN2410SBC from LittleChips.com.
Why? First, because ARM embedded development is probably more lucrative than 6502 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=68&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After trying for a while to install Linux on my old Palm Tungsten E and failing, because of hardware issues (perhaps explaining why I replaced it with an E2 way back, although my memory is dim on that), I bought an LN2410SBC from <a title="ARM System-On-Chip" href="http://littlechips.com/" target="_blank">LittleChips.com</a>.</p>
<p><span id="more-68"></span>Why? First, because ARM embedded development is probably more lucrative than 6502 development; it is perhaps a more interesting target for COMFY work. Second, it intrigues me as a platform for CADR emulation. Some key figures about the original CADR. (Note: later Lisp machines expanded on these limits.)</p>
<ul>
<li>CADR was a 32-bit architecture, conveniently</li>
<li>24-bit virtual addresses (could I expand this by giving up CDR coding?) mean a 16 MW = 64 MB world size</li>
<li>CADR used 22-bit physical addresses, accessing a somewhat less than 16 MB of RAM in the maximum configuration</li>
<li>Clock rate of the microcode was less than 5 MHz; probably reachable with a 200 MHz ARM if the microcode is compiled to ARM machine code instead of interpreted by usim.</li>
</ul>
<p>All of this is pretty close to the resources on a typical ARM board. I chose the LN2410SBC because it provides a connection for an IDE hard-drive (with a programmable logic device for support?, although there seems to be scant documentation, and no connector is actually loaded on the board).  I felt that a hard drive would be essential for swap space; Flash could be used for Lisp world/microcode program storage, but not to support virtual memory. It also offers an interface to reasonably large LCD screen modules. If I&#8217;m too cheap to spring for the LCD panel, I anticipate using an X Window connection over Ethernet to provide graphical display. I&#8217;m undecided on the strategy for keyboard and mouse, although it offers USB. The ARM model has an MMU: Linux support probably will be important. </p>
<p>Some of the other boards I looked at were roughly similar in capability, and perhaps slightly cheaper, and even provided VGA outputs instead of simple LCD.</p>
<p>Probably the first step will be to get an ARM cross-compiler going on my iBook G4; compile usim, just for kicks to see how slow it is; and, to indulge some kernel-hacking urges, see if I can cook up a CHAOS network driver that utilizes the Ethernet interface.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jaoswald.wordpress.com/68/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jaoswald.wordpress.com/68/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=68&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2008/04/17/adventuring-into-embedded-arm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
		<item>
		<title>Monthly Boston Lisp Meeting: report</title>
		<link>http://jaoswald.wordpress.com/2008/03/05/monthly-boston-lisp-meeting-report/</link>
		<comments>http://jaoswald.wordpress.com/2008/03/05/monthly-boston-lisp-meeting-report/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 01:46:49 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Boston Lisp]]></category>
		<category><![CDATA[Boston Lisp Meeting]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/?p=67</guid>
		<description><![CDATA[Thanks to François-René Rideau (fare) for organizing last night&#8217;s inaugural Monthly Boston Lisp Meeting (Note: future meetings will apparently happen on the fourth Monday of the month.)
I&#8217;m surprised I haven&#8217;t seen reports on Planet Lisp yet, but I had an enjoyable time. I certainly didn&#8217;t meet everyone there, but did get to meet nyef (who [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=67&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Thanks to François-René Rideau (<a href="http://fare.livejournal.com/" title="Fare's Blog" target="_blank">fare</a>) for organizing last night&#8217;s inaugural <a href="http://fare.livejournal.com/120393.html" title="Monthly Boston Lisp Meeting announcement" target="_blank">Monthly Boston Lisp Meeting</a> (Note: future meetings will apparently happen on the fourth Monday of the month.)</p>
<p>I&#8217;m surprised I haven&#8217;t seen reports on Planet Lisp yet, but I had an enjoyable time. I certainly didn&#8217;t meet everyone there, but did get to meet <a href="http://www.lisphacker.com/" title="Alastair Bridgewater">nyef</a> (who showed off some of his fearless adventuring into bare-metal Lisp) and Brad Parker, got to see Kent Pitman in person, and a few other notables, as well as numerous ITA Lispers. Discussion was wide-ranging (I heard only a fraction of the multiple conversations going on), and some of the most interesting stuff to me was discussion about the background of Dylan and Lispers at Apple in the 1990s.</p>
<p>There was at least one person taking pictures; I&#8217;m sure they&#8217;ll pop up somewhere in the blogosphere.</p>
<p>Looking forward to more great meetings in the future!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jaoswald.wordpress.com/67/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jaoswald.wordpress.com/67/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/67/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=67&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2008/03/05/monthly-boston-lisp-meeting-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
		<item>
		<title>COMFY-6502: snapshot</title>
		<link>http://jaoswald.wordpress.com/2008/03/05/comfy-6502-snapshot/</link>
		<comments>http://jaoswald.wordpress.com/2008/03/05/comfy-6502-snapshot/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 01:34:39 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[Lisp]]></category>
		<category><![CDATA[6502]]></category>
		<category><![CDATA[assembler]]></category>
		<category><![CDATA[COMFY]]></category>
		<category><![CDATA[Common Lisp]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/?p=66</guid>
		<description><![CDATA[Even though it is hardly a finished product, I&#8217;ve posted a snapshot of my current CL conversion of COMFY-6502 Not that I expect a huge pent-up demand for the code, but it might be slightly more interesting than the output examples. Thanks to Henry Baker for allowing the release.
The page also contains a link to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=66&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Even though it is hardly a finished product, I&#8217;ve posted a <a href="http://josephoswald.nfshost.com/comfy/summary.html" title="COMFY-6502 snapshot" target="_blank">snapshot of my current CL conversion of COMFY-6502</a> Not that I expect a huge pent-up demand for the code, but it might be slightly more interesting than the output examples. Thanks to Henry Baker for allowing the release.</p>
<p>The page also contains a link to the TODO file describing my next steps. (Most immediately, my attempt to include JMP elision was messy enough to convince me I need a different class to represent opcodes+arguments as a unit.)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jaoswald.wordpress.com/66/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jaoswald.wordpress.com/66/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=66&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2008/03/05/comfy-6502-snapshot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
		<item>
		<title>COMFY-6502: a slight correction</title>
		<link>http://jaoswald.wordpress.com/2008/02/11/comfy-6502-a-slight-correction/</link>
		<comments>http://jaoswald.wordpress.com/2008/02/11/comfy-6502-a-slight-correction/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 01:57:48 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[Apple II]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[6502]]></category>
		<category><![CDATA[COMFY]]></category>
		<category><![CDATA[Red book tone routine]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/?p=62</guid>
		<description><![CDATA[After all the work to write a post showing off COMFY-6502&#8217;s ability to reproduce the Red Book tone routine, I made a slight mistake in translation. The code I presented differed ever-so-slightly from the Red Book routine in the case where the Y-register reached zero.

In the original, when the Y-register reaches zero, the DEX is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=62&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After all the work to write a post showing off COMFY-6502&#8217;s ability to reproduce the Red Book tone routine, I made a slight mistake in translation. The code I presented differed ever-so-slightly from the Red Book routine in the case where the Y-register reached zero.<br />
<span id="more-62"></span><br />
In the original, when the Y-register reaches zero, the DEX is still executed. In the code I posted, the expiring &#8220;duration tick&#8221; skips a count on the pitch. A minor error, but one I should own up to.</p>
<p>Here&#8217;s a better effort. COMPILE-SYMBOLIC contains a MACROLET defining MODULE as a call to COMFY-6502:COMPILE.</p>
<pre name="code" class="jscript">

(compile-symbolic
  (equ speaker #xc030)
  (equ duration 1)
  (equ pitch 0)
  (module
   (comfy-6502:loop
      ;; repeat until some clause loses: actually, only exit is
      ;; through return, so each clause should be ensured of winning.
    (LDX pitch)
    (LDA speaker)
    (not
     (comfy-6502:loop  ;; repeat until whap time
     DEY
     (not (seq zero? (DEC duration) zero? return))
     (seq DEX (not zero?)))))))
</pre>
<p>resulting in </p>
<pre name="code" class="jscript">

(; reload-pitch
 (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
 (LDA :ABSOLUTE) (:ABSOLUTE 49200)
 ; spin
 (DEY)
 (BNE) (:BRANCH 6) ; not-duration-tick
 (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
 (BNE) (:BRANCH 2)
 (RTS)
 ; not-duration-tick
 (DEX)
 (BEQ) (:BRANCH 4) ; goto-reload-pitch
 (JMP :ABSOLUTE) (:LONG-BRANCH -12) ; spin
 ; goto-reload-pitch
 (JMP :ABSOLUTE) (:LONG-BRANCH -20) ; reload-pitch
)
</pre>
<p>For fun, I tried to get the code to emit the RTS at the very end, as in the original.</p>
<pre name="code" class="jscript">

(compile-symbolic
  (equ speaker #xc030)
  (equ duration 1)
  (equ pitch 0)
  (module
    (alt (loop (seq (LDX pitch) (LDA speaker))
            (not (while
                    (seq DEY (not (seq zero? (seq (DEC duration) zero?)))
                    (seq DEX (not zero?)))))
          RTS)))
</pre>
<pre name="code" class="jscript">

(; reload
  (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
  (LDA :ABSOLUTE) (:ABSOLUTE 49200)
  ; spin
  (DEY)
  (BNE) (:BRANCH 5) ; not-duration
  ; duration-tick
  (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
  (BEQ) (:BRANCH 10) ; exit
  ; not-duration
  (DEX)
  (BEQ) (:BRANCH 4) ; goto-reload
  ; goto-spin
  (JMP :ABSOLUTE) (:LONG-BRANCH -11)
  ; goto-reload
  (JMP :ABSOLUTE) (:LONG-BRANCH -19) ; reload
 ; exit
  (RTS))
</pre>
<p>&#8220;Loop tightening&#8221; could change (BEQ) (:BRANCH 4) to (BEQ) (:BRANCH -14); the (JMP :ABSOLUTE) (:LONG-BRANCH -19) is then never used, and could be omitted, changing (BEQ) (:BRANCH 10) to (BEQ) (:BRANCH 7).</p>
<p>&#8220;Loop compaction&#8221; could potentially recognize (BEQ) (:BRANCH -14) (JMP :ABSOLUTE) (:LONG-BRANCH -11), where no other instruction references the JMP, could be converted to (BEQ) (:BRANCH -14) (BNE) (:BRANCH -11), shortening the (BEQ) (:BRANCH 7) one byte more to (BNE) (:BRANCH 6).</p>
<p>Note some interesting equivalents I should probably implement as COMFY macros.</p>
<p>(if A B C) where C is do-nothing-but-win is (not (seq A (not B)). If A wins, B is executed to determine the result of the form. If A loses, the if wins. I will probably call this (when A B).</p>
<p>(if A B C) where B is a do-nothing-but-win is (alt A C), where alt is the &#8220;dual&#8221; of seq. (alt A B C &#8230;) == (not (seq (not A) (not B) (not C) &#8230;). For the two-argument case, I would call this (unless A B). </p>
<p>The one twist I can think of is to add an &#8220;implied SEQ&#8221; to these forms. (when A B C &#8230;) would be (when A (seq B C &#8230;)). (unless A B C &#8230;) would be (unless A (seq B C &#8230;)).</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jaoswald.wordpress.com/62/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jaoswald.wordpress.com/62/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=62&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2008/02/11/comfy-6502-a-slight-correction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
		<item>
		<title>COMFY-6502: work in progress</title>
		<link>http://jaoswald.wordpress.com/2008/02/05/comfy-6502-work-in-progress/</link>
		<comments>http://jaoswald.wordpress.com/2008/02/05/comfy-6502-work-in-progress/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 00:49:23 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[Apple II]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[6502]]></category>
		<category><![CDATA[COMFY assembler]]></category>
		<category><![CDATA[Red book tone routine]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/?p=61</guid>
		<description><![CDATA[As I&#8217;ve mentioned before, I&#8217;ve become intrigued by Baker&#8217;s COMFY assembler, and have been working on porting it to Common Lisp, and making it a bit more powerful in the link stage.
One metric to judge the success of this kind of &#8220;medium-level&#8221; language is how well it compiles compared to hand-written assembler code. For the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=61&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As I&#8217;ve mentioned before, I&#8217;ve become intrigued by Baker&#8217;s COMFY assembler, and have been working on porting it to Common Lisp, and making it a bit more powerful in the link stage.</p>
<p>One metric to judge the success of this kind of &#8220;medium-level&#8221; language is how well it compiles compared to hand-written assembler code. For the 6502, there are a few examples of code created by wizards like Steve Wozniak, which you can find copies of around the web, the largest being the Apple II monitor, the Integer Basic interpreter, and some medium-sized ones like the Apple II 6502 step/trace, the mini-assembler, the floating-point &#8220;Wozpack,&#8221; and the Sweet-16 virtual machine.</p>
<p>This kind of code has a lot of quirks that make it hard to straight-forwardly translate: lots of shared &#8220;tail code&#8221;, branches known by the programmer to always be taken (to save a precious extra byte consumed by an unconditional JMP), and the classic &#8220;fake RTS trick&#8221;, pushing a return address picked from a table onto the stack, then using an RTS instead of a zero-page indirect JMP. Common in Woz&#8217;s code is a further shortening of the code by arranging the destination addresses to all be in the same 256-byte page, so the high-order byte is a constant. Some of these ideas will likely be possible with intelligent macros, combined with address labels and computation on those labels. I&#8217;m puzzling a bit over how to optimize the &#8220;same page&#8221; condition: whether to include a &#8220;link-time assert&#8221;, which will issue an error if the code is emitted so as to cross a page, or an even more intelligent &#8220;link-time computation&#8221; which, given the current available memory space, can choose a location that meets the constraints.<br />
<span id="more-61"></span><br />
That&#8217;s all still in development. The first test case I used was the classic &#8220;Red Book&#8221; tone routine.</p>
<pre name="code" class="jscript">

;; the original
;; location 00: pitch
;; location 01: duration
0002-  AD 30 C0   LDA  $C030 ; whap speaker
0005-  88         DEY
0006-  D0 04      BNE  $000C
0008-  C6 01      DEC  $01   ; y reaches 0: a duration tick
000A-  F0 08      BEQ  $0014 ; duration exhausted when reaches 0
000C-  CA         DEX        ; x counts time to &quot;whap&quot;
000D-  D0 F6      BNE  $0005
000F-  A6 00      LDX  $00   ; x reached 0, reload pitch
0011-  4C 02 00   JMP  $0002 ; and whap
0014-  60         RTS
</pre>
<p>A few comments:</p>
<ol>
<li>Locating the code in zero-page needlessly wastes valuable zero-page locations. The code is easily relocatable to other locations.</li>
<li>X counts from the &#8220;pitch value&#8221; down to 0 at a fixed rate, &#8220;whapping&#8221; the speaker each time it reaches zero.</li>
<li>Y cycles around continuously at basically the same rate; each time it reaches zero, one tick is subtracted from the duration value. When duration reaches zero, the routine returns.</li>
<li>This classic tone routine has the important feature that duration is absolute, and not dependent on pitch</li>
<li>Y is uninitialized, which presumably causes a slight jitter in the duration, unless BASIC ensures Y=0. Likewise, X in the first pitch countdown is uninitialized.</li>
<li>duration is destroyed by the routine, but pitch is not.</li>
</ol>
<p>Here is my transcription to COMFY-6502. I have translated the &#8220;I&#8221;, &#8220;J&#8221;, and abbreviated &#8220;L&#8221;, &#8220;LI&#8221;, etc. opcodes for this example, but not yet changed Baker&#8217;s code to accept them.</p>
<pre name="code" class="jscript">

(let ((comfy-6502::*symbol-table* (make-hash-table)))
  (equ speaker #xc030)
  (equ duration 1)
  (equ pitch 0)
  (comfy-6502-tests::compile-code
     (comfy-6502:loop
       ;; repeat until some clause loses: actually, only exit is
       ;; through return, so each clause should be ensured of winning.
        (LDX pitch)
        (LDA speaker)
        (not (comfy-6502:loop  ;; repeat until whap time; &quot;whap&quot; time is when a clause loses; NOT wins, outer loop continues
                 DEY
                 (if =0? ; has Y reached zero?
                     (not (seq (DEC duration) ; Y has reached zero, duration ticks down
                               =0?       ; if duration has not reached zero, SEQ fails, NOT wins, IF wins, inner loop continues
                               RTS)) ; duration reached zero, return
                     (seq DEX ~=0?))))))) ; Y not zero, count down pitch. If X has reached zero, SEQ loses, IF loses, inner loop exits
</pre>
<p>To understand the code, the basic COMFY principles must be understood.</p>
<ol>
<li>Conditional tests (such as &#8220;=0?&#8221;, corresponding to a BEQ or BNE), &#8220;win&#8221; if they are true, &#8220;lose&#8221; if they are false.</li>
<li>Ordinary machine operations (such as LDA, DEX, RTS) always &#8220;win&#8221;</li>
<li>SEQ sequentially each enclosed form, until one &#8220;loses&#8221;, in which case SEQ &#8220;loses&#8221;, or until they all &#8220;win&#8221;, in which case SEQ &#8220;wins.&#8221;</li>
<li>LOOP executes each enclosed form, until one &#8220;loses&#8221;, in which case LOOP &#8220;loses&#8221;, continuing at the top of the loop if every form &#8220;wins.&#8221; (I have introduced an &#8220;implied&#8221; seq to Baker&#8217;s ELisp implementation.) It is SEQ stuck on potentially endless repeat.</li>
<li>NOT executes the single enclosed form, but changes &#8220;win&#8221; into &#8220;lose&#8221; and vice-versa. This is useful to keep a nested &#8220;loss&#8221; from terminating all the enclosing forms.</li>
<li>(IF test win-form lose-form) executes TEST. If TEST &#8220;wins&#8221;, WIN-FORM is executed, and its win/lose result is passed out as the result of the IF. If TEST &#8220;loses&#8221;, LOSE-FORM is executed, and its win/lose result is passed out as the result of the IF.</li>
</ol>
<p>Note that I have chosen to initialize X on the first pass through the loop. That makes the code somewhat clearer, and I think is better style.</p>
<p>So what code does COMFY (as of today) generate for this? Behold.</p>
<pre name="code" class="jscript">

(; reload-pitch
 (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
 (LDA :ABSOLUTE) (:ABSOLUTE 49200)
; spin
 (DEY)
 (BEQ) (:BRANCH 6) ; duration-tick
 (DEX)
 (BNE) (:BRANCH 8 ) ; goto spin
 (BEQ) (:BRANCH 9) ; goto reload-pitch
; duration-tick
 (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
 (BNE) (:BRANCH 2) ; goto-spin
 (RTS)
; goto spin
 (JMP :ABSOLUTE) (:LONG-BRANCH -14)
; goto reload-pitch
 (JMP :ABSOLUTE) (:LONG-BRANCH -22))
</pre>
<p>This is a symbolic &#8220;intermediate&#8221; form, not yet relocated and linked. Some keys for interpretation.</p>
<ol>
<li>(BEQ), (JMP :ABSOLUTE) etc. represent one-byte opcodes, with the specified addressing mode (redundant in the case of branch instructions, which have only the branch-relative mode).</li>
<li>(:ZERO-PAGE 0) is a single-byte, value 0, tagged to indicate that it represents a reference to zero-page location 0, and is not just a immediate argument of value zero.</li>
<li>(:ABSOLUTE 49200) is a two-byte reference to the address #xC030, which will be emitted in the usual 6502 low-byte first as #x30 and #xC0.</li>
<li>(:BRANCH n) represents a short branch. It is one byte long. Note that the destination counts relative to the BRANCH byte, not relative to the next instruction, as the 6502 branch values do. (The relocater corrects for this when converting to 6502 code bytes.)</li>
<li>(:LONG-BRANCH n) is a long branch. It is two bytes long. JMP is absolute in the 6502; the relocated will deposit the absolute address by adding this value to the location of the first byte of this pair.</li>
</ol>
<p>I have added this intermediate form because Baker&#8217;s Elisp goes directly to bytes in a fixed memory area, starting from high addresses. My goal is for a high level &#8220;COMFY module&#8221; macro to result in an intermediate form that knows its length in bytes, what zero page locations it uses, and what internal entry points it exports. Otherwise, it is relocatable by the linker. I would also like the feature that the zero-page references are symbolic (e.g. (:ZERO-PAGE duration)), in which case the linker would allocate a byte in zero-page, and all modules referring to &#8220;duration&#8221; would refer to that address. Even nicer would be the ability to do math, for instance (:ZERO-PAGE (+ duration 1)), or to emit (:ABSOLUTE (- tone-entry 1)) to encode the module entry point in the &#8220;off-by-one&#8221; method used by the &#8220;fake RTS&#8221; trick. Similarly, one could have elements such as (:BYTE (HIGH tone-entry)), representing the high-order byte of the tone-entry address, and allowing arbitrary link-time math.</p>
<p>As for the code itself, it has <strike>the same</strike> similar semantics as the Red book routine.[UPDATE: but not quite. See more recent post for correction.] It has a somewhat minor change in that the DEY is followed by a BNE in the original code (taken 255 out of 256 times), and by a BEQ in the COMFY version (taken only 1 out of 256 times). Any difference in the execution time will, of course, change the pitch emitted. More serious is the fact that COMFY, as coded, is biased toward forward conditional branches. The two JMP instructions after the RTS are reached only through branches that could reach their destination directly. COMFY compiles, as I mentioned, from the last instruction toward the first. Forward branches are trivially resolved, but backward branches don&#8217;t know their destination, in particular, whether the destination is a short branch away or not. The backward JMPs are created by the code for LOOP, which first emits a &#8220;placeholder&#8221; absolute jump, compiles the loop forms, including branches that might land on that jump, then patches the JMP destination to point to the first form of the LOOP.</p>
<p>That suggests that LOOP might be enhanced to include a &#8220;loop-tightening&#8221; phase which examines the body of the loop for forward branches (:BRANCH x) to jumps (:LONG-BRANCH y), and if x+y+1 is within range of a short branch, replaces it. (The +1 is for the JMP opcode itself.) The result would be</p>
<pre name="code" class="jscript">

(; reload pitch
 (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
 (LDA :ABSOLUTE) (:ABSOLUTE #XC030)
; spin
 (DEY)
 (BEQ) (:BRANCH 6) ; duration-tick
 (DEX)
 (BNE) (:BRANCH -5) ; spin
 (BEQ) (:BRANCH -12) ; reload-pitch
; duration-tick
 (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
 (BNE) (:BRANCH -11) ; spin
 (RTS)
 (JMP :ABSOLUTE) (:LONG-BRANCH -14)
 (JMP :ABSOLUTE) (:LONG-BRANCH -22))
</pre>
<p>The two JMPs are now unused. This is a special case, because RTS is itself a jump. Because LOOP knows that it freshly emitted the JMP, no external code can properly reference it. If all the branches to it have been patched, and the last instruction cannot reach it, the JMP itself can be omitted.Assuming I can convince COMFY to be smart enough to omit the (proven) redundant JMPs, we are ready for comparison. Let&#8217;s re-write the original code to match the explicit X initialization, and use COMFY&#8217;s discovery that moving the LDX to the front of the loop means the absolute JMP $0002 in the original can be replaced by a BEQ.</p>
<pre name="code" class="jscript">

reload-pitch LDX PITCH
             LDA $CO30
spin         DEY
             BNE not-tick ; actually, takes branch more often
; duration-tick
             DEC duration
             BEQ return
not-tick     DEX
             BNE spin
             BEQ reload-pitch ; save a byte compared to original JMP
return       RTS
</pre>
<p>COMFY, with the yet-to-be-implemented loop tightening has made the code one byte shorter, and relocatable.As mentioned before, COMFY has luckily or unluckily chosen the branch after DEY to be taken infrequently, while the author of the tone routine chose it to be taken frequently. We cannot know whether the author de-optimized to reach a lower pitch range. If so, to match the timing more closely, I can reverse the sense of the IF, causing it to emit a BNE. In this case, the hypothetical loop-tightening can eliminate one JMP, but not the other.</p>
<pre name="code" class="jscript">

(; reload-pitch
 (LDX :ZERO-PAGE) (:ZERO-PAGE 0)
 (LDA :ABSOLUTE) (:ABSOLUTE 49200)
; spin
 (DEY)
 (BNE) (:BRANCH 6) ; not-duration
 (DEC :ZERO-PAGE) (:ZERO-PAGE 1)
 (BNE) (:BRANCH -6) ; spin
 (RTS)
; not-duration
 (DEX)
 (BEQ) (:BRANCH -15) ; reload-pitch
; goto-spin
 (JMP :ABSOLUTE) (:LONG-BRANCH -12)
</pre>
<p>We see this simple change affected the DEY test, but also affected the DEX test, biasing it to be taken less frequently.  Perhaps an annotation could added to the COMFY language to indicate &#8220;please prefer (or expect?) this test to win/lose.&#8221; This would disrupt the tight recursive elegance of the GENBRC routine, but it might prove handy in modern architectures with their branch-prediction tendencies. It is also not so simple to change the test after DEC (:ZERO-PAGE 1) to BEQ to the RTS. That would require moving the RTS to be emitted at the end, i.e. compiled by COMFY first. I&#8217;m more interested in implementing the loop-tightening logic than attacking that brain-teaser right now.The moral may be that COMFY (plus yet-to-be-implemented optimization passes) can emit code very much in the ballpark of humans, at least for these toy examples. For cycle-level timing, however, I might follow the lead of Sassy and allow for the human to code branches and jumps explicitly. (Sassy&#8217;s example &#8220;boot sector&#8221; code actually avoids pretty much all the COMFY primitives; however, the documentation also seems to suggest that loop tightening and similar optimizations have been implemented there.) And I have yet to successfully translate Woz&#8217;s code into COMFY, probably because I have to understand it first.(Note to self: AVOID the tempting WordPress &#8220;code&#8221; button. Use the <a href="http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/" title="How do I post sourcecode" target="_blank">sourcecode tag</a>, although it supports neither assembler nor Lisp.)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jaoswald.wordpress.com/61/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jaoswald.wordpress.com/61/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/61/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=61&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2008/02/05/comfy-6502-work-in-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
		<item>
		<title>Quis custodiet ipsos&#8230;</title>
		<link>http://jaoswald.wordpress.com/2007/12/18/quis-custodiet-ipsos/</link>
		<comments>http://jaoswald.wordpress.com/2007/12/18/quis-custodiet-ipsos/#comments</comments>
		<pubDate>Tue, 18 Dec 2007 18:06:28 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[Lisp]]></category>
		<category><![CDATA[Regression Test]]></category>
		<category><![CDATA[RT]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/2007/12/18/quis-custodiet-ipsos/</guid>
		<description><![CDATA[I don&#8217;t know what this says about Lispers&#8217; attitudes toward automated testing, or toward the RT test framework, but the commonly-distributed versions of the RT test framework did not pass their own self-tests.
The apparent cause is that the introduction of a hash-table and tail-pointer in rt.lisp to efficiently find tests by name and insert new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=60&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I don&#8217;t know what this says about Lispers&#8217; attitudes toward automated testing, or toward the RT test framework, but the commonly-distributed versions of the RT test framework did not pass their own self-tests.</p>
<p>The apparent cause is that the introduction of a hash-table and tail-pointer in rt.lisp to efficiently find tests by name and insert new tests at the end of the test list were not matched by the updating of the rt-test.lisp to consistently construct the miniature mock-up test suite. This <a href="http://voltaire.nfshost.com/transfer/rt-test-JAO-20071218.diff" title="DIFF for rt-test.lisp" target="_blank">diff for rt-test.lisp</a>, introduces code to dynamically rebind those variables. The patch, in addition to one putting the self-tests into a separate package, has been applied to the HEAD of the <a href="http://cvs.savannah.gnu.org/viewvc/gcl/gcl/ansi-tests/" title="CVS repository for GNU CLISP ansi-tests directory" target="_blank">CVS repository for GNU CLISP</a>. Note that changing the package changes the names of the tests themselves, which requires editing the expected output in the tests.</p>
<p>Note how powerful and convenient the dynamic binding feature of Lisp (optional, as it should be, in Common Lisp) can be: while running the individual tests, the test procedure can effortlessly construct a sandbox in which to test out the features of the test suite, <strong>without</strong> destroying the suite of tests that is being sequenced through, and <strong>automatically restoring</strong> the state of the outer test suite as each test completes, even if the inner test throws an unexpected error&#8212;all with essentially no special effort on the part of the original programmer (except, as we see, to identify <em>all</em> of the state that needs to be shadowed.)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jaoswald.wordpress.com/60/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jaoswald.wordpress.com/60/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=60&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2007/12/18/quis-custodiet-ipsos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
		<item>
		<title>Another interesting mid-level assembler</title>
		<link>http://jaoswald.wordpress.com/2007/12/17/another-interesting-mid-level-assembler/</link>
		<comments>http://jaoswald.wordpress.com/2007/12/17/another-interesting-mid-level-assembler/#comments</comments>
		<pubDate>Mon, 17 Dec 2007 14:03:17 +0000</pubDate>
		<dc:creator>jaoswald</dc:creator>
				<category><![CDATA[Apple II]]></category>
		<category><![CDATA[PIC]]></category>
		<category><![CDATA[6502]]></category>
		<category><![CDATA[PIC0 assembler]]></category>
		<category><![CDATA[SPL assembler]]></category>

		<guid isPermaLink="false">http://jaoswald.wordpress.com/2007/12/17/another-interesting-mid-level-assembler/</guid>
		<description><![CDATA[While I&#8217;m still digesting COMFY in my &#8220;ample spare time,&#8221; a post on comp.sys.apple2 mentioned some assemblers from &#8220;Ron&#8221; having a similar flavor: SPL for the 6502 and PIC0 for PIC 10F2xx microcontrollers. They are apparently implemented in Python, and inspired by Forth. They emit assembler.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=59&subd=jaoswald&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>While I&#8217;m still digesting COMFY in my &#8220;ample spare time,&#8221; a <a href="http://groups.google.com/group/comp.sys.apple2/msg/a3eadb2e419930dd?" title="Announcement of SPL on comp.sys.apple2" target="_blank">post on comp.sys.apple2 mentioned some assemblers from &#8220;Ron&#8221; having a similar flavor</a>: <a href="http://home.comcast.net/~oneelkruns/" title="SPL assembler for the 6502, PIC0 assembler for PIC" target="_blank">SPL for the 6502 and PIC0 for PIC 10F2xx microcontrollers</a>. They are apparently implemented in Python, and inspired by Forth. They emit assembler.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/jaoswald.wordpress.com/59/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/jaoswald.wordpress.com/59/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jaoswald.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jaoswald.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jaoswald.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jaoswald.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jaoswald.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jaoswald.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jaoswald.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jaoswald.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jaoswald.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jaoswald.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jaoswald.wordpress.com&blog=969343&post=59&subd=jaoswald&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jaoswald.wordpress.com/2007/12/17/another-interesting-mid-level-assembler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/fc96790cf4a20cdf00826fe746ff31ee?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jaoswald</media:title>
		</media:content>
	</item>
	</channel>
</rss>