<?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>What&#039;s All This Brouhaha? &#187; Software</title>
	<atom:link href="https://whats.all.this.brouhaha.com/category/computing/software/feed/" rel="self" type="application/rss+xml" />
	<link>https://whats.all.this.brouhaha.com</link>
	<description>miscellaneous musings and random rantings</description>
	<lastBuildDate>Fri, 01 Nov 2019 06:31:54 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9</generator>
	<item>
		<title>unintentional nondeterminism in a Python program</title>
		<link>https://whats.all.this.brouhaha.com/2017/04/23/unintentional-nondeterminism-in-a-python-program/</link>
		<comments>https://whats.all.this.brouhaha.com/2017/04/23/unintentional-nondeterminism-in-a-python-program/#comments</comments>
		<pubDate>Sun, 23 Apr 2017 08:59:27 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=1175</guid>
		<description><![CDATA[There&#8217;s a Python 3 program I&#8217;ve been developing off-and-on for three years now. The program takes an XML file as input, does some processing, and outputs a binary file.  After some recent changes, I find that the program hangs. If &#8230; <a href="https://whats.all.this.brouhaha.com/2017/04/23/unintentional-nondeterminism-in-a-python-program/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>There&#8217;s a Python 3 program I&#8217;ve been developing off-and-on for three years now. The program takes an XML file as input, does some processing, and outputs a binary file.  After some recent changes, I find that the program hangs. If I hit control-C, I get a traceback.  I added a print in one of the loops to tell me which object it is processing, and was astounded to find that if I run the program multiple times with the same input, it processes the objects in different orders.  There is no (intentional) non-determinism in my program.</p>
<p>Python has as one of its basic data types a dictionary, which is a key to value mapping. Internally it is implemented as a hash table, so the key can be of any data type that can be hashed, including numbers and strings. If you enumerate the keys that are present in a dictionary, you will get them in an unpredictable order. Historically it was unpredictable but deterministic, based on the hash values.</p>
<p>For my purposes, the dictionary enumeration order being unpredictable is fine, but I want it to be deterministic, so that multiple runs of the program with identical input will produce identical output.</p>
<p>It turns out that starting with Python 3.3, by default the hash function used is randomized, so the same program with the same dictionary contents will result in different enumeration orders on different runs:</p>
<p><a title="why-is-dictionary-ordering-non-deterministic" href="http://stackoverflow.com/questions/14956313/why-is-dictionary-ordering-non-deterministic" target="_blank">http://stackoverflow.com/questions/14956313/why-is-dictionary-ordering-non-deterministic</a></p>
<p>The hash randomization is claimed to be a security feature.  I&#8217;m unclear on what security it provides.  It is possible to disable hash randomization using an environment variable passed to the Python interpreter.</p>
<p>I&#8217;m using Python 3.5.  Starting with Python 3.6, the implementation of dictionaries is different, so even though hash randomization is still the default, the dictionary enumeration order is no longer based on the hash, and is once again deterministic.</p>
<p>At some point, Python added support for a new dictionary type OrderedDict, which enumerates in the order of element insertion, which happens to be the same thing that Python 3.6 does with normal dictionaries. After changing one line in my program to initialize a particular variable as an OrderedDict rather than a &#8220;plain&#8221; dictionary, my program is once again deterministic, even with hash randomization enabled.</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2017/04/23/unintentional-nondeterminism-in-a-python-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating bootable USB media from ISO image</title>
		<link>https://whats.all.this.brouhaha.com/2012/12/10/creating-bootable-usb-media-from-iso-image/</link>
		<comments>https://whats.all.this.brouhaha.com/2012/12/10/creating-bootable-usb-media-from-iso-image/#comments</comments>
		<pubDate>Mon, 10 Dec 2012 08:40:15 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=991</guid>
		<description><![CDATA[I&#8217;ve found lots of reverences to using livecd-iso-to-disk from the livecd-tools package to create bootable USB media from an ISO image (or for a DVD, quite possibly a UDF image, but the principle is the same). However, most of the &#8230; <a href="https://whats.all.this.brouhaha.com/2012/12/10/creating-bootable-usb-media-from-iso-image/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve found lots of reverences to using livecd-iso-to-disk from the livecd-tools package to create bootable USB media from an ISO image (or for a DVD, quite possibly a UDF image, but the principle is the same).  However, most of the descriptions either seem light on examples, or give absurdly complicated examples.  It&#8217;s actually quite easy, if you&#8217;re not concerned with preserving the old content of the USB media.<span id="more-991"></span></p>
<p>Suppose your USB media is drive /dev/sdb, and your ISO image is at /path/to/some-image.iso.  If you have an actual file system mounted (e.g., /dev/sdb1), unmount it from the command line.  (Do NOT unmount it from a GUI, e.g, Gnome, as that may not leave it in a state where it is usable over USB.)</p>
<p>Now run the command: <code>livecd-iso-to-disk --format --reset-mbr /path/to/some-image.iso /dev/sdb1</code></p>
<p>Previously I spent a bunch of time trying to run the command without the <code>--format</code> option, and got all sorts of complaints about problems with my USB medai, partition table, filesystem, etc.  I&#8217;m not convinced that the error messages were accurate.  The <code>--format</code> option simplifies everything.</p>
<p>The command above will default to formatting the USB media with an ext4 filesystem, which works fine with Linux, but may be inconvenient for use with Windows. You can apparently use the poorly-named <code>--msdos</code> option (which should have been <code>--fat</code> or perhaps <code>--vfat</code>) to use a FAT filesystem on the USB media rather than ext4.  However, I haven&#8217;t verified that this works.</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2012/12/10/creating-bootable-usb-media-from-iso-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TRS-DOS as possible prior art for MS patent on exFAT, and reference request</title>
		<link>https://whats.all.this.brouhaha.com/2012/09/16/trs-dos-as-possible-prior-art-for-ms-patent-on-exfat-and-reference-request/</link>
		<comments>https://whats.all.this.brouhaha.com/2012/09/16/trs-dos-as-possible-prior-art-for-ms-patent-on-exfat-and-reference-request/#comments</comments>
		<pubDate>Mon, 17 Sep 2012 05:58:57 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[Patents]]></category>
		<category><![CDATA[Retrocomputing]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=987</guid>
		<description><![CDATA[Microsoft introduced a new &#8220;exFAT&#8221; file system a few years ago, and I wouldn&#8217;t care about it in the least, except that it is now the official filesystem for SD-XC cards.  I only care about that in that digital cameras &#8230; <a href="https://whats.all.this.brouhaha.com/2012/09/16/trs-dos-as-possible-prior-art-for-ms-patent-on-exfat-and-reference-request/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Microsoft introduced a new &#8220;<a title="exFAT" href="http://en.wikipedia.org/wiki/ExFAT" target="_blank">exFAT</a>&#8221; file system a few years ago, and I  wouldn&#8217;t care about it in the least, except that it is now the official  filesystem for SD-XC cards.  I only care about that in that digital  cameras and such will likely only support exFAT on SD-XC cards, and I&#8217;d  like my computer, not running Windows, to be able to efficiently access  files on such cards.  The problem is that Microsoft filed several patent  applications covering exFAT.  One of them is application <a title="US 2009/0164440 A1" href="http://www.google.com/patents/US20090164440" target="_blank">US  2009/0164440 A1</a>, for which the US patent office has recently mailed a  &#8220;Notice of Allowance&#8221;, which means that they have decided to issue the  patent.</p>
<p>This application is titled &#8220;Quick filename lookup using name hash&#8221;.   Based on the title, it sounded like they are doing what TRS-DOS 2.0 did  back in 1978, which is putting on the disk a hash table of filenames  which then refer to directory entries.  TRS-DOS did that so that it  usually only needed to read two sectors to look up a file, the HIT (Hash  Index Table) sector, and the actual directory sector containing the  file&#8217;s directory entry.  Otherwise they might have had to read multiple  directory sectors to find the file if it existed, and all of the  directory sectors if it did not.</p>
<p>The claims of the patent are a little difficult to interpret.  They  refer to &#8220;a first one or more computer readable storage media having  computer executable instructions&#8230;&#8221;.  This is basically referring to  the disk/flash/etc. the operating system is booted from.  They refer to  &#8220;a second one or more&#8230;&#8221; which is the disk/flash/etc. which holds the  file system in question.</p>
<p>Here&#8217;s are two of the independent claims:</p>
<blockquote><p>1. A first one or more computer readable storage media having  computer executable instructions that, when executed on at least one  processor, configure the at least one processor to perform a method of  detecting if a target file name exists on a second one or more computer  readable storage media, the method comprising:</p>
<p>(A) determining a name hash from the target name;<br />
(B)  determining if the name hash corresponds to a directory entry set name  hash value, the directory entry set name hash value corresponding to one  of a plurality of directory entry sets, each of the plurality of  directory entry sets stored on the second one or more computer readable  storage media;<br />
(C)  determining if the target name matches a directory entry set name  corresponding to the one of the plurality of directory entry sets after  step (B) determines the name hash corresponds to the directory entry set  name hash value; and<br />
(D) indicating that the target name exists after step (C) determines the target name matches the directory entry set name.</p>
<p>19. A method of detecting if a target file name exists, the method executing on one or more processors, the method comprising:</p>
<p>(A) determining a file name hash from the target file name;<br />
(B)  determining if the file name hash corresponds to a directory entry hash  value, the directory entry hash value corresponding to one of a  plurality of directory entries;<br />
(C)  determining if the target file name matches a file name, the file name  corresponding to the one of the plurality of directory entries after  step (B) determines the file name hash corresponds to the directory  entry hash value; and<br />
(D)  indicating that the target file name exists after step (C) determines  the target file name matches the file name corresponding to the one of  the plurality of directory entries.</p></blockquote>
<p>These seem to be to be to be *exactly* what TRS-DOS 2.0 did as early as  1978, so it seems possible that TRS-DOS could be used as prior art to  invalidate at least these independent claims, and quite possibly some of  the dependent claims as well.</p>
<p>So my question is, are there any published works documenting the TRS-DOS  file system on-disk format, especially the use of the HIT table, other  than &#8220;<a title="TRS-80 Disk and Other Mysteries" href="http://www.amazon.com/Trs-80-Disk-Other-Mysteries-Pennington/dp/0936200006" target="_blank">TRS-80 Disk and Other Mysteries</a>&#8221; by H. C. Pennington?</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2012/09/16/trs-dos-as-possible-prior-art-for-ms-patent-on-exfat-and-reference-request/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Building EPEL6 packages that use Qt 4</title>
		<link>https://whats.all.this.brouhaha.com/2012/06/24/building-epel6-packages-that-use-qt-4/</link>
		<comments>https://whats.all.this.brouhaha.com/2012/06/24/building-epel6-packages-that-use-qt-4/#comments</comments>
		<pubDate>Mon, 25 Jun 2012 04:56:41 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[Fedora]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=984</guid>
		<description><![CDATA[I&#8217;ve been trying to build an EPEL 6 package (for Red Hat Enterprise Linux 6, Centos 6, etc.) of Meshlab, for which I already have a Fedora package.  The latest challenge is that the Koji build server is trying to &#8230; <a href="https://whats.all.this.brouhaha.com/2012/06/24/building-epel6-packages-that-use-qt-4/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been trying to build an EPEL 6 package (for Red Hat Enterprise Linux 6, Centos 6, etc.) of Meshlab, for which I already have a Fedora package.  The latest challenge is that the Koji build server is trying to use qt-devel-3.x, while Meshlab needs qt-devel-4.x.</p>
<p>The obvious thing to do was to change the spec from:</p>
<pre><tt>BuildRequires: qt-devel</tt></pre>
<p>to</p>
<pre><tt>BuildRequires: qt-devel &gt;= 4.6</tt></pre>
<p>However, Koji still tries to use qt-devel-3.x!</p>
<p>A Google search revealed an <a href="http://comments.gmane.org/gmane.linux.redhat.fedora.rpmfusion.devel/12228">explanation in the rpmfusion-developers list from Kevin Fenzi</a>:</p>
<blockquote><p>That doesn&#8217;t work because it&#8217;s missing the Epoch. &#8220;&gt;= 1:4&#8243; would work, but it&#8217;s better to use the virtual qt4-devel Provides, which is backwards-compatible with EPEL 5 (which had an actual qt4-devel package), which will keep working in the future when Qt 5 will be the default and which avoids the pesky Epoch.</p></blockquote>
<p>Now on to the next problem!</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2012/06/24/building-epel6-packages-that-use-qt-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux group management</title>
		<link>https://whats.all.this.brouhaha.com/2012/06/06/linux-group-management/</link>
		<comments>https://whats.all.this.brouhaha.com/2012/06/06/linux-group-management/#comments</comments>
		<pubDate>Wed, 06 Jun 2012 23:42:35 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=977</guid>
		<description><![CDATA[The conventional wisdom has it that if you add a user to a group in a Linux (or Unix) system, the user will have to log in again for the new group membership to take effect.  Using the &#8220;newgrp&#8221; command, &#8230; <a href="https://whats.all.this.brouhaha.com/2012/06/06/linux-group-management/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>The conventional wisdom has it that if you add a user to a group in a Linux (or Unix) system, the user will have to log in again for the new group membership to take effect.  Using the &#8220;newgrp&#8221; command, an existing shell can gain the group membership.  For example, to create a new group &#8220;foo&#8221;, add the current user to the group, and make it effective immediately:</p>
<pre><tt>sudo groupadd foo
sudo usermod -a -G foo user
newgrp foo</tt></pre>
<p>Note that this makes the new group effectively the user&#8217;s primary group ID in the current shell and any new descendents. If you don&#8217;t want that, do another newgrp back to the original group. The new group will still be in the process&#8217; group list.</p>
<p>Note that the &#8220;-a&#8221; (append) option to usermod may not exist in all Linux distributions.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2012/06/06/linux-group-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TRS-80 Model II TRSDOS: paranoia strikes deep</title>
		<link>https://whats.all.this.brouhaha.com/2012/03/31/trs-80-model-ii-trsdos-paranoia-strikes-deep/</link>
		<comments>https://whats.all.this.brouhaha.com/2012/03/31/trs-80-model-ii-trsdos-paranoia-strikes-deep/#comments</comments>
		<pubDate>Sat, 31 Mar 2012 09:32:59 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[Retrocomputing]]></category>
		<category><![CDATA[Reverse-engineering]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=973</guid>
		<description><![CDATA[It looks like the developers of TRS-80 Model II TRSDOS were very paranoid that someone might be able to bypass the filesystem and access data on a floppy directly.  I&#8217;m not sure if their primary concern was file password protection, &#8230; <a href="https://whats.all.this.brouhaha.com/2012/03/31/trs-80-model-ii-trsdos-paranoia-strikes-deep/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>It looks like the developers of TRS-80 Model II TRSDOS were very  paranoid that someone might be able to bypass the filesystem and access  data on a floppy directly.  I&#8217;m not sure if their primary concern was  file password protection, or if they had other reasons.  Obviously you  could write a program that accesses the floppy directly, by talking to  the FDC and DMAC chips yourself, and there&#8217;s not really anything that  can be done to prevent that.</p>
<p>Oddly enough, this was exactly the <strong>opposite</strong> of what Apple did in Apple  DOS.  Apple published the APIs to read and write sectors (RWTS), but  never published the &#8220;File Manager&#8221; APIs that allowed access to the file  system through means other than passing commands through the character  output vector (e.g., the BASIC statement PRINT CHR$(4);&#8221;OPEN FOO&#8221;).</p>
<p>I&#8217;ll mostly describe how things work in Model II TRSDOS 1.2, the  earliest version I&#8217;ve been able to obtain.  I haven&#8217;t studied 2.0 nearly  as much yet.  The TRSDOS 1.2 &#8220;kernel&#8221; consists of three parts, while  later versions are more monolithic.</p>
<p>The Model II boot ROM loads all of drive 0 track 0 (single density, 26  sectors of 128 bytes) into memory starting at 0e00.  First it looks for  the four characters &#8220;DIAG&#8221; at 1400 and &#8220;BOOT&#8221; at 1000.  If either are  missing, it refuses to proceed.  It calls the code at 1404, which in  TRSDOS is a simple hardware diagnostic.  When that returns, it jumps to  the first stage boot loader code at 1004.  Some other operating systems  don&#8217;t bother with a diagnostic, and just start their boot code at 1404,  never returning to the ROM.</p>
<p>The first stage boot loader actually understands the TRSDOS filesystem  enough to find the directory entries of files in TRSDOS load module  format, and load them into memory.  In 1.2, it loads &#8220;IODVRS/SYS&#8221; and  then &#8220;TRSDOS/SYS&#8221;, and jumps into the latter.  The Model II TRSDOS  filesystem is similar in many regards to that of Model I TRSDOS, but not  enough to actually be compatible. Unsurprisingly, it looks like an  intermediate step in the evolution from Model I TRSDOS to Model III  TRSDOS.  As in Model III TRSDOS, files can only have a single directory  entry, with a limited number of extents.</p>
<p>IODVRS/SYS contains, as the name implies, the low level I/O drivers for  the system, including the keyboard, display, printer, and floppy drives,  the dispatching for system (SVC) calls, and a few utility SVCs.   However, it only contains the SVC handlers for services 0-28, the I/O  functions and basic utility SVCs.  Note in particular that it contains  no file system code.  IODVRS/SYS is conceptually similar to the CP/M  BIOS, though lacking CP/Ms charming simplicity.  IODVRS/SYS provides  several undocumented SVCs for internal use by TRSDOS, including floppy  subsystem initialization (13), floppy sector read (14), and floppy  sector write (16). Note that at the time IODVRS/SYS is loaded, no call  is made into it to initialize it.</p>
<p>TRSDOS/SYS, however, is called after being loaded.  It basically  performs the TRSDOS initialization that only has to happen at boot  time.  It has another implementation of filesystem reading and load  module format handling, very similar to what is present in the stage 1  boot, but now instead of talking to the FDC and DMAC directly, it uses  the undocumented floppy SVCs described previously.  After various  initialization, it loads SYSRES/SYS and jumps into it.</p>
<p>SYSRES/SYS contains the filesystem code and other relatively high-level  TRSDOS infrastructure code.  It generally relies on SVC calls into  IODVRS/SYS to perform all I/O, and has very little other dependence on  IODVRS/SYS internals.  This is conceptually similar to the CP/M BDOS.   It loads system overlays to handle some SVCs and user commands.   Overlays SYS0/SYS through SYS9/SYS are small overlays, occupying one  disk granule (five sectors) and loading into 2200-26ff.  Other overlays  may be larger, and load at 2800 or higher.  Many of the overlays <strong>do</strong> depend on knowledge of the internals of SYSRES/SYS, directly accessing  subroutines and data structures without the use of vector tables or the  like.  This means that SYSRES/SYS and the overlays must have been built  at the same time, and would generally not be interchangeable with  earlier or later releases.</p>
<p>Anyhow, getting back to the paranoia part.  Someone apparently decided  that simply not documenting the SVCs that provide sector-level access to  the floppy was not sufficient to thwart those that might want to bypass  the filesystem.  After TRSDOS/SYS uses those SVCs for its part in the  boot process, it actually <strong>removes</strong> them from the SVC vector table, and  sets up jumps to them at undocumented internal TRSDOS locations 1130  (read sector) and 1133 (write sector).</p>
<p>In TRSDOS 1.2, access to all of the system files, including overlays, is  done through the file system.  The system files have normal file system  entries. Unlike Model I TRSDOS, neither the system file directory  entries nor the file contents need to be in any special location on the  disk.</p>
<p>In TRSDOS 2.0, things are much more monolithic.  The stage 1 boot code  only loads and jumps into a single file, SYSRES/SYS.  The boot code does  not care where this file is located, but other parts of the system do.   All of the overlays, small and large, are stored in a single file,  SYSTEM/SYS, which is required to start on the track after the primary  directory.  The first sector of SYSTEM/SYS contains a kind of overlay  directory that gives the track and sector numbers at which each overlay  starts.</p>
<p>There is perhaps some advantage to putting all of the overlays in a  single file, since the number of directory entries on the diskette is  limited to 96.  However, the need for a second, special directory  mechanism for overlays is ugly, even if it is only a simple one.   Requiring the system files to be at fixed locations on the disk (at  least relative to the primary directory) might be a reasonable  requirement if it yielded some performance gain, but it generally  doesn&#8217;t.  (With 1.2, the system files are set up when the disk is  formatted, so even though they <strong>could</strong> be anywhere, in practice they are  grouped together.)</p>
<p>TRSDOS 2.0 introduced changes to the disk organization, such that TRSDOS  1.2 and 2.0 diskettes are not interchangeable, except that the 2.0  XFERSYS utility can convert a 1.2 diskette to 2.0 format.  The disk  organization changes are basically gratuitous, and don&#8217;t provide any  benefit to the user, while obviously being a great inconvenience to  users with TRSDOS 1.2.  They mashed the GAT (granule allocation table)  and HIT (hash index table), which were sectors 1 and 2 of the directory  track in 1.2, into just sector 1 in 2.0.  In 1.2, the directory occupied  sectors 3-26, while in 2.0 it occupies sectors 2-25.  The only apparent  rationale for doing this is to free up sector 26 on the directory  track.  In TRSDOS 1.2, sector 26 was not used on any track but the  directory track, for any purpose.  In TRSDOS 2.0, sector 26 of <strong>every</strong> track is used to store five bytes of unique disk ID, to better detect  disk changes.  (it has been suggested that those bytes might also have  been used for software copy protection.)  However, rather than mashing  the GAT and HIT together, which made it impossible to support larger  disks such as double-sided disks, they easily could have special cased  the directory track(s) and stored the disk ID in either the GAT or HIT  sector.</p>
<p>TRSDOS 4.0 introduced much larger changes to the disk organization, in  order to support double-sided disks and hard disks.  I haven&#8217;t yet begun  to dig into the 4.0 code.</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2012/03/31/trs-80-model-ii-trsdos-paranoia-strikes-deep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code to encode and decode Kansas City standard</title>
		<link>https://whats.all.this.brouhaha.com/2012/01/02/code-to-encode-and-decode-kansas-city-standard/</link>
		<comments>https://whats.all.this.brouhaha.com/2012/01/02/code-to-encode-and-decode-kansas-city-standard/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 05:52:57 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[RetroChallenge]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=950</guid>
		<description><![CDATA[As part of my Retrochallenge 2012WW project, I&#8217;m writing a pair of C programs to encode and decode Kansas City standard and Processor Technology CUTS audio cassette formats, as these are the formats supported on the Processor Technology Sol-20.  These &#8230; <a href="https://whats.all.this.brouhaha.com/2012/01/02/code-to-encode-and-decode-kansas-city-standard/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>As part of my Retrochallenge 2012WW project, I&#8217;m writing a pair of C programs to encode and decode Kansas City standard and Processor Technology CUTS audio cassette formats, as these are the formats supported on the Processor Technology Sol-20.  These use FSK modulation, so it&#8217;s not too difficult.</p>
<p>In fact, FSK modulation is almost trivial, so I had the encoder written in less than an hour.</p>
<p>For decode, I decided to use the Goertzel algorithm, which is a simplified DFT that only looks for a single frequency.  I&#8217;ve used the Goertzel algorithm before on fixed-point DSP processors. There are app notes on using it for DTMF detection.  For FSK demodulation, I just use two Goertzels, one for the space frequency and one for the mark frequency.  The audio samples are dealt with in windows that are a fraction of a bit time, and the levels indicated by the two Goertzels are compared to decide which frequency predominates in that window.</p>
<p>Implementing the decoder program took a few hours last night and a few hours today.  It&#8217;s now basically working, at least for the perfectly sinusoidal waveforms generated by my encoder.  I still need to test it on some real tapes.</p>
<p>I&#8217;m currently using an 8 kHz sample rate for my audio files, although the encoder can be told to use a higher sample rate if desired, and the decoder will work with whatever sample rate the audio file uses.  Since the FSK frequencies are 1200 Hz and 2400 Hz, there should be no advantage to using a sample rate higher than 8 kHz.</p>
<p>I&#8217;m currently using libsndfile to read and write audio files.  I&#8217;d like to also use PortAudio to support direct access to the audio hardware, but I haven&#8217;t yet tried that.  While I&#8217;m doing the development on Linux, in principle the programs should work if compiled on Windows or MacOS.</p>
<p>I&#8217;ll release the programs under the GPLv3 license when I&#8217;ve verified that they work reasonably well.</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2012/01/02/code-to-encode-and-decode-kansas-city-standard/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>C programming, the suboptimal way</title>
		<link>https://whats.all.this.brouhaha.com/2012/01/02/c-programming-the-suboptimal-way/</link>
		<comments>https://whats.all.this.brouhaha.com/2012/01/02/c-programming-the-suboptimal-way/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 05:38:47 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[RetroChallenge]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[The Suboptimal Way]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=948</guid>
		<description><![CDATA[Never name a C function read(), unless you&#8217;re trying to replace the system read() function.  Maybe not a problem on Windows, I&#8217;m not sure, but definitely bad news on Unix or Linux. I spent over an hour trying to figure &#8230; <a href="https://whats.all.this.brouhaha.com/2012/01/02/c-programming-the-suboptimal-way/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Never name a C function <tt>read()</tt>, unless you&#8217;re trying to replace the  system <tt>read()</tt> function.  Maybe not a problem on Windows, I&#8217;m not sure,  but definitely bad news on Unix or Linux.</p>
<p>I spent over an hour trying to figure out why libsndfile was claiming  that it couldn&#8217;t recognize the format of a perfectly good <tt>.wav</tt> file.</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2012/01/02/c-programming-the-suboptimal-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More progress to report, after all</title>
		<link>https://whats.all.this.brouhaha.com/2011/07/31/more-progress-to-report-after-all/</link>
		<comments>https://whats.all.this.brouhaha.com/2011/07/31/more-progress-to-report-after-all/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 00:39:55 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[Calculators]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[RetroChallenge]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=935</guid>
		<description><![CDATA[I fixed several bugs in my code, and now the DIY4 can display the directory of an SD card and read and write files. It&#8217;s not perfect, as the first I/O fails, but subsequent accesses succeed. I&#8217;m using the open &#8230; <a href="https://whats.all.this.brouhaha.com/2011/07/31/more-progress-to-report-after-all/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I fixed several bugs in my code, and now the DIY4 can display the directory of an SD card and read and write files. It&#8217;s not perfect, as the first I/O fails, but subsequent accesses succeed.</p>
<p>I&#8217;m using the open source <a title="FatFs Generic FAT File System Module" href="http://elm-chan.org/fsw/ff/00index_e.html" target="_blank">FatFs</a> code to implement the FAT filesystem.  It&#8217;s configured to work with two &#8220;drives&#8221;, the internal SPI FRAM chip in the DIY4, and the SD card.  I used the SD interface code from the &#8220;generic&#8221; example, with only minor changes necessary.</p>
<p>I still have to write a -41 microcode ROM to provide the equivalent of the HP-IL module&#8217;s mass storage commands, but talking to the SD card rather than HP-IL.</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2011/07/31/more-progress-to-report-after-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display contrast in DIY4</title>
		<link>https://whats.all.this.brouhaha.com/2011/07/26/display-contrast-in-diy4/</link>
		<comments>https://whats.all.this.brouhaha.com/2011/07/26/display-contrast-in-diy4/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 03:47:42 +0000</pubDate>
		<dc:creator><![CDATA[Eric]]></dc:creator>
				<category><![CDATA[Calculators]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[RetroChallenge]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://whats.all.this.brouhaha.com/?p=930</guid>
		<description><![CDATA[The DIYRPN 4 calculator uses a 16&#215;2 character LCD module. The choice of module was limited due to the desired physical width of the calculator. We chose a module made by Lumex. The module is specified for operation on a &#8230; <a href="https://whats.all.this.brouhaha.com/2011/07/26/display-contrast-in-diy4/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>The DIYRPN 4 calculator uses a 16&#215;2 character LCD module. The choice of module was limited due to the desired physical width of the calculator. We chose a module made by Lumex. The module is specified for operation on a 5V supply, but we need to run it on 3.1V. This results in needing a negative bias voltage to get reasonable display contrast. We use a pulse width modulator (PWM) driving a voltage inverter to get a software-adjustable negative bias voltage. Getting the timer of the Energy Micro EFM32G &#8220;Gecko&#8221; microcontroller working in PWM mode was slightly trickier than expected.<span id="more-930"></span>We want the display to work while the processor is in a low-power state (not executing instructions), so we have to use the &#8220;low energy timer&#8221; of the EFM32G rather than the normal timer.  The low energy timer can be run from the low-frequency (typical 32.768 kHz) crystal oscillator (LFXO) or the internal low-frequency RC oscillator (LFRCO). Because we want to have precise timekeeping, we&#8217;re using the LFXO.</p>
<p>My first attempt at making the PWM work failed because I had overlooked a relatively obscure note in the EFM32G reference manual which observed that the REP0 (repeat 0) register needs to contain a non-zero value, even though it is not counting down in the PWM mode. Once I added code to initialize REP0 to 1 (or any non-zero value), I could read the timer value in software, and verify that it counts down, and when it underflows, reloads the appropriate value from the COMP0 register (which sets the PWM period). However, the actual PWM pin was never changing.</p>
<p>I spent a lot of time studying the LETIMER chapter of the reference manual, and corrected several bugs in my code, but still didn&#8217;t get the pin to change. Finally I looked at the LETIMER application note. The text of the application note didn&#8217;t help much, but I noticed that their overly complicated example code was initializing REP1 to a non-zero value, while the reference manual had only indicated that REP1 was used in some other auto-reload mode and did not indicate that it was used or necessary for PWM.</p>
<p>I added a few lines to initialize REP1 to 1, and the PWM started working.  Now I can adjust the display contrast, from too light to too dark, in 16 steps. Fortunately there are midrange values that are somewhat reasonable.</p>
<p>Both the reference manual and the application note could certainly use some more thorough explanation of the requirements to make PWM mode work.</p>
]]></content:encoded>
			<wfw:commentRss>https://whats.all.this.brouhaha.com/2011/07/26/display-contrast-in-diy4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
