<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>lisp-machine &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/lisp-machine/</link>
	<description>Feed of posts on WordPress.com tagged "lisp-machine"</description>
	<pubDate>Wed, 10 Feb 2010 06:58:28 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Another Symbolics keyboard adapter]]></title>
<link>http://jaoswald.wordpress.com/2009/05/24/another-symbolics-keyboard-adapter/</link>
<pubDate>Sun, 24 May 2009 09:59:20 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2009/05/24/another-symbolics-keyboard-adapter/</guid>
<description><![CDATA[Hans Hübner has been at it again, and has developed code to allow a Teensy AVR development board to ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><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>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[News on Symbolics keyboard adapters]]></title>
<link>http://jaoswald.wordpress.com/2008/06/09/news-on-symbolics-keyboard-adapters/</link>
<pubDate>Mon, 09 Jun 2008 16:37:27 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2008/06/09/news-on-symbolics-keyboard-adapters/</guid>
<description><![CDATA[I wanted to post a link referring to recent progress on adapting Symbolics keyboards to modern PCs. ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><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>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Genera and Packages]]></title>
<link>http://jaoswald.wordpress.com/2007/12/03/genera-and-packages/</link>
<pubDate>Mon, 03 Dec 2007 03:52:16 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/12/03/genera-and-packages/</guid>
<description><![CDATA[As I alluded to in an earlier post, Symbolics Genera takes a slightly different approach to packages]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>As I alluded to in an earlier post, Symbolics Genera takes a slightly different approach to packages than most current environments (such as SLIME under Emacs).</p>
<p>Part of that is because, unlike GNU Emacs today, the editor and all its intelligence is running inside the Lisp environment; another part is due to Genera supporting multiple dialects of Lisp, each slightly compatible with the other.</p>
<p>One consequence is that Zmacs pays close attention to the &#8220;file attributes line&#8221; in your Lisp source files. (That&#8217;s the line at the beginning of the file which contains the marker &#8220;-*-&#8221;). Other Lisp environments use a heuristic, like looking for the first IN-PACKAGE form.</p>
<p>A chicken-and-egg problem arises when loading a file that expects to be read in a particular package. What if the package doesn&#8217;t exist? Well, it isn&#8217;t possible to use that package to read the file. But the package itself is defined in a file. </p>
<p>For me this caused a bit of confusion, because if you try to load a file with a non-existent package defined in the attributes, <em>and</em> you have not given Genera permission to create the package, it complains that &#8220;&#60;package name&#62; is not meaningful as a package name in &#60;Lisp dialect&#62;&#8221;. </p>
<p>You can press Resume to allow it to be created, and then the problem goes away until you try to bootstrap again without the package existing.</p>
<p>The answer is found in the documentation section &#8220;Specifying Packages in Programs.&#8221; If the package attribute <em>is enclosed in parentheses</em>, it is automatically created if it does not exist. Furthermore, you can include one package name, or a list of package names, as the second element of the list in order to specify packages which this package uses.</p>
<p>The other way to approach this is to create a system definition file which defines the packages up front.</p>
<p>(Another aspect that made me more confused is that the package name was &#8220;6502&#8243;, which if in the package attribute without quotes will read as an integer, which cannot designate a package. I had to muck around a bit trying double-quotes and vertical-bar escapes, in an effort to make the problem go away, before I realized the &#8220;not meaningful&#8221; was not referring to violating some non-existent rule about package names. From time to time, I would create the package and not realize that made the message go away.)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Learning Genera, bit by bit...]]></title>
<link>http://jaoswald.wordpress.com/2007/11/06/learning-genera-bit-by-bit/</link>
<pubDate>Tue, 06 Nov 2007 19:07:02 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/11/06/learning-genera-bit-by-bit/</guid>
<description><![CDATA[Having hacked on the COMFY code for a while in Emacs Lisp, I got the itch to move it over to my MacI]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Having hacked on the COMFY code for a while in Emacs Lisp, I got the itch to move it over to my MacIvory, which has been waiting for real work to do. I&#8217;ve crafted some tests in the Emacs Lisp using elk-test (trying to add heirarchical suites-of-suites along the way), and wanted to port them to one of the Common Lisp test frameworks (I&#8217;m thinking of checking out Stefil, LIFT, and rt, which I&#8217;ve used briefly). While copying the files, I ran into a few issues.</p>
<ol>
<li> I couldn&#8217;t figure out an automatic way to handle line-ending issues in the text files. I ended up locating the file on the Mac OS side in the file browser, Mouse-R clicking to Edit the file, then M-%, C-q [LINE key] [Return] C-q [Return] [Return] ! in Zmacs, then saving to a file on the Ivory file system. (I like the offer to create non-existent directories on a save.) There is probably a Copy File(s) command I could have used to move them en masse, and I should have been able to code up a quick conversion routine or Zmacs keyboard macro, but it worked.</li>
<li>Trying to compile the RT framework, I think I had been misled by my experience in the Genera Development Tutorial. The Common-Lisp mode apparently is Common Lisp the Language, 2d ed. What I was looking for is ANSI-Common-Lisp. The confusion cause all sorts of problems with DEFPACKAGE, and the presence of FUTURE-COMMON-LISP made me even more confused. An e-mail on the SLUG list apparently <a href="http://osdir.com/ml/lisp.org.slug/2002-04/msg00009.html " title="Common-Lisp compatibility in Genera" target="_blank">explains the various Common-Lisp strategies on Genera</a>.</li>
</ol>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[MacIvory ADB Adapter Protocol]]></title>
<link>http://jaoswald.wordpress.com/2007/11/03/macivory-adb-adapter-protocol/</link>
<pubDate>Sat, 03 Nov 2007 21:07:38 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/11/03/macivory-adb-adapter-protocol/</guid>
<description><![CDATA[Working with ResEdit and DeRez, I believe I have traced out the keyboard protocol used by the MacIvo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Working with ResEdit and DeRez, I believe I have traced out the <a href="http://jaoswald.wordpress.com/symbolics-adb-adapter-mapping/" title="MacIvory ADB Adapter Protocol">keyboard protocol used by the MacIvory ADB adapter</a>. My adapter is on the blink, probably because of the small screw I found rattling about inside. I hope DKS can bring it back to life, or the PIC-based project I had begun will make its way back to the front burner.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[MacIvory Keyboard Support Software]]></title>
<link>http://jaoswald.wordpress.com/2007/10/09/macivory-keyboard-support-software/</link>
<pubDate>Tue, 09 Oct 2007 15:16:30 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/10/09/macivory-keyboard-support-software/</guid>
<description><![CDATA[The ADB adapter has not just given me some help uncovering the behavior of the Rev. C Symbolics keyb]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The ADB adapter has not just given me some help uncovering the behavior of the Rev. C Symbolics keyboard protocol, but also works when attached to my MacIvory. Along the way (and with the help of David K. Schmidt) I encountered some glitches, mostly stemming from my original accidental trashing of the System file DKS installed.</p>
<p>There are a few software components the ADB adapter box needs to convert the Symbolics keyboard to something the Mac OS 7.6.1 (including the &#8220;FEP&#8221; window which communicates to the Ivory board on a low level) will accept as a keyboard with the right keymapping, and furthermore to something the Genera application will recognize with all the Symbolics-specific keys. Without these components, you will see one of the following two stages of malfunction.</p>
<p>Stage 1:  The mouse connected to the ADB adapter works fine. In the Mac OS (including the FEP window), there is total keyboard confusion, with the keys all scrambled. On the Genera side, things are less scrambled, but some keys are missing, such as &#8220;e&#8221;, &#8220;t&#8221;, &#8220;u&#8221;, and &#8220;o&#8221;; the &#8220;o&#8221; in fact causes the Mac menu bar to flash. Modifier keys seem absent. If you activate the keyboard control application, Genera seems to crash easily. <a href="http://groups.google.com/group/cu.slug/msg/5a93881ce4dfd7c6" title="MacIvory keyboard under 7.5.3" target="_blank">Peter Paine reported this</a> at the time System 7.5.3 came out.</p>
<p>If you do a custom install of the &#8220;Symbolics Keyboard for System 7&#8243; selection in the MacIvory software installer, you get the Symbolics Keyboard extension icon at Mac OS startup, and a Symbolics keyboard layout choice in the Keyboard control panel. The situation improves, reaching</p>
<p>Stage 2: The alphanumeric keys work for both the Mac OS and for Symbolics. However, Genera treats a press of the &#8220;Page&#8221; key as a press of the &#8220;Line&#8221; key, treats &#8220;Escape&#8221; as &#8220;Select&#8221;, and ignores the \{ and &#124;} keys, the Hyper modifier key, and most of the large function keys (Function, Refresh, Square, Circle, Triangle, Suspend, Resume, Abort,  Network, Local, Select, Line). <a href="http://groups.google.com/group/info.slug/msg/7ffebfc844fe10b7?" title="MacIvory keyboard support under MacOS 7.5" target="_blank">Kent Pitman reported this</a> after an upgrade to System 7.5.</p>
<p>The solution  is to do a full install of the MacIvory support software. I believe this is necessary to get all of the resources installed in the Mac&#8217;s System file.</p>
<p>I&#8217;ll try to gather more details on the resources; it would be nice to understand how to make a box that takes, for instance, a PS/2 keyboard &#38; mouse and connects it to the MacIvory, although the Symbolics keyboards and mice may be more plentiful than than the Ivory boards at this point, so it might be  mere archaeology. More practical, if ADB adapters are scarcer than Ivory boards, would be a combination of the Apple keyboard (which works well enough for MacIvory use) and a three-button PS/2 mouse with a &#8220;partial ADB adapter&#8221; allowing it to provide multi-button mouse function to Genera.</p>
<p>UPDATE: I examined the resources, and was able to decode the <a href="http://jaoswald.wordpress.com/symbolics-adb-adapter-mapping/" title="Symbolics ADB Adapter Keyboard Mapping" target="_blank">Symbolics ADB adapter encoding</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Symbolics Rev. C Keyboard Secrets]]></title>
<link>http://jaoswald.wordpress.com/2007/09/26/symbolics-rev-c-keyboard-secrets/</link>
<pubDate>Wed, 26 Sep 2007 03:24:28 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/09/26/symbolics-rev-c-keyboard-secrets/</guid>
<description><![CDATA[The ADB adapter has fulfilled its main purpose: providing an example of hardware which can speak to ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The ADB adapter has fulfilled its main purpose: providing an example of hardware which can speak to my Rev. C Symbolics keyboard.</p>
<p>The apparent trick is that the clock pulses must be narrow, without being too rapid (i.e., a relatively low duty cycle.)  A 10 microsecond long low pulse on /CLR, followed 30 microseconds after the beginning of that pulse by the clock going low for roughly 9 microseconds, continuing with a clock period of approximately 50 microseconds does the trick. The ADB adapter pauses somewhat between groups of 11 clock pulses, corresponding to the natural &#8220;section breaks&#8221; of the keyboard mapping; I don&#8217;t know if that is strictly necessary. My first crude approximation, using bit-bashing for the PIC with timing loops resulted in Caps Lock and Mode Lock that felt a bit sluggish&#8212;needing to be held down relatively long to &#8220;lock&#8221; or &#8220;unlock.&#8221; The overall cycle time may be important in that regard.</p>
<p>In any event, I reconstructed the <a href="http://lmkbd.googlecode.com/svn/trunk/symkeys.asm" title="LMKBD symkeys.asm" target="_blank">keyboard mapping from the LMKBD project</a>, although I chose to count pulses from zero, rather than n=1 in that listing.</p>
<p>Unfortunately, this seems to make the PIC EUSART not fit the application: its clock pulses have a symmetric duty cycle. I had hoped to use the serial port intelligence to offload enough of the bit-handling to allow for rapid response that the ADB protocol seems to require. Perhaps I need to look at some of the other peripherals; can I use some pulse-width modulation output to drive the keyboard and the EUSART in synchronous slave mode together?</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[ADB adapter on its way...]]></title>
<link>http://jaoswald.wordpress.com/2007/09/24/adb-adapter-on-its-way/</link>
<pubDate>Mon, 24 Sep 2007 23:33:58 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/09/24/adb-adapter-on-its-way/</guid>
<description><![CDATA[David K. Schmidt evidently scrounged up another ADB converter box which he just sold to me. Assuming]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>David K. Schmidt evidently scrounged up another ADB converter box which he just sold to me. Assuming I haven&#8217;t blown up my Symbolics keyboard, I may finally have what I wanted: a piece of hardware that knows how to talk to my Rev. C keyboard! I hope that will shorten the time to coerce my PIC circuit to do the same.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Beginner PIC mistakes, and detective work]]></title>
<link>http://jaoswald.wordpress.com/2007/09/18/beginner-pic-mistakes-and-detective-work/</link>
<pubDate>Tue, 18 Sep 2007 21:25:52 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/09/18/beginner-pic-mistakes-and-detective-work/</guid>
<description><![CDATA[Step 1 in the Symbolics keyboard to PIC project was not as quick as I had hoped. It was pretty easy ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Step 1 in the Symbolics keyboard to PIC project was not as quick as I had hoped.</p>
<p>It was pretty easy to generate the reset pulse, and get the serial port to send a clock signal to the keyboard. I then was using an oscilloscope to look at the keyboard response, but various attempts to get the PIC code to light up LEDs in response didn&#8217;t work at all. In fact, I was being bitten by two bugs, which I used the PICkit 2 in-circuit debug to discover.</p>
<ol>
<li>An array overrun bug (it seems the default radix in MPASM is hex, so reading 16 bytes into a sixteen element array doesn&#8217;t work! Unfortunately, my byte counter was located after the array, was stomped directly from 6 to zero, missing the &#8220;decrement and skip if zero&#8221; termination test until the array covered well into register bank 1.) Safety tip of the day: put your counter before the array!</li>
<li>Something not addressed in the early lessons: ANSEL. The RX/DT pin of the 16F690 is shared with AN11, and the low bits of PORT C driving the LEDs are shared with AN4 through AN7. That means, unless one clears the corresponding bit in the ANSEL registers, they read as digital 0, no matter what the RX data is, and no matter what the state of my PORT C output. Toggling RC5 with a read-modify-write operation was clearing my LEDs before I could see them. Read your data sheets carefully!</li>
</ol>
<p>A few tips/gripes on the PICkit 2 in-circuit debugging experience</p>
<ol>
<li>At least for newbies like me, and probably for more complex applications, any ICD is a great puzzle solver. At US$45 plus shipping, it is a great deal.</li>
<li>The white triangle on the PICkit 2 programmer goes to pin 6 (near the &#8220;ICSP&#8221; silkscreen) of the AC164110&#8212;mark a triangle there to make it more foolproof.</li>
<li>The green execution arrow stops <strong>after</strong> the line marked with the red B. I.e., the instruction with the breakpoint on it gets executed before control comes back to the user. This is counter to my habits built up using the similar looking VBA debugger in Excel.</li>
<li>With the 16F690, you get only one active ICD breakpoint. That&#8217;s much better than zero, of course.</li>
<li>The W register indicator in the MPLAB IDE seems not to work (stuck at zero); look at the Special Function Register window instead.</li>
<li>Another MPLAB IDE gripe: hovering over constants in code (such as a bit number) shows the value of the File Register at that constant address. Not so helpful when I want to check which bit position I am trying to flip.</li>
<li>Modifying special function registers in the File Register window is evidently forbidden; modify them in the Special Function Register window.</li>
</ol>
<p>Modifying special function registers directly is a real time-saver. Instead of downloading different code to set up the baud rate registers, I edit them by hand to experiment. (And, unfortunately, my Rev. C keyboard behaves differently at different clock rates! More to come on a separate page.)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Symbolics keyboard to PIC, step 1]]></title>
<link>http://jaoswald.wordpress.com/2007/09/04/symbolics-keyboard-to-pic-step-1/</link>
<pubDate>Tue, 04 Sep 2007 23:14:17 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/09/04/symbolics-keyboard-to-pic-step-1/</guid>
<description><![CDATA[The first step is to connect the Symbolics keyboard to the PIC. I am using the 16F690 which comes wi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The first step is to connect the Symbolics keyboard to the PIC. I am using the 16F690 which comes with the PICkit 2 starter kit on the low pin count demo board (Microchip DM164120-1). The keyboard cable mates to a 6-pin modular jack (such as Digikey part number 609-1061-ND), which I tacked onto the side of the board. Unfortunately, this mod jack has pin spacings of 50 mil &#8220;horizontally&#8221; between successive pins, so I bent up the odd pins and soldered the even pins to the demo board.</p>
<table>
<tr>
<th>Mod jack pin</th>
<th>Keyboard function</th>
<th>PIC function</th>
<th>PIC pin marking</th>
</tr>
<tr>
<td>6</td>
<td>GND</td>
</tr>
<tr>
<td>5</td>
<td>GND (N/C)</td>
</tr>
<tr>
<td>4</td>
<td>Vdd</td>
</tr>
<tr>
<td>3</td>
<td>Key Data</td>
<td>RX/DT</td>
<td>RB5</td>
</tr>
<tr>
<td>2</td>
<td>CLK</td>
<td>TX/CK</td>
<td>RB7</td>
</tr>
<tr>
<td>1</td>
<td>/CLR</td>
<td>RC5</td>
<td>RC5</td>
</tr>
</table>
<p>My first task will be to power up the keyboard, code a scanning loop, and try to detect keystrokes for a single key, such as the Left Control Key, displaying the count of key-down events in binary to the LEDs connected to RC0-RC3. If the keyboard is not debounced by the internal microcontroller, the count will not increment cleanly, but I hope to at least prove that I can talk to the keyboard and make sense of what comes back. I&#8217;m not sure how much current the keyboard will need, so I might have to power the demo board with an external supply.</p>
<p>[UPDATE: It turns out the standard numbering of modular jack pins is the reverse of the pin numbering of the P1 header inside the keyboard. I've corrected the table above to reflect the standard modular jack scheme. Looking into the opening of the jack, with the locking tab down, pin 1 is on the left side.]</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Debouncing switches]]></title>
<link>http://jaoswald.wordpress.com/2007/08/30/debouncing-switches/</link>
<pubDate>Thu, 30 Aug 2007 23:41:23 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/08/30/debouncing-switches/</guid>
<description><![CDATA[I made a little exercise out of compacting the example &#8220;switch debounce&#8221; code that the P]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I made a little exercise out of compacting the example &#8220;switch debounce&#8221; code that the PIC tutorial examples uses. My next exercise will be to improve the debouncing in the &#8220;reverse variable speed LED rotation by pressing switch&#8221; by interleaving the debouncing check into the delay loop. As it stands, when the rotation is slow, the example can miss brief switch pushes.</p>
<p>My glorious savings of three instructions is documented on a <a href="http://jaoswald.wordpress.com/compressing-the-pic-debounce-example-code/" title="Compacting PIC debounce example" target="_blank">separate page</a>.</p>
<p>One nifty trick I found through Google that might be very helpful if I have to debounce 88 keys on a Symbolics keyboard (naturally, the same number as on a piano) is called &#8220;<a href="http://www.dattalo.com/technical/software/pic/vertcnt.html" title="PIC vertical counters" target="_blank">vertical counters</a>.&#8221; This consists basically of replacing counter increments with boolean operations, which can be easily performed in parallel, if the corresponding bits for multiple counters are grouped in register-sized words.</p>
<p><a href="http://www.dattalo.com/technical/software/pic/debounce.html" title="Debouncing with vertical counters">This page</a> shows how to use a four-count two-bit vertical counting scheme to debounce eight switches in parallel.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Learning more about PIC]]></title>
<link>http://jaoswald.wordpress.com/2007/08/27/learning-more-about-pic/</link>
<pubDate>Mon, 27 Aug 2007 02:12:34 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/08/27/learning-more-about-pic/</guid>
<description><![CDATA[A few comments about the PICkit 2 learning experience. There&#8217;s a slight bit of polish that cou]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>A few comments about the PICkit 2 learning experience.</p>
<p>There&#8217;s a slight bit of polish that could be applied to the example code.</p>
<ol>
<li>A few redundant instructions, such as
<ul>
<li>Extraneous operations setting register pages</li>
<li>In A-to-D examples, the data sheet seems to say the 5 microsecond settling time is needed only when changing the input source, not for every conversion, as in the examples</li>
<li>For the 5 microsecond interval, a few of those microseconds are covered by the non-NOP instructions before the conversions</li>
</ul>
</li>
<li>In one of the variable-speed rotating bits examples, the carry flag is not explicitly cleared when it needs to be clear. When I modified the example to change the sign of the pot setting-to-delay conversion, I would sometimes set the carry, putting extra bits into the display. Took me a good fifteen minutes to debug that.</li>
<li>I think a few extra instructions are wasted using the W register and an explicit move to the file register when the file register destination could be used instead</li>
</ol>
<p>I also got bitten by the issue mentioned briefly in the PICkit 2 release note: if you program the examples from the IDE, the IDE forces the line controlled by the push-button low, meaning the push-button examples fail to work, unless you program the device from the dedicated programming application and the .HEX file produced by the IDE.</p>
<p><strike>I am slightly disappointed that</strike> there <strike>doesn&#8217;t</strike> seem to be any visible progress getting the PICkit 2 with version 2 firmware to work under Mac OS X.</p>
<p>Also, <strike>I find a real lack of documentation of the PICkit 2 &#8220;Debug Express&#8221; support for in-circuit debugging. This may be because Microchip doesn&#8217;t want to undercut sales of the MPIDE 2 hardware. I think, however,</strike> one can use a combination of the AC162061 (containing an ICD version of the 16F690) and AC164110 (to convert the ICSP six-pin interface to the modular plug used by the usual ICD interface) to do in-circuit debugging of 16F690 applications with the PICkit 2, at an additional cost of about $50.</p>
<p>I&#8217;ve started sketching out some ideas for interfacing the Symbolics keyboard on a <a href="http://jaoswald.wordpress.com/pic-based-symbolics-keyboard-adapter/">dedicated page</a>.</p>
<p>[UPDATE: Microchip does, after all, document the <a href="http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&#38;nodeId=1406&#38;dDocName=en023805" title="PICkit 2 debugging hardware" target="_blank">PICkit 2 Debug Express hardware requirements</a> (scroll down a bit to see what I missed before.) I ordered the combination even before I found the document, and when the backorder is filled, I will be giving it a try myself.]</p>
<p>[UPDATE: Jeff Post <a href="http://groups.google.com/group/pickit-devel/t/2a0571f3085d3f5b" title="Pickit-devel newsgroup post" target="_blank">announced</a> that he releasing <a href="http://home.pacbell.net/theposts/picmicro/pk2-3.00-alpha12.tar.gz" title="PK2-3.00-Alpha12">alpha code</a> supporting v2 firmware for the<a href="http://home.pacbell.net/theposts/picmicro/" title="Jeff Post's PIC micro page" target="_blank"> PICkit 2 on Linux/Mac OS X</a>]</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Making lights blink...]]></title>
<link>http://jaoswald.wordpress.com/2007/08/21/making-lights-blink/</link>
<pubDate>Tue, 21 Aug 2007 22:40:56 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/08/21/making-lights-blink/</guid>
<description><![CDATA[My latest diversion is a Microchip PICkit2. The idea is to make something that can understand the Sy]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>My latest diversion is a Microchip PICkit2. The idea is to make something that can understand the Symbolics keyboard I have, and then connect that something to other things that can speak Apple Desktop Bus (ADB), PS/2 keyboard protocol, or USB, in roughly that order. If I can make something that takes a multi-button PS/2 mouse and a Symbolics keyboard and connects both to a MacIvory, I could be set for beautiful three-button mousing and classic keyboarding on my Lisp Machine.</p>
<p>I&#8217;ve mostly traced out the schematic of my Rev. C Symbolics slim-line keyboard (thank god for simple two-layer boards!). Rev. C has LED&#8217;s in the Caps Lock and Mode Lock keys, in contrast to <a href="http://www.asl.dsl.pipex.com/symbolics/photos/IO/inside-keyboard.html" title="Inside Keyboard">this picture of the similar Symbolics Rev. B keyboard</a>. Compared to the <a href="http://lmkbd.googlecode.com/files/Symbolics3600Keyboard.png" title="LMKBD Googlecode project keyboard schematic" target="_blank">Symbolics 3600 keyboard schematic</a>, mine is roughly similar, but unfortunately has a 40-pin microcontroller (an Intel 8749H, a member of the MCS-48 family) soldered in. I am certain I could make something work with the simple protocol the 3600 keyboard apparently implements, but if the microcontroller does anything beyond driving the LEDs on and off based on simply counting the corresponding keystrokes, I might be sunk.  I&#8217;ve fired off a few questions to people who can hopefully tell me that all of these are plug- and wire-compatible.</p>
<p>As for the 3600, it is pretty obviously a matter of pulling the reset line low to clear the counters, and clocking through the other 127 counter states to read off the switch matrix closures on the 16 X by 8 Y (I surmise that high on the output would mean the corresponding key is down.)  I&#8217;m not sure how frequently I have to collect the bits to avoid missing keypresses, and what debouncing I might have to do.</p>
<p>The strange thing about my Rev C is that the ICs driving what I guess is the X direction are a pair of 74145  devices with what the datasheet claims are open-collector outputs, and the IC connected to what I guess is the the Y direction is a 7442 with conventional TTL outputs. That seems to mean that scanning an X column with a pressed key causes an open-collector pulling low to compete with the TTL high output on the Y row, except when the Y scan tests that line with a TTL low. What good that does is a mystery. That, and I haven&#8217;t finished tracing out the part of the circuit with an LM319 comparator. The 3600 schematic drives the X columns (one low, the rest high) and muxes the Y rows (driving ordinary inputs through any pressed keys) to the readout.</p>
<p>[UPDATE: Seems that the keyboard protocol should be identical, so I'm going to forge ahead with the plan, and assume the circuit knows how to work itself.]</p>
<p>[UPDATE 2: fixed the link to the online 3600 schematic.]</p>
<p>[UPDATE 3: I probably should have given more explicit acknowledgment for the inspiration of the project. If I had not seen <a href="http://www.asciilifeform.com/" title="asciilifeform's blog" target="_blank">asciilifeform</a>'s schematic revealing the simplicity of the protocol, I'm sure I would have been far less tempted to start this project.]</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[MacIvory speaks!]]></title>
<link>http://jaoswald.wordpress.com/2007/08/08/macivory-speaks/</link>
<pubDate>Wed, 08 Aug 2007 13:32:34 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/08/08/macivory-speaks/</guid>
<description><![CDATA[I&#8217;ve only had a bit of time to play with my MacIvory, but already things are getting interesti]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I&#8217;ve only had a bit of time to play with my MacIvory, but already things are getting interesting.</p>
<p>One is getting used to the system administration style: typical UNIX system configuration resides in text files, and the boot process reads them. Genera is different. The state of the system is contained in the memory image (&#8220;world&#8221;); you change it through various operations&#8212;some interactive, some by loading Lisp files&#8212;and preserve it by saving a new world as a file, which can be defined incrementally based on an existing world. The boot process involves loading that saved file back into the living Lisp machine. I haven&#8217;t yet developed the sense to complete a block of tasks before saving the world, and how much change pushes one from incremental to a complete world.</p>
<p>Another was getting the network to speak, and part of that is the timewarp of working in Mac OS 7, an era in which Mac networking was going through the introduction of Open Transport, and an AppleTalk era which Mac OS X refuses to acknowledge. Luckily, I&#8217;ve got a PowerBook G3 that runs Mac OS 9. My first ethernet card didn&#8217;t work, either because I screwed up some software setting or because the hardware was bad. (More embarrassing disclosure later.) DKS sent me a replacement, which worked immediately. I&#8217;ve only got ChaosNet configured on the MacIvory side at this point, and my ChaosNet work isn&#8217;t up-to-date on my Powerbook, so I&#8217;ve only seen raw ethernet packets in tcpdump, but my archaeology is already progressing&#8212;documentation to follow soon, as well as getting some Python software (with libpcap or Mac OS X kernel packet filters?) to respond to Chaos-formatted Ethernet packets.</p>
<p>As for the embarrasing disclosure, one of the first things I did was try to set the video card to a mode not supported by my Sony Multisync 15sf monitor. Instead of waiting for the change to timeout and revert, I hit Esc or Command-. or some other key which confirmed the change, leaving me with a blank screen. I tried various reboot, PRAM zapping, or magic key sequences to force the Radius Precision Color 24X to a good mode, but none of that worked, and at some point I screwed up the system. Once I hooked up the Dell 2007fp that understood 1152&#215;870, I saw the floppy-with-blinking-question-mark. Recovery without a working network card involved the ancient hassles of multiple-floppy installs.</p>
<p>I have a Kensington ADB multi-button mouse, but all the drivers I have downloaded are either for Mac OS 8 or cause serious bugginess: system freezes or error -192 when launching the configuration application. I hope I don&#8217;t have to roll my own software to get multi-button goodness to work with the Ivory. (At this date, few vendors pay much attention to 68k Macintosh support.)</p>
<p>UPDATE: I&#8217;ve captured a bit of the tcpdump results in my <a href="http://jaoswald.wordpress.com/chaosnet-information/" title="ChaosNET information" target="_blank">ChaosNET information page</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Ordering a Lisp machine]]></title>
<link>http://jaoswald.wordpress.com/2007/07/11/ordering-a-lisp-machine/</link>
<pubDate>Wed, 11 Jul 2007 17:03:00 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/07/11/ordering-a-lisp-machine/</guid>
<description><![CDATA[Just sent off the Paypal payment for a MacIvory II system with 2.6 MW of memory. I&#8217;m hoping al]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Just sent off the Paypal payment for a MacIvory II system with 2.6 MW of memory. I&#8217;m hoping also to get a Symbolics keyboard, although Symbolics is apparently out of the ADB box that allows the keyboard to be used with the vintage Macs.</p>
<p>It was a tough call whether to splurge for this or, for about twice the money, a new MacBook Pro. I&#8217;m hoping the Symbolics machine will be much more entertaining.</p>
<p>My main idea of a project is to use the Lisp Machine as a Chaos FILE host, in order to allow development on the CADR simulator with a versioned file system, without having to simulate and learn ITS or TOPS-20.  To get that to work, I probably will need to do a little bit of investigation to understand how the Symbolics box gets configured to talk on the network, what Chaos packets look like on the Ethernet, how to get those to my Python/Lisp code on the modern machine, and, for data security what would be needed to talk to a CD-ROM drive on a remote computer, or to use a remote computer to do backups (to a simulated tape drive?).  In order to get 2.6 MW of NuBus memory, I had to choose a Mac config without a CD-ROM drive, and I&#8217;m not too excited about trying to get an external SCSI drive for this old machine. Backing up to floppies is another thing I don&#8217;t want to relive.</p>
<p>Some other things I&#8217;m looking forward to are Zmail, Concordia (to generate HTML output, anyone?) and Document Examiner,  using CLIM, and grokking the Symbolics compiler(s).</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Linux/BSD with &#8220;Lisp personality&#8221;?]]></title>
<link>http://jaoswald.wordpress.com/2007/03/13/linuxbsd-with-lisp-personality/</link>
<pubDate>Tue, 13 Mar 2007 15:55:23 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/03/13/linuxbsd-with-lisp-personality/</guid>
<description><![CDATA[I have been kicking around a few ideas in the Lisp OS direction, and wanted to capture this one. The]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have been kicking around a few ideas in the Lisp OS direction, and wanted to capture this one.</p>
<p>The problem I see with a classic Lisp OS is that the architecture is either completely new, and therefore will take a lot of work to get to near parity with Lisp-on-current-OS, possibly revealing serious deficiencies before it gets there (e.g., I believe Genera would require substantial clean-up work to port to a typical SMP system), or is roughly similar to a current OS, and therefore, what real difference does it make to write it in Lisp, except fun and NIH?</p>
<p>Instead, I think it makes sense to try to address any performance issues a current OS kernel causes for Lisp, and possibly to incorporate the basic &#8220;Lisp core&#8221; as a kernel personality, meaning simple Lisp executables could be lightweight. Meanwhile, you get all the driver work the usual kernel guys provide, with SMP, optimized virtual memory and file systems, robust networking stacks, etc. <a title="Yi Feng homepage" href="http://www.cs.umass.edu/~yifeng/">Some people</a> have worked on kernel patches that help Java virtual machines give hints to the Linux virtual memory system.</p>
<p>Lisp guys get a set of kernel patches to make their life somewhat nicer if they own their box, with 100% Linux compatibility for all of their other needs, and in the real world, as opposed to dreams of Lisp paradise that never materialize. And if the Lisp personality is really nice, one could look at more kernel extensions (some kind of very Lispy inter-process communication, for instance).</p>
<p>I really just want a way for the core Lisp library and system Lisp globals to be provided by the kernel, protected against modification by the user process, except through syscalls, try to figure out a simple but nice memory map to support this, looking at linking GC to the scheduler and/or virtual memory in some way if it would help performance, possibly handling the memory protection barriers without a context switch, or providing a &#8220;shadow&#8221; GC thread for every Lisp process.</p>
<p>Most of the Lisp stuff would come from an implementation like SBCL (or at least compatible calling conventions and memory layout, so that the compiler work could eventually be used), perhaps with some surgery being done on the process memory map and &#8220;purification&#8221; to separate the Lisp into chunks such as</p>
<ul>
<li>Basic Lisp library (car, cdr, NIL, aref, &#8230;, basically the CL package), non-volatile, shared between Kernel Lisp and user Lisp processes.</li>
<li>&#8220;Lispux&#8221; package that wraps the OS networking stacks, multithreading support, etc., non-volatile, provided to user Lisp processes. Kernel Lisp wouldn&#8217;t use these.</li>
<li>A memory space holding Lisp system globals (glimpse of the underlying OS environment; maybe some interprocess communication stuff)</li>
<li>A memory space holding Lisp-specific kernel structures; for instance, GC bookkeeping. The Kernel Lisp would presumably include the code to handle garbage collection events. The user process would not be allowed to muck with these. There would also probably be a Kernel Lisp heap unless it could be written to be totally non-consing.</li>
<li>The Kernel Lisp FASL; this is the portion of the Kernel Lisp implementation written in Lisp.</li>
<li>A memory space holding the user process&#8217;s &#8220;purified&#8221; executable image. Possibly partitioned into non-volatile portions and usual dynamic portions.</li>
<li>Usual process heap, process stack</li>
<li>Some kind of support for shared pages of tagged data, that can only be usefully shared with other Lisp-aware processes.</li>
</ul>
<p>One of the main issues I am trying to get my head around is what Lisp tagged data looks like when the context switch is made to kernel space. In order for GC to work, the pointer values which make sense under the user process memory map must still make sense in the GC context. This makes me think that the Kernel Lisp needs to have basically the same memory layout, with the current Lisp process mapped into it at the standard location, but with different permissions, and with certain parts visible that are invisible in the user context. I believe this is quite different from Linux; from what I can tell, the Linux kernel simply sees the skeleton of the process (the kernel memory map structure, and which pages of physical memory the process has in core), but has to do special work to follow a pointer, for instance. It seems to me doing GC like this would require more overhead than it could save.<br />
I&#8217;m wondering whether there is a better alternative to Linux; the main criteria are source hackability, acceptance in the Lisp community, acceptable driver support both current and in the future (including SMP, because that is where the future is going), and relatively good existing applications support. The only alternatives I see is are the BSD variants. I don&#8217;t know which of these makes the most sense. I&#8217;m guessing SBCL/x86/Linux folks represent the bulk of people who would be interested in something like this. It would be nice to have an explicit mechanism for different &#8220;personalities&#8221; so that launching an executable FASL would invoke this personaity, but launching a native binary would not see anything much different (except perhaps for a few new syscalls that provide hooks to some of the Lispy goodness, or maybe just an ability to inspect and debug Kernel Lisp.)</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Lisp hacking]]></title>
<link>http://jaoswald.wordpress.com/2006/06/04/lisp-hacking/</link>
<pubDate>Sun, 04 Jun 2006 18:45:56 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2006/06/04/lisp-hacking/</guid>
<description><![CDATA[I wanted to store a link to Alastair Bridgewater&#8217;s (a.k.a. nyef on IRC) SBCL-based LispOS note]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I wanted to store a link to <a href="http://www.lisphacker.com/">Alastair Bridgewater&#8217;s</a> (a.k.a. nyef on IRC) <a href="http://www.lisphacker.com/temp/notes.txt">SBCL-based LispOS notes</a>. </p>
<p>Nyef&#8217;s most apparent distinguishing characteristic is an amazing willingness to hack low-level internals on Intel x86-based Lisp implementations. Given the claim that &#8220;<a href="http://cbbrowne.com/info/lisposes.html">The classic problem with the &#8216;LispOS Project&#8217; is that a large portion of the early effort would involve low level hardware hacking</a>&#8220;, nyef seems to be the ideal candidate for overcoming that problem.</p>
<p>Also, just wanted to record a link to a vendor selling the <a href="http://top2bottom.net/medley.html">remnants</a> of the Interlisp environment. Seems like for something under US$3000, one can purchase a x86-Linux-compatible version of the Interlisp programming environment. </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Lisp machine in 2007]]></title>
<link>http://jaoswald.wordpress.com/2007/02/12/lisp-machine-in-2007/</link>
<pubDate>Mon, 12 Feb 2007 22:02:49 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/02/12/lisp-machine-in-2007/</guid>
<description><![CDATA[A while back I had some idle thoughts about making Lisp machines relevant in 2006. I updated it when]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>A while back I had some <a href="http://jaoswald.wordpress.com/lisp-machine-in-2006/" target="_blank" title="Lisp Machine in 2006">idle thoughts</a> about making Lisp machines relevant in 2006. I updated it when people clicked there from a Google search result on Lisp Machine keyboard.</p>
<p>Any comments on that page, you can leave them here.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[ChaosNET and Python]]></title>
<link>http://jaoswald.wordpress.com/2007/02/05/chaosnet-and-python/</link>
<pubDate>Mon, 05 Feb 2007 17:30:37 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2007/02/05/chaosnet-and-python/</guid>
<description><![CDATA[My blogging has been much less frequent of late, mostly because of an unfortunate abundance of non-c]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>My blogging has been much less frequent of late, mostly because of an unfortunate abundance of non-computer issues. Despite those, I believe I have made some progress in my Chaosnet-on-OpenMCL work, but I&#8217;ve switched most of my hobby-development to Python, mostly to get in touch with trends outside the Lisp Universe.</p>
<p>My current main project circulates around ChaosNET emulation; the main thing going for Python here is a socket interface that is roughly compatible between UNIX-like and Windows operating systems. Lisp can support that as well, but not for my favorite and familiar implementations. (One thing I hope to try before I get through this is to get an asyncore-like framework set up in CLISP.)</p>
<p>So far, I have implemented a `chaosd&#8217; process in Python that simulates multiple ChaosNET `ethers&#8217; in the form of localhost TCP streams (on Windows or UNIX-like) or UNIX-domain sockets (on UNIX-like); each stream corresponds to a subnet. The idea has manifold goals:</p>
<ul>
<li>Allow the usim CADR simulator to communicate on Windows with minimal alterations using Winsock in place of BSD sockets (Done) (Brad Parker&#8217;s server, however, works with forking and other UNIXisms that would require more work)</li>
<li>Allow separation between local activity and activity exposed or connected to the wider Internet</li>
<li>Provide &#8216;masquerade&#8217; and &#8216;network translation&#8217; bridges, to flexibly map external resources, such as an ITS or TOPS-20 simulator into something that appears to be a local network. (The translation here is necessary because ChaosNET is a LAN architecture; outside resources might have their own incompatible scheme of subnetting and addressing. These translating gateways would allow me to place external UDP-responding resources into arbitrary Chaos addresses in my local scheme, without requiring any change on the external resource.)</li>
<li>Eventually, provide small modular `gateway&#8217; simulators that appear to be ChaosNET resources on a local subnet, but translate to external services such as AOL Instant Messenger or IRC.</li>
<li>Recreate `historically accurate&#8217; network organizations for amusement</li>
<li>If I ever break down and get a real Symbolics machine, I expect it to be able to speak Chaos over IP or raw Ethernet; I would like some way to connect that to multiple simulators on a single Mac or PC</li>
</ul>
<p>As a step in this direction, I have implemented a stream-to-UDP masquerade, that automatically takes traffic on a local `ether&#8217; for a particular address and feeds it over UDP using Bjorn Victor&#8217;s protocol. Running this on two machines, I am able (mostly) to allow a Lisp machine simulator on my Linux box and another on my Windows box to both believe they are on a single Chaosnet LAN, and to communicate with one another. The next step is to get something like a local ITS or TOPS-20 simulator running in KLH-10 on Linux supporting Bjorn&#8217;s UDP protocol (or possibly Bjorn&#8217;s machine) to provide FILE service and e-mail service to my Lisp machine simulators on either machine. I have been learning to recompile ITS, with mixed success. My initial impressions on Python in another post.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[More adventures in multithreading]]></title>
<link>http://jaoswald.wordpress.com/2006/07/31/more-adventures-in-multithreading/</link>
<pubDate>Mon, 31 Jul 2006 15:39:36 +0000</pubDate>
<dc:creator>jaoswald</dc:creator>
<guid>http://jaoswald.wordpress.com/2006/07/31/more-adventures-in-multithreading/</guid>
<description><![CDATA[Just wanted to capture a few more thoughts; over the weekend, I experienced what I think was my firs]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Just wanted to capture a few more thoughts; over the weekend, I experienced what I think was my first case of deadlock. My chaosnet-on-OpenMCL implementation had worked just fine when the two sides of a connection were careful to exchange only one packet at a time, taking turns. When I tried to listen to a SEND (the Lisp machine analogue to an instant message), the CADR emulator sent two packets in quick succession, and my OpenMCL process would freeze trying to receive it.</p>
<p>As an aside, I get the feeling that I don&#8217;t really know how to debug this kind of thing in OpenMCL: looking at backtraces does not always make it completely obvious which semaphore or lock is being waited for in the various threads, and I don&#8217;t think it is possible to look at semaphores to see which thread(s) are waiting.</p>
<p>In any case, I concluded that my somewhat haphazard use of a &#8220;count lock&#8221; to protect access to packet number information in a connection was either being used recursively, or violating a lock heirarchy. So, after some time trying to apply my powers of deduction, I decided to look at the ChaosNET problem from a high level to determine what locking is actually necessary.</p>
<p>The main complexity has to do with the transmission window. In theory, it seems like an ideal case for a counting semaphore: the send window is a limited resource, and sending processes must wait until a spot within the window is available. (Generally, one would wish to preserve FIFO order, but strictly speaking, multiple threads trying to transmit on the same channel might not deserve any guarantees that their packets will happen in any particular order.)</p>
<p><em>However</em>, there are several things unusual about the window: the thread handling incoming packets can get both acknowledgements in ordinary packets, as the receiving user process consumes packets from the window, and in STS packets that could, at any time <em>resize</em> the window. In the usual semaphore model, it is not easy to deterministically reduce the maximum level of the semaphore. I coded an unsatisfactory approach which does a trial-wait-on-semaphore for the number of window packets that have been taken away. But these might not succeed, if the window is filled above the new capacity. In that case, the window must presumably be allowed to drain below the new level before any waiting process gets allowed to put packets in. It might be possible to have a separate integer variable tracking the &#8220;excess window consumption,&#8221; and for processes to loop back and wait again for the semaphore if the window has been &#8220;tightened&#8221; since they first waited. I don&#8217;t know if it is possible for threads to maintain their original FIFO order in this case, or whether it matters. (I&#8217;m not sure it is reasonable for Chaos processes to reduce the window, once it is declared in the initial STS negotiating the connection, as opposed to widening it to allow for better throughput. The AIM memo is silent on this.)</p>
<p>Interestingly, the draft chaosnet memo does discuss enlarging and shrinking the window, and mentions WIN and WTS packets.</p>
<p>In terms of avoiding deadlock, there are many participants: the user reading process looks at the window to see if the connection might be getting &#8220;stymied&#8221;, and needs an STS to be transmitted. When STS or acknowledgements come in, the retransmission of the receipted or acknowledged packets should be suppressed, and the acknowledgements (but not receipts) open up space in the window. In the Lisp Machine design, the receive-sts et al. use the RECEIPT function to trim the send-pkts list. I felt that contending with the sending/retransmitting process was asking for trouble. Therefore, I chose to have the retransmission process look at the receipt and acknowledgement status to clean up the send-pkts while it needs exclusive access to the send-pkts list anyway. The retransmission process needs access to the send-pkts list to retransmit, and to the counters if it is required to do clean up. Furthermore, updates of the acknowledgement and receipt states should rachet only forward, i.e., a stale packet coming through the pipe should not erase the acknowledgement or receipting indicated by the logically latest packet received up to this point. That requires locking to protect the read-modify-write update of those status numbers.</p>
<p>One interesting gap in the ChaosNET documentation is whether retransmitted packets can or should update their acknowledgement and receipt information to reflect what has happened to the connection in the meantime. The Lisp Machine implementation seems to retransmit the packet byte-for-byte. An alternative would be to update those packets. In practice, I suspect retransmission should be conservative; it is necessary when the receiving process has fallen behind, or the channel is experiencing loss, and the bias should be toward more retransmission than strictly necessary, instead of hoping to &#8220;make up for lost time&#8221; by advancing the state of the return channel.</p>
<p>I have created enough of a system to work with the SEND transaction, except for one detail: in a Chaos &#8220;stream&#8221;, my functions indicate an EOF condition only when the request for a byte has gone &#8220;off the end.&#8221; I felt the EOF detection should predict whether the next byte request should succeed; but I could not remember how this works elsewhere.</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
