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

<channel>
	<title>Loper OS</title>
	<atom:link href="http://www.loper-os.org/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.loper-os.org</link>
	<description>Because Computing Doesn&#039;t Have to Suck.</description>
	<lastBuildDate>Tue, 08 May 2012 21:35:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>May 2012 Update</title>
		<link>http://www.loper-os.org/?p=858</link>
		<comments>http://www.loper-os.org/?p=858#comments</comments>
		<pubDate>Tue, 08 May 2012 21:35:08 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[Cold Air]]></category>
		<category><![CDATA[Computation]]></category>
		<category><![CDATA[Hot Air]]></category>
		<category><![CDATA[LoperOS]]></category>
		<category><![CDATA[Progress]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=858</guid>
		<description><![CDATA[At present, I have taken a break from the hardware aspects of Loper &#8211; to work on &#8220;Jupiter,&#8221; a Linux-based emulator of the system&#8217;s essential aspects.  (Think QEMU.)
Jupiter is unlikely to be of any practical use to anyone but myself.   However, at some point, I will make it public, so that interested  persons [...]]]></description>
			<content:encoded><![CDATA[<p>At present, I have taken a break from the <a href="../?p=846">hardware aspects of Loper</a> &#8211; to work on &#8220;Jupiter,&#8221; a Linux-based emulator of the system&#8217;s essential aspects.  (Think <a href="http://en.wikipedia.org/wiki/QEMU">QEMU</a>.)</p>
<p>Jupiter is unlikely to be of any practical use to anyone but myself.   However, at some point, I will make it public, so that interested  persons who do not have access to a Xilinx FPGA board can study the  design.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=858</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Happy Cosmonautics Day</title>
		<link>http://www.loper-os.org/?p=854</link>
		<comments>http://www.loper-os.org/?p=854#comments</comments>
		<pubDate>Thu, 12 Apr 2012 14:13:03 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[NonLoper]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=854</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://en.wikipedia.org/wiki/Cosmonautics_Day"><img class="aligncenter" src="http://www.loper-os.org/wp-content/sovcosm.png" alt="" width="543" height="480" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=854</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>The curious incident of the Lisp in the night-time</title>
		<link>http://www.loper-os.org/?p=849</link>
		<comments>http://www.loper-os.org/?p=849#comments</comments>
		<pubDate>Fri, 16 Mar 2012 17:55:59 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[Distractions]]></category>
		<category><![CDATA[Hot Air]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[NonLoper]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=849</guid>
		<description><![CDATA[Gregory (Scotland Yard detective): &#8220;Is there any other point to which you would wish to draw my attention?&#8221;
Holmes: &#8220;To the curious incident of the dog in the night-time.&#8221;
Gregory: &#8220;The dog did nothing in the night-time.&#8221;
Holmes: &#8220;That was the curious incident.&#8221;
- &#8220;Silver Blaze&#8221; (Sir Arthur Conan Doyle)
Yesterday, I heard a lecture by David M. Baggett, a [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left; padding-left: 30px;"><em>Gregory (Scotland Yard detective): &#8220;Is there any other point to which you would wish to draw my attention?&#8221;<br />
Holmes: &#8220;To the curious incident of the dog in the night-time.&#8221;<br />
Gregory: &#8220;The dog did nothing in the night-time.&#8221;<br />
Holmes: &#8220;That was the curious incident.&#8221;<br />
- <a href="http://en.wikipedia.org/wiki/Silver_Blaze">&#8220;Silver Blaze&#8221; (Sir Arthur Conan Doyle)</a></em></p>
<p>Yesterday, I heard a lecture by <a href="http://www.cs.umd.edu/alumni/baggett/baggett.shtml">David M. Baggett</a>, a well-known software businessman.  Baggett was a co-author of the world-famous game &#8220;<a href="http://www.franz.com/success/customer_apps/animation_graphics/naughtydog.lhtml">Crash Bandicoot</a>&#8221; and co-founder of <a href="http://www.franz.com/success/customer_apps/data_mining/itastory.lhtml">ITA Software</a>.  Baggett credited a number of things, including luck, with the success of his ventures &#8212; but did not mention <a href="http://www.loper-os.org/?p=85">Lisp</a> even once.</p>
<p>I can think of a number of possible reasons for this omission.  But perhaps it boils down to the simple fact that even a truly-superb marathon runner, when showing the world his gold medal, would rather not mention the <a href="http://en.wikipedia.org/wiki/Seven-league_boots">seven-league boots</a> he wore.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=849</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>March 2012 Update</title>
		<link>http://www.loper-os.org/?p=846</link>
		<comments>http://www.loper-os.org/?p=846#comments</comments>
		<pubDate>Tue, 13 Mar 2012 17:56:03 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[Cold Air]]></category>
		<category><![CDATA[Computation]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Hot Air]]></category>
		<category><![CDATA[LoperOS]]></category>
		<category><![CDATA[Progress]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=846</guid>
		<description><![CDATA[Loper&#8217;s I2C controller is working.  The SPD ROM on the DDR2 RAM stick attached to the Xilinx ML-501 board is read correctly.  The video controller is working (though not feature-complete.)  The DDR2 SDRAM controller is still under testing, as is the cache SRAM controller.  The gigabit Ethernet controller is not yet complete.
I should probably say [...]]]></description>
			<content:encoded><![CDATA[<p>Loper&#8217;s <a href="http://en.wikipedia.org/wiki/I%C2%B2C">I2C controller</a> is working.  The <a href="http://en.wikipedia.org/wiki/Serial_presence_detect">SPD ROM</a> on the DDR2 <a href="http://en.wikipedia.org/wiki/Sodimm">RAM stick</a> attached to the <a href="http://www.xilinx.com/products/boards-and-kits/HW-V5-ML501-UNI-G.htm">Xilinx ML-501</a> board is read correctly.  The video controller is working (though not feature-complete.)  The DDR2 SDRAM controller is still under testing, as is the cache SRAM controller.  The gigabit Ethernet controller is not yet complete.</p>
<p>I should probably say a few words about the (presently experimental) Loper machine architecture.  The paradigm of choice is <a href="http://en.wikipedia.org/wiki/Dataflow_architecture">dataflow computation</a>.  The goal is to create something which can one day be seamlessly converted to a fully-asynchronous design, implemented using <a href="http://en.wikipedia.org/wiki/C-element">Muller C-gates</a>. The latter is extremely difficult (though not entirely impossible) on available FPGAs, so the &#8220;adult&#8221; form of the design would have to be fabbed in actual silicon (fat chance of this, at least in my lifetime.)</p>
<p>Loper has no &#8220;cores&#8221;, no instruction set (in the usual sense,) no interrupts or DMA.  These concepts are, for the most part, artifacts of the Von Neumann paradigm.  That is to say, <a href="http://en.wikipedia.org/wiki/Epicycles">epicycles</a>.  And the destiny of epicycles is &#8212; <strong>to go away: </strong><em><span>&#8220;Beauty is the first test: <em>there is no permanent</em> place in this world for <em>ugly mathematics</em>.&#8221;</span></em><span> (</span><span><a href="http://en.wikiquote.org/wiki/G._H._Hardy">G. H. Hardy</a>)<br />
</span></p>
<p><a href="http://www.paulgraham.com/ambitious.html">Eminent people and well-funded organizations would like to resurrect Moore&#8217;s Law.</a> The most straightforward way to do this is to move to a fully-asynchronous dataflow architecture, where you can buy computational capacity &#8220;by the pound,&#8221; so long as your bottlenecks consist of something at least theoretically parallelizable. But they will not succeed, because they are unwilling to let go of the epicycles.  Their investment in existing idiocies &#8211; not only monetary, but psychological &#8211; is far too great.</p>
<p>Also note that the motives of the would-be Moore&#8217;s Law resurrectors are far from pure.  Scarcely anyone wishes to sell you <a href="http://www.loper-os.org/?p=300">a genuinely-fast computer</a>.  What is really happening is that shitware peddlers fear that their days of selling ever-more bloated bloatware written by <a href="http://www.loper-os.org/?p=69">progressively-deskilled slave laborers</a> might be coming to an end.  The introduction of practical dataflow machines could save these wretches, but only in the sense of &#8220;destroying the village in order to save it.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=846</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Programmer&#8217;s Editors, Illustrated.</title>
		<link>http://www.loper-os.org/?p=836</link>
		<comments>http://www.loper-os.org/?p=836#comments</comments>
		<pubDate>Sun, 11 Mar 2012 02:57:07 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[Hot Air]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[SoftwareSucks]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=836</guid>
		<description><![CDATA[Edit: The moral of the story, for those who didn&#8217;t get it, is that a serious programming environment ought to be an intimately-personalized affair, like eyeglasses or a hearing aid.  And that existing solutions fall laughably short of this goal.  Emacs, the supposed counter-example, is conceptually heavy and unbearably complex for everyday &#8220;civilian&#8221; use &#8211; [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter" style="width: 650px"><a href="http://www.loper-os.org/wp-content/editors.png"><img title="Programmers Editors, Illustrated." src="http://www.loper-os.org/wp-content/s_editors.png" alt="Click for full size." width="640" height="416" /></a><p class="wp-caption-text">Click for full size.</p></div>
<hr /><em>Edit:</em> The moral of the story, for those who didn&#8217;t get it, is that a serious programming environment ought to be an intimately-personalized affair, like eyeglasses or a hearing aid.  And that existing solutions fall laughably short of this goal.  <em>Emacs</em>, the supposed counter-example, is conceptually heavy and unbearably complex for everyday &#8220;civilian&#8221; use &#8211; like the <a href="http://en.wikipedia.org/wiki/Phoropter">phoropter</a> in the upper left hand corner.  <em>Vi</em>, another favorite, is reminiscent of the <a href="http://www.yankodesign.com/2007/03/06/stenop-low-cost-glasses-by-nacho-marti/">stenopeic eyeglasses</a> that are sometimes donated to poor countries: a &#8220;one size fits all&#8221; wrong tool for every job. Where, then, is the environment which adapts to its user, rather than demanding that its user adapt to it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=836</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Stierlitz Example: Memory-Mapped I/O to a Character LCD</title>
		<link>http://www.loper-os.org/?p=797</link>
		<comments>http://www.loper-os.org/?p=797#comments</comments>
		<pubDate>Tue, 06 Mar 2012 02:55:26 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[Cold Air]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[LoperOS]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=797</guid>
		<description><![CDATA[Here is a somewhat dumb example of the kind of thing one can do with Stierlitz.  Let&#8217;s say that you have some memory-mapped I/O ports in your system architecture, which you would like to test without having a working CPU design of any kind loaded into your FPGA.
The Xilinx ML501 board includes a Tianma-TM162, which [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a somewhat dumb example of the kind of thing one can do with <a href="http://www.loper-os.org/?p=702">Stierlitz</a>.  Let&#8217;s say that you have some memory-mapped I/O ports in your system architecture, which you would like to test without having a working CPU design of any kind loaded into your FPGA.</p>
<p>The <a href="http://www.xilinx.com/products/boards-and-kits/HW-V5-ML501-UNI-G.htm" target="_blank">Xilinx ML501</a> board includes a <a href="http://www.xilinx.com/products/boards/ml501/datasheets/TM162VCA6_SPEC.pdf">Tianma-TM162</a>, which is a <a href="http://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller">Hitachi-compatible</a> character LCD module.  This is a gadget familiar to many electronics hobbyists.  Let&#8217;s create a memory-mapped port to access this device.</p>
<p>First, instantiate a Stierlitz in your top-level Verilog module:</p>

<div class="wp_syntax"><div class="code"><pre class="verilog" style="font-family:monospace;"><span style="color: #A52A2A; font-weight: bold;">wire</span> 	sbus_ready<span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">wire</span> 	sbus_rw<span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">wire</span> 	sbus_start_op<span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">wire</span> <span style="color: #9F79EE;">&#91;</span><span style="color: #ff0055;">40</span><span style="color: #5D478B;">:</span><span style="color: #ff0055;">0</span><span style="color: #9F79EE;">&#93;</span> 	sbus_address<span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">wire</span> <span style="color: #9F79EE;">&#91;</span><span style="color: #ff0055;">7</span><span style="color: #5D478B;">:</span><span style="color: #ff0055;">0</span><span style="color: #9F79EE;">&#93;</span> 	sbus_data<span style="color: #5D478B;">;</span>
&nbsp;
stierlitz foo<span style="color: #9F79EE;">&#40;</span>.clk<span style="color: #9F79EE;">&#40;</span>hpi_clock<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span> <span style="color: #00008B; font-style: italic;">/* 16MHz clock */</span>
	       .reset<span style="color: #9F79EE;">&#40;</span>usbreset<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span> <span style="color: #00008B; font-style: italic;">/* Reset (active-high) */</span>
	       .enable<span style="color: #9F79EE;">&#40;</span><span style="color: #ff0055;">1'b1</span><span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span> <span style="color: #00008B; font-style: italic;">/* Hardwired ON for now */</span>
	       <span style="color: #00008B; font-style: italic;">/* Control wiring */</span>
	       .bus_ready<span style="color: #9F79EE;">&#40;</span>sbus_ready<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .bus_address<span style="color: #9F79EE;">&#40;</span>sbus_address<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .bus_data<span style="color: #9F79EE;">&#40;</span>sbus_data<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .bus_rw<span style="color: #9F79EE;">&#40;</span>sbus_rw<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .bus_start_op<span style="color: #9F79EE;">&#40;</span>sbus_start_op<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       <span style="color: #00008B; font-style: italic;">/* CY7C67300 connections */</span>
	       .cy_hpi_address<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .cy_hpi_data<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .cy_hpi_oen<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .cy_hpi_wen<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .cy_hpi_csn<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .cy_hpi_irq<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
	       .cy_hpi_resetn<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span>
	       <span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">;</span></pre></div></div>

<p>Use the read/write logic from the earlier <a href="https://github.com/asciilifeform/Stierlitz/blob/master/ml501/stierlitz_demo_top.v">&#8220;128K of SRAM&#8221; example</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="verilog" style="font-family:monospace;"><span style="color: #A52A2A; font-weight: bold;">wire</span> ram_we<span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">wire</span> ram_oe<span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">assign</span> ram_we <span style="color: #5D478B;">=</span> <span style="color: #9F79EE;">&#40;</span><span style="color: #5D478B;">~</span>sbus_rw<span style="color: #9F79EE;">&#41;</span> <span style="color: #5D478B;">&amp;</span> sbus_start_op<span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">assign</span> ram_oe <span style="color: #5D478B;">=</span> sbus_rw <span style="color: #5D478B;">&amp;</span> sbus_start_op<span style="color: #5D478B;">;</span></pre></div></div>

<p>Now let&#8217;s create an 8-bit memory-mapped output (at the very bottom of the address space) which maps to the LCD&#8217;s data port:</p>

<div class="wp_syntax"><div class="code"><pre class="verilog" style="font-family:monospace;"><span style="color: #A52A2A; font-weight: bold;">assign</span> LCD_E <span style="color: #5D478B;">=</span> <span style="color: #9F79EE;">&#40;</span><span style="color: #9F79EE;">&#40;</span>sbus_address<span style="color: #9F79EE;">&#91;</span><span style="color: #ff0055;">40</span><span style="color: #5D478B;">:</span><span style="color: #ff0055;">0</span><span style="color: #9F79EE;">&#93;</span> <span style="color: #5D478B;">==</span> <span style="color: #ff0055;">4</span><span style="color: #ff0055;">1'b0</span><span style="color: #9F79EE;">&#41;</span> <span style="color: #5D478B;">&amp;&amp;</span> ram_we<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">assign</span> LCD_RS <span style="color: #5D478B;">=</span> sbus_data<span style="color: #9F79EE;">&#91;</span><span style="color: #ff0055;">7</span><span style="color: #9F79EE;">&#93;</span><span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">assign</span> LCD_RW <span style="color: #5D478B;">=</span> <span style="color: #ff0055;">0</span><span style="color: #5D478B;">;</span>
<span style="color: #A52A2A; font-weight: bold;">assign</span> LCD_DB<span style="color: #9F79EE;">&#91;</span><span style="color: #ff0055;">7</span><span style="color: #5D478B;">:</span><span style="color: #ff0055;">4</span><span style="color: #9F79EE;">&#93;</span> <span style="color: #5D478B;">=</span> sbus_data<span style="color: #9F79EE;">&#91;</span><span style="color: #ff0055;">3</span><span style="color: #5D478B;">:</span><span style="color: #ff0055;">0</span><span style="color: #9F79EE;">&#93;</span><span style="color: #5D478B;">;</span></pre></div></div>

<p>Now, the Lisp. Open the Stierlitz image:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>defvar *stierlitz*
  <span style="color: #66cc66;">&#40;</span>open-stierlitz-image <span style="color: #ff0000;">&quot;/mnt/usb/LOPERIMG.BIN&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>The exact way in which the above works was discussed in the <a href="http://www.loper-os.org/?p=702">original post</a>.</p>
<p>Stierlitz is inescapably wasteful in this case, but it will work perfectly.  This is how we will write to the LCD module&#8217;s data port:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> lcd-data-out <span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>buf <span style="color: #66cc66;">&#40;</span>make-<span style="color: #b1b100;">array</span> <span style="color: #cc66cc;">512</span>
			 <span style="color: #66cc66;">:</span><span style="color: #555;">element-type</span> '<span style="color: #66cc66;">&#40;</span>unsigned-byte <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>
			 <span style="color: #66cc66;">:</span><span style="color: #555;">initial-element</span> #x00<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>stierlitz-seek <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Block zero</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setf</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">aref</span> buf <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> data<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Set zeroth byte to equal datum</span>
    <span style="color: #66cc66;">&#40;</span>write-sequence buf *stierlitz*<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Write to Stierlitz</span>
    <span style="color: #808080; font-style: italic;">;; Force cache flush</span>
    <span style="color: #808080; font-style: italic;">;; We shouldn't have to do this</span>
    <span style="color: #808080; font-style: italic;">;; when O_DIRECT is set ... Linux hate.</span>
    <span style="color: #66cc66;">&#40;</span>stierlitz-seek <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Really basic code to drive the LCD module:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> lcd-write-nibble <span style="color: #66cc66;">&#40;</span>data rs<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Send a nibble to the LCD module.&quot;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>dout
	 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">logior</span>
	  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">logand</span> data #b00001111<span style="color: #66cc66;">&#41;</span>
	  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> rs #b10000000 <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>sleep <span style="color: #cc66cc;">0.01</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Must delay as per the LCD spec</span>
    <span style="color: #66cc66;">&#40;</span>lcd-data-out dout<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> lcd-<span style="color: #b1b100;">write</span> <span style="color: #66cc66;">&#40;</span>byte rs<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Send command or data byte to the LCD module.&quot;</span>
  <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span>* <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>upper-nibble <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">logand</span> <span style="color: #66cc66;">&#40;</span>ash byte -<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span> #xF<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
	 <span style="color: #66cc66;">&#40;</span>lower-nibble <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">logand</span> byte #xf<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>lcd-write-nibble upper-nibble rs<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>lcd-write-nibble lower-nibble rs<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> lcd-write-char <span style="color: #66cc66;">&#40;</span>char<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Write a character to the LCD module.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>lcd-<span style="color: #b1b100;">write</span> <span style="color: #66cc66;">&#40;</span>char-code char<span style="color: #66cc66;">&#41;</span> t<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> lcd-write-cmd <span style="color: #66cc66;">&#40;</span>cmd<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Write a command to the LCD module.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>lcd-<span style="color: #b1b100;">write</span> cmd <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> lcd-init <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>lcd-<span style="color: #b1b100;">write</span> #b0010 <span style="color: #b1b100;">nil</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Enable 4-bit mode</span>
  <span style="color: #66cc66;">&#40;</span>lcd-write-cmd #b00101000<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Function Set</span>
  <span style="color: #66cc66;">&#40;</span>lcd-write-cmd #b00001100<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Display on, cursor and blink off</span>
  <span style="color: #66cc66;">&#40;</span>lcd-write-cmd #b00000110<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Entry mode set</span>
  <span style="color: #66cc66;">&#40;</span>lcd-write-cmd #x01<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Clear LCD</span></pre></div></div>

<p>Now let&#8217;s try actually using all of this:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>lcd-init<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Initialize LCD module.</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; Write some text using the memory-mapped port</span>
<span style="color: #66cc66;">&#40;</span>loop for c across <span style="color: #ff0000;">&quot;www.loper-os.org&quot;</span> <span style="color: #b1b100;">do</span> <span style="color: #66cc66;">&#40;</span>lcd-write-char c<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>The result:</p>
<p><img class="alignnone" title="Character LCD output using Stierlitz." src="http://www.loper-os.org/wp-content/lcdmod.png" alt="" width="480" height="335" /></p>
<p>Nothing earth-shaking here, but this demo ought to make sense to everyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=797</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>For Your Eyes Only</title>
		<link>http://www.loper-os.org/?p=752</link>
		<comments>http://www.loper-os.org/?p=752#comments</comments>
		<pubDate>Sat, 25 Feb 2012 01:40:39 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[Copyright]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Hot Air]]></category>
		<category><![CDATA[NonLoper]]></category>
		<category><![CDATA[Philosophy]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[Predictions]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=752</guid>
		<description><![CDATA[Rumor has it that a well-known industrial giant will soon attempt to bring head-mounted displays back into fashion.
One ought to remember that, for a number of reasons, they were never really &#8220;in&#8221; fashion to begin with.  To my knowledge, every single one ever marketed fell into one of the following categories:

Military toy, priced somewhere in [...]]]></description>
			<content:encoded><![CDATA[<p>Rumor has it that a well-known industrial giant will soon attempt to bring <a href="http://en.wikipedia.org/wiki/Head_mounted_display">head-mounted displays</a> back into fashion.</p>
<p>One ought to remember that, for a number of reasons, they were never really &#8220;in&#8221; fashion to begin with.  To my knowledge, every single one ever marketed fell into one of the following categories:</p>
<ol>
<li>Military toy, priced somewhere in the luxury-car to small airplane range. (<a href="http://www.emagin.com/applications/">Typical example here.</a>)</li>
<li>Consumer-grade, low-resolution garbage, suitable only for watching pornography on airplanes.  (<a href="http://www.amazon.com/Myvu-Personal-Viewer-Universal-MA-0483/dp/B000VKY0J6/ref=sr_1_2?ie=UTF8&amp;qid=1330131325&amp;sr=8-2">Typical example here.</a>)</li>
</ol>
<p>Except for one: the Reflection Technology Private Eye.  Circa 1989 (!).  This particular gadget had a 720&#215;280 monochrome display, implemented using a clever electromechanical principle. The Private Eye was a monocle and not particularly comfortable to use.  I got <a href="http://www.loper-os.org/vintage/paralleleye/eye.html">mine</a> rather cheaply from a collector back in 2004:</p>
<div class="wp-caption aligncenter" style="width: 510px"><img title="Private Eye P4" src="../vintage/paralleleye/p4_frame.png" alt="" width="500" height="375" /><p class="wp-caption-text">Reflection Technology Private Eye P4.</p></div>
<div class="wp-caption aligncenter" style="width: 510px"><img title="Private Eye P4 Screenshot" src="../vintage/paralleleye/eye_screen.png" alt="" width="500" height="400" /><p class="wp-caption-text">Looking through the Private Eye.</p></div>
<p style="text-align: left;">The above product was (and, weirdly, still is!) the best of its class &#8211; that is, the most practically-useful head-mounted display that a normal person might be able to buy.  And yet it has a number of serious problems; chief among them is the fact that most people have <em>two</em> eyes.  Both of which like to be in use at the same time.</p>
<p style="text-align: left;">It would certainly be interesting to see a modern incarnation of such a thing.  The thing in question being a head-mounted display, suitable for viewing a reasonable screen-full of text &#8211; and one which costs less than a new car.  But somehow I suspect that at least one of these conditions will not be met by the (allegedly) upcoming new product.  High-resolution microdisplays have existed for a number of years.  I suspect that they are being kept firmly off the consumer market by patent trolls.</p>
<p style="text-align: left;">Now, what &#8220;killer app&#8221; awaits the head-mounted display?  What application would be lucrative enough to overcome the resistance of mighty patent trolls, and cause the gadget to actually be produced and aggressively marketed?</p>
<p style="text-align: left;">I&#8217;ve got some bad news&#8230; The killer app is quite likely to be the one described in the following story, <span style="text-decoration: line-through;">whose author is unknown to me</span> (<span style="text-decoration: line-through;">please speak up if you happen to read this!</span> <a href="#notes">[1]</a>)  I found it on an obscure forum sometime in 2007, and translated it from the original Russian.  Behold:</p>
<p><a name="2018"></a></p>
<hr /><em>In a typical Moscow apartment, in the year 2018:</em></p>
<p><em>- Dad, can I grab 99 bucks from your card? I&#8217;ve got to pay for a book&#8230;</em> <em><br />
- Oh, what sort of book?<br />
- Well, um, Dostoevsky. &#8220;Crime and Punishment&#8221;.<br />
- But why do you need to buy it? We have it.<br />
- Oh? What file&#8217;s it in?<br />
- What do files have to do with it? Here it is, on the shelf..<br />
- Ugh. That&#8217;s a paper book!<br />
- So, what? I was your age when I read it.<br />
- My age, my age&#8230; It hasn&#8217;t got a search. How do you think I&#8217;m going  to find quotes? There&#8217;s no audio-accompaniment. No animations. Just the  text, where you can&#8217;t even change the font&#8230; I&#8217;ll be the laughing stock  of the whole school! *You* read it.<br />
- Well, all right. Here, take the DVD. I bought it fifteen years ago or so.<br />
- What? A DVD? And what do you think I can read that antique with? Give  it to a technology museum. Maybe you&#8217;ll offer me Dostoevsky on paper  tape next!<br />
- If you&#8217;re so smart, search the net yourself and download it for free.<br />
- You can download a book for free!?<br />
- Well, yes. How else? The copyright on Dostoevsky&#8217;s books expired years ago. No doubt it&#8217;s out there somewhere.<br />
- You&#8217;re kidding, Dad! Maybe in *your* time, at the start of the  century, you could download everything for free. Haven&#8217;t you heard that  five years ago the copyrights to all books were permanently transferred  to the American Association of Book Publishers? Or do you want me to go  to jail for life, like that sect member Dmitri Sklyarov?<br />
- But Dostoevsky wasn&#8217;t an American! What do American publishers have to do with this?<br />
- And who cares about that? Dad, you aren&#8217;t an anti-globalist, are you?<br />
- No, no, son. All right, son, its a pity to spend almost 100 dollars  just for a file. Why don&#8217;t you ask a classmate for a copy? They must  have it. Give them some other file in exchange.<br />
- But! If they give me their Dostoevsky, where could I read it?<br />
- What do you mean, &#8220;where&#8221;? They&#8217;ll read their copies at their homes, and you&#8217;ll read yours here.<br />
- Oh, you&#8217;re totally behind the times! You can only read a book on the  comp where it was bought from. And the polarization code will be  different&#8230; Dad, just give me the cash! I&#8217;ll buy myself a normal book.<br />
- All right. Here&#8217;s a one-time password to remove 99 bucks from our account. In my time 100 dollars was big money&#8230;<br />
- Ok. Downloaded. Thanks.<br />
- Well, let me see it too&#8230; Listen, son, what are all those pictures? Those weren&#8217;t in the novel&#8230;<br />
- Duh, those are the banners. Without banners it costs 699 bucks.The  open file was peppered with blinking ads: &#8220;Axe Professional, 2018 &#8211;  modern axes honed with a laser&#8221;; &#8220;Cosmetic Salon &#8216;At Lizanka&#8217;s&#8217; &#8211; we  won&#8217;t let you turn into a crone&#8221;; &#8220;Bothered by problems? Psychological  services at &#8216;Porphyry&#8217;&#8221;; &#8220;Credit, cash advances, low interest!&#8221;;  &#8220;RASKOLNIKOFF.COM &#8211; sending naughty old ladies anywhere on the globe&#8221;&#8230;<br />
- Listen, son, why can&#8217;t I see the text of the novel? Do I have to wait for the banners to go away?<br />
-  Where have you been, Dad? You can wait forever. You have to read the  text through the polarizer glasses. Without them, all you&#8217;ll see is the  ads!<br />
- What&#8217;s that for?<br />
- What do you mean, what&#8217;s that for? So nobody who hasn&#8217;t paid can read  the book! Think, I buy a book, and someone who didn&#8217;t buy anything could  read it over my shoulder&#8230;<br />
- What foolishness. So what if I put on glasses too?<br />
- Hah! The file&#8217;s set up only </em><em>for</em><em> *my* glasses. Other glasses have different polarization.<br />
- All right, let me see your glasses. I&#8217;ll read through them.<br />
- How will you see? They won&#8217;t recognize your retina. You won&#8217;t see  anything but a notice that you&#8217;re wearing someone else&#8217;s glasses! Dad,  don&#8217;t bother me with your silliness! I&#8217;ve got to read the book before my license runs out. I&#8217;ve gotta read everything fast, or the license  has to be renewed, or the book will self-destruct. Don&#8217;t distract me,  I&#8217;m reading&#8230;</em></p>
<p><em> </em></p>
<p><em>3 hours later&#8230;</em> <em><br />
- Oof! That&#8217;s all. I&#8217;m done reading!<br />
- Really? How did you read all of &#8220;Crime and Punishment&#8221; in three hours?!<br />
- Well, yeah. I&#8217;d have read it faster if it weren&#8217;t for the commercial breaks every half-hour.<br />
- I still don&#8217;t believe it! Who, for example, is Svidrigailov?<br />
- Who, who?<br />
- Aaah, I get it. Who&#8217;s Luzhin? Who&#8217;s Sonya Marmeladova?<br />
- Whoah! How am I supposed to know? I just read the Home Edition. It  only has the part about how Raskolnikov kills the crone with an axe, and  then turns himself in with repentance. To read about all those other  people you&#8217;ve got to buy the Professional version or even the Enterprise  Edition. We just don&#8217;t have that much money.<br />
- Hmm, what madness, where&#8217;s the world going!<br />
- It&#8217;s there already. Should&#8217;ve thought about it fifteen years ago, if not earlier&#8230;</em></p>
<hr />It appears that <a href="http://www.math.purdue.edu/~eremenko/dostoevski-2">another translation</a> also exists!  But I like mine better.</p>
<p><a href="http://www.urbandictionary.com/define.php?term=copyrast">Copyrasts</a> <a href="http://www.loper-os.org/?p=351">will stop at nothing</a> to preserve their stranglehold on modern culture.  So when your favorite hardware vendor offers you a comfortable head-mounted display with a built-in retina scanner (just what the doctor ordered for the <a href="http://www.loper-os.org/?p=288">security</a>-<a href="http://www.loper-os.org/?p=428">conscious</a> consumer!) &#8211; beware&#8230;</p>
<p><a href="http://www.gnu.org/philosophy/right-to-read.html">Richard Stallman&#8217;s &#8220;The Right to Read&#8221;</a> is well on its way to becoming a true story (a large university I live across the street from is, like many others, aggressively pushing DRM-crippled textbooks.)  And so, how much will your grandchildren pay for their Enterprise Editions of Dostoevsky<em> </em>?<br />
<a name="notes"></a></p>
<hr /><em><strong>[1] Edit</strong>: A reader has found what appears to be <a href="http://ctac.livejournal.com/15484.html">the original author</a> of the story.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=752</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Stierlitz, the Fearless, Driver-Less Bus Analyzer.</title>
		<link>http://www.loper-os.org/?p=702</link>
		<comments>http://www.loper-os.org/?p=702#comments</comments>
		<pubDate>Fri, 24 Feb 2012 23:35:16 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[Cold Air]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[LoperOS]]></category>
		<category><![CDATA[Progress]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=702</guid>
		<description><![CDATA[The tool described in this post may be helpful to other ab initio machine-architecture developers.  If any exist.  The rest of Loper will remain in my private code repository, because it is not a collaborative project.
Meet Stierlitz [1], perhaps the world&#8217;s strangest bus analyzer.  For basic use, it requires no software at all on the [...]]]></description>
			<content:encoded><![CDATA[<p>The tool described in this post may be helpful to other <em>ab initio</em> machine-architecture developers.  If any exist.  The rest of Loper will remain in my private code repository, because it is not a collaborative project.</p>
<p>Meet <a href="https://github.com/asciilifeform/Stierlitz" target="_blank">Stierlitz</a> <em>[1]</em>, perhaps the world&#8217;s strangest bus analyzer.  For basic use, it requires <strong>no software at all on the PC end</strong>, except for a reasonably-recent version of Linux.</p>
<p>Are  you designing a new machine architecture from scratch?  Got a bus 31 or  fewer bits wide, on which you would like to perform arbitrary reads and  writes?</p>
<p>Stierlitz will sit on your bus and imitate a USB Mass  Storage device.  The latter will appear to have a FAT16 file system on  it, containing a single binary &#8220;memory image&#8221; file.  (Remember, the maximum  file size under FAT16 is 2GB. Hence 31 bits.)</p>
<p>Mount it (under  Linux, using &#8220;mount -o sync &#8230;&#8221;) and perform block-sized arbitrary  reads/writes by reading or writing blocks within the image &#8220;file.&#8221;  If you  have an ill-behaved kernel which does not fully respect &#8220;-o sync&#8221;, you  may need to perform &#8220;read/write/modify&#8221; cycles to get the intended  results.</p>
<p>Make sure to use the <em>O_DIRECT</em> flag (or the &#8220;raw&#8221; block  device, if your kernel still has one) to disable ALL caching of this &#8220;disk&#8221; on the PC  end.  AFAIK, you cannot do this at all on Windows or Mac OS. Therefore I did  not bother testing Stierlitz on those poor, crippled systems.   Stierlitz contains a reasonably-complete implementation of a <a href="http://en.wikipedia.org/wiki/Usb_mass_storage">USB Mass Storage</a> stack, and, in principle, ought to work on PCs other than my own.</p>
<p>If you snip out the FAT16 emulation, you can get 41 bits of address space.</p>
<p>You will need an FPGA development board with a <a href="../?p=668" target="_blank">Cypress CY7C67300 USB controller</a>, such as the <a href="http://www.xilinx.com/products/boards-and-kits/HW-V5-ML501-UNI-G.htm" target="_blank">Xilinx ML501</a>, and a copy of my <a href="https://github.com/asciilifeform/ezotgdbg" target="_blank">&#8220;EZOTGDBG&#8221;</a> utility.  The only contents of <a href="http://www.cypress.com/?rID=14436" target="_blank">Cypress&#8217;s SDK</a> which you will need to build Stierlitz is <a href="http://www.loper-os.org/pub/qtasm.zip">&#8220;QTASM.EXE&#8221;, the assembler.</a></p>
<p>On the FPGA end, you need <a href="https://github.com/asciilifeform/Stierlitz/blob/master/ml501/stierlitz.v">this</a> reasonably-compact (20 or so Virtex slices) state machine.  The price  paid for this compactness is that the interface does not use the USB  controller&#8217;s <a href="http://en.wikipedia.org/wiki/Direct_memory_access">DMA</a> capability.  This results in I/O speeds somewhat slower than the  theoretical maximum (The CY7C67300 is a USB 1.1 device.)  My tests  currently show ~500KB/s reads and ~200KB/s writes.  This is adequate for  most of the purposes I have in mind.</p>
<p>To use Stierlitz in your Verilog project, instantiate something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="verilog" style="font-family:monospace;">stierlitz foo<span style="color: #9F79EE;">&#40;</span>.clk<span style="color: #9F79EE;">&#40;</span>hpi_clock<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span> <span style="color: #00008B; font-style: italic;">/* 16MHz clock */</span>
.reset<span style="color: #9F79EE;">&#40;</span>usbreset<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span> <span style="color: #00008B; font-style: italic;">/* Reset (active-high) */</span>
.enable<span style="color: #9F79EE;">&#40;</span><span style="color: #ff0055;">1'b1</span><span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span> <span style="color: #00008B; font-style: italic;">/* Hardwired ON for now */</span>
<span style="color: #00008B; font-style: italic;">/* Control wiring */</span>
.bus_ready<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span> <span style="color: #00008B; font-style: italic;">/* &quot;Short Bus&quot; - user interface */</span>
.bus_address<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
.bus_data<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
.bus_rw<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
.bus_start_op<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
<span style="color: #00008B; font-style: italic;">/* CY7C67300 connections */</span>
.cy_hpi_address<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
.cy_hpi_data<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
.cy_hpi_oen<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
.cy_hpi_wen<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
.cy_hpi_csn<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
.cy_hpi_irq<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">,</span>
.cy_hpi_resetn<span style="color: #9F79EE;">&#40;</span>...<span style="color: #9F79EE;">&#41;</span>
<span style="color: #9F79EE;">&#41;</span><span style="color: #5D478B;">;</span></pre></div></div>

<p><a href="https://github.com/asciilifeform/Stierlitz/blob/master/ml501/stierlitz_demo_top.v">There is a basic demo.</a> It gives you a 128K &#8220;file&#8221; mapped to SRAM (you need an FPGA with at least this much &#8220;Block RAM.&#8221;)</p>
<p>But wait, there&#8217;s more!</p>
<p>Here is a very basic set of demo routines in Common Lisp (needs an <a href="http://sbcl.org/">SBCL</a>-only POSIX plugin):</p>
<p>Open a Stierlitz image:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>defconstant +O_DIRECT+ #x4000<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> open-stierlitz-image <span style="color: #66cc66;">&#40;</span>pathname<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Open Stierlitz image using sb-unix with blocking I/O.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>multiple-value-bind <span style="color: #66cc66;">&#40;</span>fd errno<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span>sb-unix<span style="color: #66cc66;">:</span><span style="color: #555;">unix-open</span> pathname
                        <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">logior</span> sb-posix<span style="color: #66cc66;">:</span><span style="color: #555;">o-rdwr</span>
                                sb-posix<span style="color: #66cc66;">:</span><span style="color: #555;">o-sync</span>
                                +O_DIRECT+<span style="color: #66cc66;">&#41;</span>
                         <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>unless fd
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">error</span> <span style="color: #ff0000;">&quot;Could not open Stierlitz image: ~A!~%Errno: ~a~%&quot;</span>
             pathname <span style="color: #66cc66;">&#40;</span>sb-int<span style="color: #66cc66;">:</span><span style="color: #555;">strerror</span> errno<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>sb-sys<span style="color: #66cc66;">:</span><span style="color: #555;">make-fd-stream</span> fd
     <span style="color: #66cc66;">:</span><span style="color: #555;">input</span> t
     <span style="color: #66cc66;">:</span><span style="color: #555;">output</span> t
     <span style="color: #66cc66;">:</span><span style="color: #555;">element-type</span> '<span style="color: #66cc66;">&#40;</span>unsigned-byte <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>
     <span style="color: #66cc66;">:</span><span style="color: #555;">buffering</span> <span style="color: #66cc66;">:</span><span style="color: #555;">none</span>
     <span style="color: #66cc66;">:</span><span style="color: #555;">pathname</span> <span style="color: #66cc66;">&#40;</span>make-pathname <span style="color: #66cc66;">:</span><span style="color: #b1b100;">name</span> pathname<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>defvar *stierlitz* <span style="color: #66cc66;">&#40;</span>open-stierlitz-image <span style="color: #ff0000;">&quot;/mnt/usb/LOPERIMG.BIN&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Seek within the image:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> stierlitz-seek <span style="color: #66cc66;">&#40;</span>pos<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>file-position *stierlitz* pos<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>stierlitz-seek <span style="color: #cc66cc;">512</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">;; Seek to start of second block...</span></pre></div></div>

<p>Read a block:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>buf <span style="color: #66cc66;">&#40;</span>make-<span style="color: #b1b100;">array</span> <span style="color: #cc66cc;">512</span> <span style="color: #66cc66;">:</span><span style="color: #555;">element-type</span> '<span style="color: #66cc66;">&#40;</span>unsigned-byte <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>read-sequence buf *stierlitz*<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">...</span>
  <span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Modify a block:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>buf <span style="color: #66cc66;">&#40;</span>make-<span style="color: #b1b100;">array</span> <span style="color: #cc66cc;">512</span> <span style="color: #66cc66;">:</span><span style="color: #555;">element-type</span> '<span style="color: #66cc66;">&#40;</span>unsigned-byte <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">:</span><span style="color: #555;">initial-element</span> #xAA<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>write-sequence buf *stierlitz*<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">...</span>
  <span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>And so forth.</p>
<hr />In the unlikely event that some other person actually tries to make use  of any of the above, said person is invited to comment here&#8230;</p>
<p>So, what&#8217;s next?</p>
<p>1) Logic to drive other peripherals found on the ML501 (Video, Ethernet, etc.)  Coming soon.<br />
2) My own, <strong>proper</strong> logic synthesis system (Goodbye, Verilog. Goodbye, hundred-line <a href="http://en.wikipedia.org/wiki/Finite-state_machine">FSM</a> boilerplate and other such abominations.  And, eventually, goodbye, Xilinx toolchain.)  Coming soon&#8230;<br />
3) And, last but not least, my <a href="../?p=55">CPU architecture</a>, rationally-designed and, incidentally, entirely and meaningfully-unlike any existing one (including the <a href="../?cat=10">Lisp Machines.</a>)</p>
<p>Don&#8217;t expect too many posts like this one in the near future; they are quite labor-intensive to write.  And, judging by my server stats, most of my readers would <strong>much</strong> prefer to see ever-hotter <a href="http://www.loper-os.org/?cat=8">hot air.</a> Yes, there will certainly be more of that.</p>
<hr /><strong>[1]</strong> Named in honor of an appropriate (but admittedly obscure in the English-speaking world) <a href="http://en.wikipedia.org/wiki/Stierlitz" target="_blank">fictional hero</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=702</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cypress EZ-Host Firmware Development Under Linux.</title>
		<link>http://www.loper-os.org/?p=668</link>
		<comments>http://www.loper-os.org/?p=668#comments</comments>
		<pubDate>Sat, 21 Jan 2012 00:15:07 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[Cold Air]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[LoperOS]]></category>
		<category><![CDATA[Progress]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=668</guid>
		<description><![CDATA[Progress has been slow, because I have been otherwise occupied for quite some time.  Slow, but not entirely still.
Since turning Loper OS into an ab initio CPU architecture project, I have been using Xilinx development boards for prototyping.  For the past year &#8212;  an ML-501.  The FPGA toolchain itself is (grudgingly) Linux-friendly, but those for [...]]]></description>
			<content:encoded><![CDATA[<p>Progress has been slow, <a href="http://www.loper-os.org/?p=562">because I have been otherwise occupied</a> for quite some time.  Slow, but not entirely still.</p>
<p>Since turning Loper OS into an <em>ab initio</em> <a href="http://www.loper-os.org/?p=46">CPU</a> <a href="http://www.loper-os.org/?p=55">architecture project</a>, I have been using <a href="http://www.xilinx.com/">Xilinx</a> development boards for prototyping.  For the past year &#8212;  an <a href="http://www.xilinx.com/products/boards-and-kits/HW-V5-ML501-UNI-G.htm">ML-501</a>.  The FPGA toolchain itself is (grudgingly) Linux-friendly, but those for many of the I/O chips included with the board are anything but.</p>
<p>For instance, on the ML-501 (and a few other Xilinx boards) there is a <a href="http://www.cypress.com/?rID=14164">Cypress Semiconductor CY7C67300</a> &#8220;EZ-Host Programmable Embedded USB Host and Peripheral Controller.&#8221;  Sounds useful, no?  The free SDK includes a few code examples.  Cypress also distributes an assembler, &#8220;QTASM.EXE&#8221; (included with the EZ-Host BIOS source code.)  The assembler is Windows-only but will run happily under Wine.  And it would not be too difficult to write your own assembler for this very simple and decently-documented chip.</p>
<p>The Cypress EZ-Host (also called EZ-<a href="http://en.wikipedia.org/wiki/USB_On-The-Go">OTG</a>) should not be confused with the commonplace <a href="http://www.linux-usb.org/ezusb/">Cypress EZ-USB</a> chip!  This is a rather different architecture.  None of the EZ-USB tools will work.</p>
<p>Know that the EZ-Host SDK is a cruel kick in the face to a Linux user, because Cypress&#8217;s firmware-uploader and memory-dumper tool (&#8221;QTUI2C.EXE&#8221;) will not run under <a href="http://www.winehq.org/">Wine</a>.  Nor is any source for the tool available.</p>
<p>Imagine there were a construction company which expected carpenters to cut wood only with pocket knives!  Vendors who expect embedded firmware developers to use MS-Windows are just the same.  But odder still are vendors whose SDK is a mix of the reasonably Linux-friendly and the purely MS-bound.  That is quite like mandating pocket knife-only sawing on even-numbered days of the calendar.  (One less-than-shocking example of this: <a href="http://www.intel.com/content/www/us/en/architecture-and-technology/unified-extensible-firmware-interface/efi-homepage-general-technology.html">Intel</a>.  And, well, Cypress.)</p>
<p><strong>But, my fellow Xilinx and Cypress sufferers!  The hour of liberation has come!</strong> I have written <a href="https://github.com/asciilifeform/ezotgdbg">EZOTGDBG, a quick, rough replacement for QTUI2C.EXE.</a> The sole dependency is <a href="http://www.libusb.org/">libusb-1.0.</a> The license is <a href="http://www.gnu.org/copyleft/gpl.html">GPL-3</a>.  Friends, please test EZOTGDBG on your boards!   But all normal caveats apply!  In particular, your system <strong>will</strong> release <a href="http://en.wikipedia.org/wiki/Magic_smoke"><strong>magic blue smoke</strong></a> under the right circumstances if you don&#8217;t know what you are doing (or are merely unlucky.)  But if you own one of these toys you ought to have known that already.</p>
<p>All bug reports / hate mail / etc. for EZOTGDBG should only be submitted as comments to this post.</p>
<p><img title="Cypress CY7C67300 on the Xilinx ML-501." src="../wp-content/cy7c67300.jpg" alt="" width="640" height="480" /></p>
<p>So what does any of this have to do with Loper?</p>
<p>The USB controller in question will eventually be used for the obvious purpose: as a USB host on which to hang traditional peripherals (keyboards, mice, disks, etc.)  But at that point, there will be no need to flash its firmware from the &#8220;mother ship.&#8221;</p>
<p>But right now the 67300 sits on &#8220;ShortBus&#8221;, the Loper prototype machine&#8217;s rough analogue to the <a href="http://trac.common-lisp.net/mit-cadr/browser/tags/system-46/lmcons/cadrd.lisp">original Lisp Machine&#8217;s &#8220;Spy Bus.&#8221;</a> The basic idea here is to inspect/manipulate state under remote control.</p>
<p>And so, something like EZOTGDBG is needed, to initialize the controller when Loper cannot yet be relied upon to do so.</p>
<p>Writing programs like this is a misery, but it cannot be entirely avoided if the kind of thing I have in mind is to go forward.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=668</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>How to Run HyperCard Under Emulation</title>
		<link>http://www.loper-os.org/?p=658</link>
		<comments>http://www.loper-os.org/?p=658#comments</comments>
		<pubDate>Tue, 06 Dec 2011 17:43:01 +0000</pubDate>
		<dc:creator>Stanislav</dc:creator>
				<category><![CDATA[Cold Air]]></category>
		<category><![CDATA[NonLoper]]></category>
		<category><![CDATA[ShouldersGiants]]></category>

		<guid isPermaLink="false">http://www.loper-os.org/?p=658</guid>
		<description><![CDATA[If you want to try HyperCard yourself, you can download  an archive containing a hard disk image with Mac OS 8 and HyperCard  installed, plus the ROM image file needed for most emulators, here.
The only Classic Mac emulator I know to work is Basilisk II.  If you run MS Windows, you can get [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to try <a href="http://www.loper-os.org/?p=568">HyperCard</a> yourself, you can download  an archive containing a hard disk image with Mac OS 8 and HyperCard  installed, plus the ROM image file needed for most emulators, <a href="http://depositfiles.com/files/3oq5xss49">here</a>.</p>
<p>The only Classic Mac emulator I know to work is <a href="http://basilisk.cebix.net/">Basilisk II</a>.  If you run MS Windows, you can get that version <a href="http://www.emaculation.com/forum/viewtopic.php?t=5282">here</a>.</p>
<p>All comments regarding this being some morally depraved thing to do will be deleted.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.loper-os.org/?feed=rss2&amp;p=658</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

