force use of pandoc version >= 3.1.12.2
The `bin/pandoc-wrapper.sh` tool will verify that the ssytem has a recent enough version of `pandoc(1)`. We explain why we insist on `pandoc(1)`. version >= 3.1.12.2 in comments where the $PANDOC_MIN_VERSION is set. Added `--wrap=preserve` as a default argument to `pandoc(1)`. While this change will impact every HTML file generated, we believe this will improve the ability of someone to look at the generated HTML and correlate with the original markdown. Changed `bin/pandoc-wrapper.sh` VERSION from "1.4.2 2024-03-17" to "1.4.3 2024-03-18". Performed `make www` to achieve all of the above and to generate HTML using the new `--wrap=preserve` `pandoc(1)` mode.
This commit is contained in:
1 parent
9eb7a54e9f
commit
b0b212acb1
402 files changed
+37061
-55132
No files matched your search
+41
-65
@@ -129,9 +129,9 @@
|
||||
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Anonymous_1984">Anonymous
|
||||
1984</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<em>United States of America</em> (<em>United States</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Anonymous_1984">Anonymous 1984</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,11 +144,10 @@
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./anonymous</span></span></code></pre></div>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>The original version of this entry was added, by request, in order to
|
||||
show the code that was turned into the <a
|
||||
href="https://web.archive.org/web/20070120220721/https://thomasscovell.com/tattoo.php">tattoo</a>,
|
||||
as the alternate code. See below for the tattoo side-by-side with the
|
||||
code.</p>
|
||||
<p>The original version of this entry was added, by request,
|
||||
in order to show the code that was turned into the
|
||||
<a href="https://web.archive.org/web/20070120220721/https://thomasscovell.com/tattoo.php">tattoo</a>,
|
||||
as the alternate code. See below for the tattoo side-by-side with the code.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
@@ -158,93 +157,70 @@ code.</p>
|
||||
<p>The author was too embarrassed that they could write such trash, so I
|
||||
promised to protect their identity. I will say that the author of this
|
||||
program has a well known connection with the C programming language.</p>
|
||||
<p>This program is a unique variation on the age old “hello, world!”
|
||||
program. What reads like a read may be written like a write!</p>
|
||||
<p>In 2005 someone by the name of Thomas Scovell got a tattoo of this
|
||||
entry. See his <a
|
||||
href="https://web.archive.org/web/20070120220721/https://thomasscovell.com/tattoo.php">web
|
||||
page</a> on the Internet Wayback Machine for more information on the
|
||||
tattoo. Along with the code, this is what it looks like:</p>
|
||||
<p>This program is a unique variation on the age old “hello, world!” program. What
|
||||
reads like a read may be written like a write!</p>
|
||||
<p>In 2005 someone by the name of Thomas Scovell got a tattoo of this entry. See
|
||||
his <a href="https://web.archive.org/web/20070120220721/https://thomasscovell.com/tattoo.php">web
|
||||
page</a>
|
||||
on the Internet Wayback Machine for more information on the tattoo. Along with
|
||||
the code, this is what it looks like:</p>
|
||||
<figure>
|
||||
<img src="1984-anonymous-tattoo.jpg" alt="1984-anonymous-tattoo.jpg" />
|
||||
<figcaption aria-hidden="true">1984-anonymous-tattoo.jpg</figcaption>
|
||||
</figure>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="on-remaining-anonymous">On remaining anonymous:</h3>
|
||||
<p>Some years after this entry was published we asked the author if they
|
||||
still wished to remain anonymous and they said:</p>
|
||||
<p>Some years after this entry was published we asked the author if they still
|
||||
wished to remain anonymous and they said:</p>
|
||||
<blockquote>
|
||||
<p>Yes, I want to keep my anonymity. But you can tell them that I am
|
||||
well known for my connection to the C language.</p>
|
||||
<p>Yes, I want to keep my anonymity. But you can tell them that I am well known
|
||||
for my connection to the C language.</p>
|
||||
</blockquote>
|
||||
<h3 id="on-the-famous-tattoo-see-above">On the famous tattoo (see
|
||||
above):</h3>
|
||||
<h3 id="on-the-famous-tattoo-see-above">On the famous tattoo (see above):</h3>
|
||||
<p>The author, when told about this tattoo, said:</p>
|
||||
<blockquote>
|
||||
<p>I feel honored that my entry will be the first IOCCC winning entry to
|
||||
become a tattoo. It is the first entry to become a tattoo isn’t it?</p>
|
||||
<p>I feel honored that my entry will be the first IOCCC winning entry to become a
|
||||
tattoo. It is the first entry to become a tattoo isn’t it?</p>
|
||||
</blockquote>
|
||||
<p>Landon Curt Noll, the one who told the author about the tattoo, wrote
|
||||
back:</p>
|
||||
<p>Landon Curt Noll, the one who told the author about the tattoo, wrote back:</p>
|
||||
<blockquote>
|
||||
<p>Yes, to our knowledge it is.</p>
|
||||
</blockquote>
|
||||
<h3 id="regrets">Regrets:</h3>
|
||||
<p>Landon Curt Noll wrote that the author regrets not making the program
|
||||
a one-liner and not moving the <code>int i</code> into an arg of
|
||||
<code>main()</code> (so that the line would have started with
|
||||
<code>main()</code>). On the other hand the author likes the “two line
|
||||
look” and the way <code>hell o</code> was split. :-) And they like the
|
||||
fact that it ends in a smily face: <code>;}</code>.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>Landon Curt Noll wrote that the author regrets not making the program a
|
||||
one-liner and not moving the <code>int i</code> into an arg of <code>main()</code> (so that the line
|
||||
would have started with <code>main()</code>). On the other hand the author likes the “two
|
||||
line look” and the way <code>hell o</code> was split. :-) And they like the fact that it
|
||||
ends in a smily face: <code>;}</code>.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-1984anonymous"><a name="inventory"></a>Inventory
|
||||
for 1984/anonymous</h1>
|
||||
<h1 id="inventory-for-1984anonymous"><a name="inventory"></a>Inventory for 1984/anonymous</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/anonymous.c">anonymous.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/anonymous.alt.c">anonymous.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/anonymous.orig.c">anonymous.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="1984-anonymous-tattoo.jpg">1984-anonymous-tattoo.jpg</a> -
|
||||
source code tattoo</li>
|
||||
<li><a href="1984_anonymous.tar.bz2">1984_anonymous.tar.bz2</a> -
|
||||
download entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/anonymous.c">anonymous.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/anonymous.alt.c">anonymous.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/anonymous.orig.c">anonymous.orig.c</a> - original source</li>
|
||||
<li><a href="1984-anonymous-tattoo.jpg">1984-anonymous-tattoo.jpg</a> - source code tattoo</li>
|
||||
<li><a href="1984_anonymous.tar.bz2">1984_anonymous.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+26
-47
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Dave_Decot">Dave Decot</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of
|
||||
America</em> (<em>United States</em>) <br><br></li>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -141,21 +141,19 @@ America</em> (<em>United States</em>) <br><br></li>
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> all</span></code></pre></div>
|
||||
<p>NOTE: there is an <a href="#alternate-code">alternate version</a>
|
||||
which will only work if you have an old enough compiler or a compiler
|
||||
that supports <code>-traditional-cpp</code>. The original code was fixed
|
||||
in 2023 to not require this.</p>
|
||||
<p>NOTE: there is an <a href="#alternate-code">alternate version</a> which will only work if
|
||||
you have an old enough compiler or a compiler that supports <code>-traditional-cpp</code>.
|
||||
The original code was fixed in 2023 to not require this.</p>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a
|
||||
href="../../bugs.html#1984_decot">1984 decot bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1984_decot">1984 decot bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./decot</span></span></code></pre></div>
|
||||
<h2 id="alternate-code">Alternate code:</h2>
|
||||
<p>This alternate code, the original, requires a compiler that supports
|
||||
<code>-traditional-cpp</code> or an old enough compiler. If you have
|
||||
such a compiler you can use this version.</p>
|
||||
<code>-traditional-cpp</code> or an old enough compiler. If you have such a compiler you
|
||||
can use this version.</p>
|
||||
<h3 id="alternate-build">Alternate build:</h3>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<h3 id="alternate-use">Alternate use:</h3>
|
||||
@@ -164,64 +162,45 @@ such a compiler you can use this version.</p>
|
||||
<p>This program prints out a string of garbage.</p>
|
||||
<p>The judges also offer this one comment: understand remarks!</p>
|
||||
<h3 id="historical-remarks">Historical remarks:</h3>
|
||||
<p>Some new (in 1984) compilers disliked line 15 of the original source,
|
||||
so we changed it from:</p>
|
||||
<p>Some new (in 1984) compilers disliked line 15 of the original source, so we
|
||||
changed it from:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*</span> x <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
|
||||
<p>to:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*</span>x <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
|
||||
<p>To see what we mean look at the <a href="decot.orig.c">original
|
||||
source file</a>. The <a href="decot.alt.c">alternate code</a> is the
|
||||
version that has this modification. The fixed version has instead:</p>
|
||||
<p>To see what we mean look at the <a href="decot.orig.c">original source file</a>. The
|
||||
<a href="decot.alt.c">alternate code</a> is the version that has this modification. The
|
||||
fixed version has instead:</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span><span class="op">(</span>signal<span class="op">=</span><span class="dv">0</span><span class="op">;*</span>k <span class="op">*=</span> <span class="op">*</span> __FILE__ <span class="op">*</span>i<span class="op">;)</span> <span class="cf">do</span> <span class="op">{</span></span></code></pre></div>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>No remarks were provided by the author.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-1984decot"><a name="inventory"></a>Inventory for
|
||||
1984/decot</h1>
|
||||
<h1 id="inventory-for-1984decot"><a name="inventory"></a>Inventory for 1984/decot</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/decot.c">decot.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/decot.alt.c">decot.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/decot.orig.c">decot.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a href="1984_decot.tar.bz2">1984_decot.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/decot.c">decot.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/decot.alt.c">decot.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/decot.orig.c">decot.orig.c</a> - original source</li>
|
||||
<li><a href="1984_decot.tar.bz2">1984_decot.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/decot/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+23
-36
@@ -123,52 +123,39 @@
|
||||
<!-- END: this line ends content from: inc/before-content.default.html -->
|
||||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
|
||||
<h1 id="first-annual-obfuscated-c-code-contest">First annual Obfuscated
|
||||
C Code Contest</h1>
|
||||
<p>In <a href="../years.html#1984">1984</a>, the first contest was held.
|
||||
The name of the contest was simply
|
||||
“<code>First annual Obfuscated C Code Contest</code>”.</p>
|
||||
<p>View the <code>index.html</code> web page for the given winning entry
|
||||
for information on how to compile it and how to run the winning program.
|
||||
Look at the winning source and try to figure how it does what it does!
|
||||
This year we only had remarks from two authors but these came years
|
||||
later.</p>
|
||||
<p>Restrictions against machine dependent code were not in the <a
|
||||
href="rules.txt">rules</a> in 1984. The source file size restriction was
|
||||
only 512 bytes. Rules and results were posted to <a
|
||||
href="https://groups.google.com/g/net.lang.c">net.lang.c</a> and <a
|
||||
href="https://groups.google.com/g/net.unix-wizards">net.unix-wizards</a>.
|
||||
The contest was announced in a <a
|
||||
href="https://groups.google.com/g/net.lang.c/c/lx-TAuEyeRI/m/HdOOnNx6LC0J">net.lang.c
|
||||
<h1 id="first-annual-obfuscated-c-code-contest">First annual Obfuscated C Code Contest</h1>
|
||||
<p>In <a href="../years.html#1984">1984</a>, the first contest was held. The name of the
|
||||
contest was simply “<code>First annual Obfuscated C Code Contest</code>”.</p>
|
||||
<p>View the <code>index.html</code> web page for the given winning entry for information on how
|
||||
to compile it and how to run the winning program. Look at the winning
|
||||
source and try to figure how it does what it does! This year we only had
|
||||
remarks from two authors but these came years later.</p>
|
||||
<p>Restrictions against machine dependent code were not in the <a href="rules.txt">rules</a>
|
||||
in 1984. The source file size restriction was only 512 bytes. Rules and results
|
||||
were posted to <a href="https://groups.google.com/g/net.lang.c">net.lang.c</a> and
|
||||
<a href="https://groups.google.com/g/net.unix-wizards">net.unix-wizards</a>. The contest
|
||||
was announced in a <a href="https://groups.google.com/g/net.lang.c/c/lx-TAuEyeRI/m/HdOOnNx6LC0J">net.lang.c
|
||||
post</a>.</p>
|
||||
<h2 id="final-comments">Final Comments</h2>
|
||||
<p><strong>IMPORTANT NOTE</strong>: See <a
|
||||
href="../contact.html">contact.html</a> for up to date contact details
|
||||
as well as details on how to provide fixes to any of the entries. See
|
||||
also <a href="../faq.html">the IOCCC FAQ</a> for addition information on
|
||||
the IOCCC.</p>
|
||||
<p><strong>IMPORTANT NOTE</strong>: See <a href="../contact.html">contact.html</a> for up to date contact details
|
||||
as well as details on how to provide fixes to any of the entries.
|
||||
See also <a href="../faq.html">the IOCCC FAQ</a> for addition information on the IOCCC.</p>
|
||||
<h1 id="copyright-and-license">Copyright and License</h1>
|
||||
<p>Copyright (c) 1984,2023, Landon Curt Noll. All Rights Reserved. This
|
||||
work is licensed under a <a
|
||||
href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons
|
||||
CC BY-SA 4.0 DEED Attribution-ShareAlike 4.0 International</a> license.
|
||||
If you do use this work in some form, the <a href="../judges.html">IOCCC
|
||||
judges</a> would appreciate (but does not require) if you were to <a
|
||||
href="../contact.html">send us a note about your use</a>.</p>
|
||||
<p>Copyright (c) 1984,2023, Landon Curt Noll. All Rights Reserved.
|
||||
This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons CC BY-SA 4.0 DEED Attribution-ShareAlike
|
||||
4.0 International</a> license.
|
||||
If you do use this work in some form, the <a href="../judges.html">IOCCC judges</a> would appreciate
|
||||
(but does not require) if you were to <a href="../contact.html">send us a note about your use</a>.</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-year-index.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-year-index.sh -->
|
||||
|
||||
<h1
|
||||
id="winning-entries-of-1984---the-1st-ioccc"><a name=inventory></a><a name=1984></a>Winning
|
||||
Entries of 1984 - The 1st IOCCC</h1>
|
||||
<p><strong>Download IOCCC</strong> <a
|
||||
href="1984/ioccc.1984.tar.bz2">1984 entry source</a></p>
|
||||
<h1 id="winning-entries-of-1984---the-1st-ioccc"><a name=inventory></a><a name=1984></a>Winning Entries of 1984 - The 1st IOCCC</h1>
|
||||
<p><strong>Download IOCCC</strong> <a href="1984/ioccc.1984.tar.bz2">1984 entry source</a></p>
|
||||
<ul>
|
||||
<li><a href="anonymous/index.html">1984/anonymous</a> - Dishonorable
|
||||
mention</li>
|
||||
<li><a href="anonymous/index.html">1984/anonymous</a> - Dishonorable mention</li>
|
||||
<li><a href="decot/index.html">1984/decot</a> - Second place</li>
|
||||
<li><a href="laman/index.html">1984/laman</a> - Third place</li>
|
||||
<li><a href="mullender/index.html">1984/mullender</a> - Grand Prize</li>
|
||||
|
||||
+19
-38
@@ -130,8 +130,8 @@
|
||||
<h2 id="author"><a name="author"></a>Author:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Mike_Laman">Mike Laman</a><br>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown
|
||||
location</em> <br><br></li>
|
||||
Location: <a href="../../location.html#ZZ">ZZ</a> - <em>Unknown location</em>
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,8 +144,8 @@ location</em> <br><br></li>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./laman</span> <span class="op"><</span>positive number<span class="op">></span></span></code></pre></div>
|
||||
<h2 id="try">Try:</h2>
|
||||
<p>The program accepts ONE POSITIVE number. Seeing is believing, so try
|
||||
things like:</p>
|
||||
<p>The program accepts ONE POSITIVE number. Seeing is believing, so try things
|
||||
like:</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./try.sh</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./laman</span> 4</span>
|
||||
@@ -153,8 +153,8 @@ things like:</p>
|
||||
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./laman</span> 16</span></code></pre></div>
|
||||
<p>This code should run you in circles.</p>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Some new compilers (in 1984) dislike lines 6 and 10 of the source, so
|
||||
we changed them from:</p>
|
||||
<p>Some new compilers (in 1984) dislike lines 6 and 10 of the source, so we changed
|
||||
them from:</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="op">;++</span>f<span class="op">)</span>a<span class="op">[</span> b<span class="op"><<</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span> <span class="op">=</span>d<span class="op">++,</span>b<span class="op">+</span> <span class="op">=</span>e<span class="op">;</span><span class="cf">for</span><span class="op">(</span> f<span class="op">=</span><span class="dv">0</span><span class="op">;</span>f<span class="op"><</span>O</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="op"><<</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]^</span> <span class="op">=</span>a<span class="op">[</span>b<span class="op"><<</span><span class="dv">5</span> <span class="op">|</span>c<span class="op">]^=</span>a<span class="op">[</span> <span class="op">(</span>k<span class="op">-(</span>b<span class="op">+</span><span class="dv">1</span> <span class="op">))<<</span><span class="dv">5</span><span class="op">|</span>c<span class="op">]</span></span></code></pre></div>
|
||||
<p>to:</p>
|
||||
@@ -163,53 +163,34 @@ we changed them from:</p>
|
||||
<p>I hope you have a C beautifier!</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<p>No remarks were provided by the author.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-1984laman"><a name="inventory"></a>Inventory for
|
||||
1984/laman</h1>
|
||||
<h1 id="inventory-for-1984laman"><a name="inventory"></a>Inventory for 1984/laman</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/laman.c">laman.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/laman.orig.c">laman.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/try.sh">try.sh</a>
|
||||
- how to run</li>
|
||||
<li><a href="1984_laman.tar.bz2">1984_laman.tar.bz2</a> - download entry
|
||||
source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/laman.c">laman.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/laman.orig.c">laman.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/try.sh">try.sh</a> - how to run</li>
|
||||
<li><a href="1984_laman.tar.bz2">1984_laman.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/laman/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
+240
-316
@@ -129,12 +129,12 @@
|
||||
|
||||
<h2 id="authors"><a name="author"></a>Authors:</h2>
|
||||
<ul>
|
||||
<li>Name: <a href="../../authors.html#Robbert_van_Renesse">Robbert van
|
||||
Renesse</a><br> Location: <a href="../../location.html#US">US</a> -
|
||||
<em>United States of America</em> (<em>United States</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Sjoerd_Mullender">Sjoerd
|
||||
Mullender</a><br> Location: <a href="../../location.html#NL">NL</a> -
|
||||
<em>Kingdom of the Netherlands</em> (<em>Netherlands</em>) <br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Robbert_van_Renesse">Robbert van Renesse</a><br>
|
||||
Location: <a href="../../location.html#US">US</a> - <em>United States of America</em> (<em>United States</em>)
|
||||
<br><br></li>
|
||||
<li>Name: <a href="../../authors.html#Sjoerd_Mullender">Sjoerd Mullender</a><br>
|
||||
Location: <a href="../../location.html#NL">NL</a> - <em>Kingdom of the Netherlands</em> (<em>Netherlands</em>)
|
||||
<br><br></li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||||
@@ -144,32 +144,29 @@ Mullender</a><br> Location: <a href="../../location.html#NL">NL</a> -
|
||||
|
||||
<h2 id="to-build">To build:</h2>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||||
<p>NOTE: the original code will not work on any system other than <a
|
||||
href="https://en.wikipedia.org/wiki/VAX-11">VAX-11</a> and <a
|
||||
href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> and this is why
|
||||
we encourage you to use the alt version instead. See <a
|
||||
href="#original-code">original code</a> below for the original
|
||||
version.</p>
|
||||
<p>NOTE: the original code will not work on any system other than
|
||||
<a href="https://en.wikipedia.org/wiki/VAX-11">VAX-11</a> and
|
||||
<a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> and this is why we encourage you
|
||||
to use the alt version instead. See <a href="#original-code">original code</a> below for
|
||||
the original version.</p>
|
||||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||||
<p>The current status of this entry is:</p>
|
||||
<pre><code>STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||||
<p>For more detailed information see <a
|
||||
href="../../bugs.html#1984_mullender">1984 mullender bugs</a>.</p>
|
||||
<p>For more detailed information see <a href="../../bugs.html#1984_mullender">1984 mullender bugs</a>.</p>
|
||||
<h2 id="to-use">To use:</h2>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./mullender.alt</span> <span class="pp">[</span><span class="ss">microseconds</span><span class="pp">]</span></span></code></pre></div>
|
||||
<p>Hit ctrl-c/intr to exit the program.</p>
|
||||
<p>The default microseconds is 190000 as this is approximately how long
|
||||
it slept in the original entry but it can be no lower than 5000 as any
|
||||
lower doesn’t work very well. This feature is so you can experiment with
|
||||
different speeds in between writes. It can be useful if your CPU is too
|
||||
fast :-)</p>
|
||||
<p>The author stated that the original version also had a delay but the
|
||||
difference is it required one to hit enter for it to print another line;
|
||||
the alt code will start over once it times out or if one hits a key.</p>
|
||||
<p>Note that the microseconds is argc and it uses <code>atoi()</code>
|
||||
which does NOT check for overflow!</p>
|
||||
<p>BTW: is there such a thing as too fast a CPU ? :-) Actually yes for
|
||||
certain code which is probably not as uncommon as you think :-).</p>
|
||||
<p>The default microseconds is 190000 as this is approximately how long it slept in
|
||||
the original entry but it can be no lower than 5000 as any lower doesn’t work
|
||||
very well. This feature is so you can experiment with different speeds in
|
||||
between writes. It can be useful if your CPU is too fast :-)</p>
|
||||
<p>The author stated that the original version also had a delay but the difference
|
||||
is it required one to hit enter for it to print another line; the alt code will
|
||||
start over once it times out or if one hits a key.</p>
|
||||
<p>Note that the microseconds is argc and it uses <code>atoi()</code> which does NOT check for
|
||||
overflow!</p>
|
||||
<p>BTW: is there such a thing as too fast a CPU ? :-) Actually yes for certain code
|
||||
which is probably not as uncommon as you think :-).</p>
|
||||
<h2 id="try">Try:</h2>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./mullender.alt</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
@@ -178,62 +175,53 @@ certain code which is probably not as uncommon as you think :-).</p>
|
||||
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="ex">./mullender.alt</span> 20000 <span class="co"># wait for 20000 microseconds and see what happens</span></span>
|
||||
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="ex">./mullender.alt</span> 100000 <span class="co"># wait for 100000 microseconds and see what happens</span></span></code></pre></div>
|
||||
<p>What happens if you hit enter after it reaches the end of the line?
|
||||
Why? What happens after some time of waiting?</p>
|
||||
<p>What happens if you hit enter after it reaches the end of the line? Why? What
|
||||
happens after some time of waiting?</p>
|
||||
<h2 id="original-code">Original code:</h2>
|
||||
<p>This original code will only execute correctly if your machine is a
|
||||
<a href="https://en.wikipedia.org/wiki/VAX-11">VAX-11</a> or <a
|
||||
href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a>. In the following
|
||||
years, 1985 on, machine dependent code was discouraged.</p>
|
||||
<a href="https://en.wikipedia.org/wiki/VAX-11">VAX-11</a> or
|
||||
<a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a>. In the following years, 1985 on,
|
||||
machine dependent code was discouraged.</p>
|
||||
<h3 id="original-build">Original build:</h3>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> all</span></code></pre></div>
|
||||
<h3 id="original-use">Original use:</h3>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./mullender</span></span></code></pre></div>
|
||||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||||
<p>Without question, this C program is the one of the most obfuscated C
|
||||
program that has ever been received! Like all great contest entries, it
|
||||
resulted in a change of rules for the following year. To prevent a flood
|
||||
of similar programs, the rules were changed, requesting non-machine
|
||||
specific code.</p>
|
||||
<p>Without question, this C program is the one of the most obfuscated C program
|
||||
that has ever been received! Like all great contest entries, it resulted in a
|
||||
change of rules for the following year. To prevent a flood of similar programs,
|
||||
the rules were changed, requesting non-machine specific code.</p>
|
||||
<p>This program was selected for the 1987 t-shirt collection.</p>
|
||||
<p>The C startup routine (via <a
|
||||
href="https://en.wikipedia.org/wiki/Crt0">crt0.o</a>) transfers control
|
||||
to a location named <code>main</code>. In this case, <code>main</code>
|
||||
just happens to be in the data area. The array of <code>short</code>s,
|
||||
which has been further obfuscated by use of different data types, just
|
||||
happens to form a meaningful set of <a
|
||||
href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> and <a
|
||||
href="https://en.wikipedia.org/wiki/VAX">VAX</a> instructions.</p>
|
||||
<p>The first word is a <a
|
||||
href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> branch
|
||||
instruction that branches to the rest of the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
code.</p>
|
||||
<p>On the VAX <code>main</code> is called with the <a
|
||||
href="https://jcsites.juniata.edu/faculty/rhodes/org/instr.htm#CALLS">calls
|
||||
instruction</a> which uses the first word of the subroutine as a mask of
|
||||
registers to be saved. So on the VAX the first word can be anything. The
|
||||
real VAX code starts with the second word.</p>
|
||||
<p>This small program makes direct calls to the <code>write()</code>
|
||||
Unix system call to produce a message on the screen. Can you guess what
|
||||
is printed? We knew you couldn’t! :-)</p>
|
||||
<p>The C startup routine (via <a href="https://en.wikipedia.org/wiki/Crt0">crt0.o</a>)
|
||||
transfers control to a location named <code>main</code>. In this case, <code>main</code> just happens
|
||||
to be in the data area. The array of <code>short</code>s, which has been further
|
||||
obfuscated by use of different data types, just happens to form a meaningful set
|
||||
of <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> and
|
||||
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a> instructions.</p>
|
||||
<p>The first word is a <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> branch
|
||||
instruction that branches to the rest of the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> code.</p>
|
||||
<p>On the VAX <code>main</code> is called with the <a href="https://jcsites.juniata.edu/faculty/rhodes/org/instr.htm#CALLS">calls
|
||||
instruction</a>
|
||||
which uses the first word of the subroutine as a mask of registers to be saved.
|
||||
So on the VAX the first word can be anything. The real VAX code starts with the
|
||||
second word.</p>
|
||||
<p>This small program makes direct calls to the <code>write()</code> Unix system call to
|
||||
produce a message on the screen. Can you guess what is printed? We knew you
|
||||
couldn’t! :-)</p>
|
||||
<p>What happens if you hit enter after it writes a line of output?</p>
|
||||
<p>BTW: to this day, 2023, this remains one of my (Landon Curt Noll’s)
|
||||
all time favorite entries!</p>
|
||||
<p>BTW: to this day, 2023, this remains one of my (Landon Curt Noll’s) all time
|
||||
favorite entries!</p>
|
||||
<h3 id="gentab.c">gentab.c</h3>
|
||||
<p>In 2023 remarks were discovered from <a
|
||||
href="../../authors.html#Sjoerd_Mullender">Sjoerd Mullender</a>, one of
|
||||
the authors, and so was the program that was used by the authors to
|
||||
generate the array that he referred to. Because <a
|
||||
href="a.out.h">a.out.h</a>, which <a href="gentab.c">gentab.c</a> uses,
|
||||
is not available in all systems (like macOS) and more importantly
|
||||
because we wanted it to be as close to as the original as possible we
|
||||
used a copy of <a
|
||||
href="https://raw.githubusercontent.com/dspinellis/unix-history-repo/Research-Release/usr/include/a.out.h"
|
||||
class="uri">https://raw.githubusercontent.com/dspinellis/unix-history-repo/Research-Release/usr/include/a.out.h</a>
|
||||
in the <em>fabulous</em> <a
|
||||
href="https://github.com/dspinellis/unix-history-repo/tree/Research-Release">Unix
|
||||
History Repo</a>.</p>
|
||||
<p>In 2023 remarks were discovered from <a href="../../authors.html#Sjoerd_Mullender">Sjoerd
|
||||
Mullender</a>, one of the authors, and so was the
|
||||
program that was used by the authors to generate the array that he referred to.
|
||||
Because <a href="a.out.h">a.out.h</a>, which <a href="gentab.c">gentab.c</a> uses, is not available in
|
||||
all systems (like macOS) and more importantly because we wanted it to be as
|
||||
close to as the original as possible we used a copy of
|
||||
<a href="https://raw.githubusercontent.com/dspinellis/unix-history-repo/Research-Release/usr/include/a.out.h" class="uri">https://raw.githubusercontent.com/dspinellis/unix-history-repo/Research-Release/usr/include/a.out.h</a>
|
||||
in the <em>fabulous</em> <a href="https://github.com/dspinellis/unix-history-repo/tree/Research-Release">Unix History
|
||||
Repo</a>.</p>
|
||||
<h3 id="gentab-build">gentab build:</h3>
|
||||
<p><code>gentab.c</code> can be built like:</p>
|
||||
<div class="sourceCode" id="cb7"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> gentab</span></code></pre></div>
|
||||
@@ -241,134 +229,110 @@ History Repo</a>.</p>
|
||||
<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./gentab</span> file</span></code></pre></div>
|
||||
<h3 id="gentab-try">gentab try:</h3>
|
||||
<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">./gentab</span> gentab <span class="op">></span> g.c</span></code></pre></div>
|
||||
<p>NOTE: it is highly unlikely that you will be able to run the output
|
||||
of <code>gentab</code> but it should at least compile.</p>
|
||||
<p>NOTE: it is highly unlikely that you will be able to run the output of <code>gentab</code>
|
||||
but it should at least compile.</p>
|
||||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||||
<h3 id="notes-from-the-judges">Notes from the judges:</h3>
|
||||
<p>These remarks, found at <a
|
||||
href="https://lainsystems.com/posts/exploring-mullender-dot-c/">https://lainsystems.com/posts/exploring-mullender-dot-c/</a>,
|
||||
were provided by Sjoerd Mullender years later. We thank the author of
|
||||
the article for the quote! For a more detailed analysis, taken from the
|
||||
book Obfuscated C and Other Mysteries, see below. We hope that this is
|
||||
okay with the author of the book. Considering that the analysis is
|
||||
entirely the authors’ comments we don’t think this will be a problem.
|
||||
Unfortunately the excerpt was PDF and it did not copy paste well. We had
|
||||
to go back and forth to type so it’s possible he made a typo though he
|
||||
also fixed some typos found in the extract. As for the other
|
||||
<p>These remarks, found at
|
||||
<a href="https://lainsystems.com/posts/exploring-mullender-dot-c/">https://lainsystems.com/posts/exploring-mullender-dot-c/</a>,
|
||||
were provided by Sjoerd Mullender years later. We thank the author of the
|
||||
article for the quote! For a more detailed analysis, taken from the book Obfuscated C
|
||||
and Other Mysteries, see below. We hope that this is okay with the author of the
|
||||
book. Considering that the analysis is entirely the authors’ comments we don’t
|
||||
think this will be a problem. Unfortunately the excerpt was PDF and it did not
|
||||
copy paste well. We had to go back and forth to type so it’s possible he made a
|
||||
typo though he also fixed some typos found in the extract. As for the other
|
||||
comments:</p>
|
||||
<h3 id="remarks-from-the-author">Remarks from the author:</h3>
|
||||
<p>I have never known a lot about the <a
|
||||
href="https://en.wikipedia.org/wiki/VAX">VAX</a> <a
|
||||
href="https://en.wikipedia.org/wiki/Assembly_language">assembly</a>, so
|
||||
we used the C compiler to create the VAX code. We didn’t write it
|
||||
ourselves from scratch as we did with the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
code. This is the reason why the <a
|
||||
href="https://en.wikipedia.org/wiki/VAX">VAX</a> code is more complex,
|
||||
including the extra data after the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
code.</p>
|
||||
<p>Robbert and I were students at the <a href="https://vu.nl/en">VU
|
||||
(Free University in Amsterdam)</a> at the time (mathematics with CS as
|
||||
our major since there was no CS curriculum when we started). We had an
|
||||
assignment to create a pair of programs for the computer networks
|
||||
course. The programs were supposed to send data reliably from one
|
||||
program to the other over an unreliable channel. This channel was
|
||||
simulated with a pair of <a
|
||||
href="https://en.wikipedia.org/wiki/Pipeline_(software)">pipes</a>.</p>
|
||||
<p>We decided for fun to create an <a
|
||||
href="https://en.wikipedia.org/wiki/Obfuscation_(software)">obfuscated</a>
|
||||
set of programs, only for the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>,
|
||||
to do this, but circumventing the channel (i.e. cheating, hence the
|
||||
needed obfuscation.). Our programs worked and we handed them in.</p>
|
||||
<p>Of course, the teacher had a good laugh and then rejected our
|
||||
submission. (We knew him well, so we could get away with this.)</p>
|
||||
<p>Then the <a href="https://www.ioccc.org">IOCCC</a> came along. I
|
||||
don’t remember how we heard about it, but at the time there was a
|
||||
world-wide messaging network Usenet where we read a bunch of newsgroups.
|
||||
I’m sure it was <a
|
||||
href="https://groups.google.com/g/net.lang.c/c/lx-TAuEyeRI/m/HdOOnNx6LC0J">announced
|
||||
there</a> and we saw it.</p>
|
||||
<p>Since we had just recently created these <a
|
||||
href="https://en.wikipedia.org/wiki/Obfuscation_(software)">obfuscated
|
||||
programs</a>) we decided we could use the same technique for an
|
||||
obfuscated C program. We upped the ante a bit by making it
|
||||
“portable”.</p>
|
||||
<p>To add to the <a
|
||||
href="https://en.wikipedia.org/wiki/Obfuscation_(software)">obfuscation</a>),
|
||||
we used different formats for the integers in the array: some in
|
||||
decimal, some in octal, some in hexadecimal, and when the value would
|
||||
fit, some as an ASCII character.</p>
|
||||
<p>I have never known a lot about the <a href="https://en.wikipedia.org/wiki/VAX">VAX</a>
|
||||
<a href="https://en.wikipedia.org/wiki/Assembly_language">assembly</a>, so we used the C
|
||||
compiler to create the VAX code. We didn’t write it ourselves from scratch as we
|
||||
did with the <a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
code. This is the reason why the <a href="https://en.wikipedia.org/wiki/VAX">VAX</a> code
|
||||
is more complex, including the extra data after the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> code.</p>
|
||||
<p>Robbert and I were students at the <a href="https://vu.nl/en">VU (Free University in
|
||||
Amsterdam)</a> at the time (mathematics with CS as our major
|
||||
since there was no CS curriculum when we started). We had an assignment to
|
||||
create a pair of programs for the computer networks course. The programs were
|
||||
supposed to send data reliably from one program to the other over an unreliable
|
||||
channel. This channel was simulated with a pair of
|
||||
<a href="https://en.wikipedia.org/wiki/Pipeline_(software)">pipes</a>.</p>
|
||||
<p>We decided for fun to create an
|
||||
<a href="https://en.wikipedia.org/wiki/Obfuscation_(software)">obfuscated</a> set of
|
||||
programs, only for the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>, to do this, but
|
||||
circumventing the channel (i.e. cheating, hence the needed obfuscation.). Our
|
||||
programs worked and we handed them in.</p>
|
||||
<p>Of course, the teacher had a good laugh and then rejected our submission. (We
|
||||
knew him well, so we could get away with this.)</p>
|
||||
<p>Then the <a href="https://www.ioccc.org">IOCCC</a> came along. I don’t remember how we
|
||||
heard about it, but at the time there was a world-wide messaging network Usenet
|
||||
where we read a bunch of newsgroups. I’m sure it was <a href="https://groups.google.com/g/net.lang.c/c/lx-TAuEyeRI/m/HdOOnNx6LC0J">announced
|
||||
there</a> and we saw
|
||||
it.</p>
|
||||
<p>Since we had just recently created these <a href="https://en.wikipedia.org/wiki/Obfuscation_(software)">obfuscated
|
||||
programs</a>) we decided we could
|
||||
use the same technique for an obfuscated C program. We upped the ante a bit by
|
||||
making it “portable”.</p>
|
||||
<p>To add to the
|
||||
<a href="https://en.wikipedia.org/wiki/Obfuscation_(software)">obfuscation</a>), we used
|
||||
different formats for the integers in the array: some in decimal, some in octal,
|
||||
some in hexadecimal, and when the value would fit, some as an ASCII character.</p>
|
||||
<p>The rest is history.</p>
|
||||
<p>Since this was the first contest, we hadn’t seen any old entries, nor
|
||||
had any of the other contestants. Of course we knew about
|
||||
<code>#define</code> and tricks you could do with that, but we didn’t
|
||||
need that for this program. In fact, we made it as “standard” as
|
||||
possible. At the time there was this program called <code>cb</code> or C
|
||||
beautifier which would re-indent your program to make the layout look
|
||||
better. Our program is idempotent under <code>cb</code>.</p>
|
||||
<p>Since this was the first contest, we hadn’t seen any old entries, nor had any of
|
||||
the other contestants. Of course we knew about <code>#define</code> and tricks you could do
|
||||
with that, but we didn’t need that for this program. In fact, we made it as
|
||||
“standard” as possible. At the time there was this program called <code>cb</code> or C
|
||||
beautifier which would re-indent your program to make the layout look better.
|
||||
Our program is idempotent under <code>cb</code>.</p>
|
||||
<h3 id="more-detailed-analysis">More detailed analysis</h3>
|
||||
<p>When this program is compiled, the compiler places the array
|
||||
somewhere in memory, just like it places any compiled code somewhere in
|
||||
memory. Usually, the C startup code (<a
|
||||
href="https://en.wikipedia.org/wiki/Crt0">crt0.o</a>) calls a routine
|
||||
named <code>main()</code>. The loader fills in the address in the
|
||||
startup code, but at least on the old systems where this program ran, it
|
||||
doesn’t know that the <code>main()</code> in this program isn’t code but
|
||||
data!</p>
|
||||
<p>When the program is run, the C startup code transfers control to the
|
||||
location <code>main</code>. The contents of the array just happen to be
|
||||
machine instructions for both a <a
|
||||
href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> and a <a
|
||||
href="https://en.wikipedia.org/wiki/VAX">VAX</a>.</p>
|
||||
<p>On the <a href="https://en.wikipedia.org/wiki/VAX">VAX</a>, the
|
||||
routine <code>main()</code> is called with the <code>calls</code>
|
||||
instruction. This instruction uses the first (2-byte) <a
|
||||
href="https://en.wikipedia.org/wiki/Word_(computer_architecture)">word</a>
|
||||
of the called routine as a mask of <a
|
||||
href="https://en.wikipedia.org/wiki/Processor_register">registers</a>
|
||||
that are to be saved on the <a
|
||||
href="https://en.wikipedia.org/wiki/Stack_(abstract_data_type)">stack</a>.
|
||||
In other words, on the VAX the first word can be anything. On the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>,
|
||||
the first word is a <a
|
||||
href="https://en.wikipedia.org/wiki/Branch_(computer_science)">branch</a>
|
||||
<a
|
||||
href="https://en.wikipedia.org/wiki/Instruction_set_architecture#Instructions">instruction</a>
|
||||
that branches over the VAX code. The PDP and VAX codes are thus
|
||||
completely separate.</p>
|
||||
<p>The <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
and <a href="https://en.wikipedia.org/wiki/VAX">VAX</a> codes implement
|
||||
the same algorithm:</p>
|
||||
<p>When this program is compiled, the compiler places the array somewhere in
|
||||
memory, just like it places any compiled code somewhere in memory. Usually, the
|
||||
C startup code (<a href="https://en.wikipedia.org/wiki/Crt0">crt0.o</a>) calls a routine
|
||||
named <code>main()</code>. The loader fills in the address in the startup code, but at
|
||||
least on the old systems where this program ran, it doesn’t know that the
|
||||
<code>main()</code> in this program isn’t code but data!</p>
|
||||
<p>When the program is run, the C startup code transfers control to the location
|
||||
<code>main</code>. The contents of the array just happen to be machine instructions for
|
||||
both a <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> and a
|
||||
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a>.</p>
|
||||
<p>On the <a href="https://en.wikipedia.org/wiki/VAX">VAX</a>, the routine <code>main()</code> is called
|
||||
with the <code>calls</code> instruction. This instruction uses the first (2-byte)
|
||||
<a href="https://en.wikipedia.org/wiki/Word_(computer_architecture)">word</a> of the called
|
||||
routine as a mask of
|
||||
<a href="https://en.wikipedia.org/wiki/Processor_register">registers</a> that are to be
|
||||
saved on the <a href="https://en.wikipedia.org/wiki/Stack_(abstract_data_type)">stack</a>.
|
||||
In other words, on the VAX the first word can be anything. On the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>, the first word
|
||||
is a <a href="https://en.wikipedia.org/wiki/Branch_(computer_science)">branch</a>
|
||||
<a href="https://en.wikipedia.org/wiki/Instruction_set_architecture#Instructions">instruction</a>
|
||||
that branches over the VAX code. The PDP and VAX codes are thus completely
|
||||
separate.</p>
|
||||
<p>The <a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> and
|
||||
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a> codes implement the same algorithm:</p>
|
||||
<div class="sourceCode" id="cb10"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a> <span class="cf">for</span> <span class="op">(;;)</span> <span class="op">{</span></span>
|
||||
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a> write<span class="op">(</span><span class="dv">1</span><span class="op">,</span> <span class="st">" :-)</span><span class="sc">\b\b\b\b</span><span class="st">"</span><span class="op">,</span> <span class="dv">9</span><span class="op">);</span></span>
|
||||
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a> delay<span class="op">();</span></span>
|
||||
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code></pre></div>
|
||||
<p>The result is that the symbols <code>:-)</code> move across the
|
||||
screen. <code>delay</code> is implemented differently on the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>,
|
||||
where we used a nonexistent system call (<code>sys 55</code>), and on
|
||||
the <a href="https://en.wikipedia.org/wiki/VAX">VAX</a> where we used a
|
||||
delay loop.</p>
|
||||
<p>My co-author, Robbert, and I had earlier written a similar program
|
||||
for an assignment on the <a
|
||||
href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a>. <a
|
||||
href="https://groups.google.com/g/net.lang.c/c/lx-TAuEyeRI/m/HdOOnNx6LC0J">Along
|
||||
came</a> the first <a href="https://www.ioccc.org">Obfuscated C Code
|
||||
Contest</a>, and we decided that we should write a program like this,
|
||||
but make it run on two different <a
|
||||
href="https://en.wikipedia.org/wiki/Computer_architecture">architectures</a>.</p>
|
||||
<p>We didn’t think long about what the program should do, so it does
|
||||
something very simple.</p>
|
||||
<p>We started with writing the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
code in assembly. We both knew <a
|
||||
href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> assembly so that
|
||||
was no problem. The assembly code we came up with is as follows:</p>
|
||||
<div class="sourceCode" id="cb11"><pre
|
||||
class="sourceCode asm"><code class="sourceCode fasm"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">pdp:</span></span>
|
||||
<p>The result is that the symbols <code>:-)</code> move across the screen. <code>delay</code> is
|
||||
implemented differently on the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>, where we used a
|
||||
nonexistent system call (<code>sys 55</code>), and on the
|
||||
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a> where we used a delay loop.</p>
|
||||
<p>My co-author, Robbert, and I had earlier written a similar program for an
|
||||
assignment on the <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a>. <a href="https://groups.google.com/g/net.lang.c/c/lx-TAuEyeRI/m/HdOOnNx6LC0J">Along
|
||||
came</a> the
|
||||
first <a href="https://www.ioccc.org">Obfuscated C Code Contest</a>, and
|
||||
we decided that we should write a program like this, but make it run on two
|
||||
different <a href="https://en.wikipedia.org/wiki/Computer_architecture">architectures</a>.</p>
|
||||
<p>We didn’t think long about what the program should do, so it does something very
|
||||
simple.</p>
|
||||
<p>We started with writing the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> code in assembly.
|
||||
We both knew <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> assembly so that was
|
||||
no problem. The assembly code we came up with is as follows:</p>
|
||||
<div class="sourceCode" id="cb11"><pre class="sourceCode asm"><code class="sourceCode fasm"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">pdp:</span></span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="bu">mov</span> pc<span class="op">,</span>r4</span>
|
||||
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a> tst <span class="op">-(</span>r4<span class="op">)</span></span>
|
||||
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a> <span class="bu">sub</span> <span class="op">$</span><span class="bn">9</span><span class="op">,</span> r4</span>
|
||||
@@ -380,42 +344,35 @@ class="sourceCode asm"><code class="sourceCode fasm"><span id="cb11-1"><a href="
|
||||
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true" tabindex="-1"></a> sys <span class="dv">55</span></span>
|
||||
<span id="cb11-11"><a href="#cb11-11" aria-hidden="true" tabindex="-1"></a> sob r2<span class="op">,</span><span class="bn">1b</span></span>
|
||||
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true" tabindex="-1"></a> br pdp</span></code></pre></div>
|
||||
<p>This is not the code we originally wrote, but it is the code that we
|
||||
ultimately used in the program. The string to be printed is shared by
|
||||
the <a href="https://en.wikipedia.org/wiki/VAX">VAX</a> and the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
<p>This is not the code we originally wrote, but it is the code that we ultimately
|
||||
used in the program. The string to be printed is shared by the
|
||||
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a> and the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
code and is located between the two sections.</p>
|
||||
<p>First, the program deals with figuring out the address of the string.
|
||||
Then the <a href="https://en.wikipedia.org/wiki/Program_counter">program
|
||||
counter</a> is saved in a scratch <a
|
||||
href="https://en.wikipedia.org/wiki/Processor_register">register</a>.
|
||||
Since the program counter points at the second <a
|
||||
href="https://en.wikipedia.org/wiki/Instruction_set_architecture#Instructions">instruction</a>,
|
||||
we subtract 2 from the scratch register in the second instruction. Then
|
||||
we subtract the length of the string and store the result in the
|
||||
location with label 0. This has to do with the calling sequence of <a
|
||||
href="https://en.wikipedia.org/wiki/System_call">system calls</a> on the
|
||||
<a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>.
|
||||
Following the <code>sys</code> instruction is the system call number (4
|
||||
for <code>write()</code>), the address of the buffer (pointed to by
|
||||
label 0), and the length of the buffer (9). The <a
|
||||
href="https://en.wikipedia.org/wiki/File_descriptor">file descriptor</a>
|
||||
is in register <code>r0</code>. The rest of the code implements a delay
|
||||
loop. In each iteration, a non-existing system call (55) slows things
|
||||
down.</p>
|
||||
<p>We assembled this program and extracted the <a
|
||||
href="https://en.wikipedia.org/wiki/Machine_code">machine code</a> from
|
||||
the resulting <a href="https://en.wikipedia.org/wiki/Object_file">object
|
||||
file</a>. We used this code in the <a
|
||||
href="https://en.wikipedia.org/wiki/VAX">VAX</a> part. Since neither of
|
||||
us were fluent in VAX <a
|
||||
href="https://en.wikipedia.org/wiki/Assembly_language">assembly</a>, we
|
||||
wrote the VAX code in C and massaged the <a
|
||||
href="https://en.wikipedia.org/wiki/Compiler">compiler</a> output. The
|
||||
VAX assembly program that we came up with is as follows:</p>
|
||||
<div class="sourceCode" id="cb12"><pre
|
||||
class="sourceCode asm"><code class="sourceCode fasm"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">vax:</span> .<span class="dt">word</span> <span class="dv">0400</span> <span class="op">+</span> <span class="op">(</span>pdp <span class="op">-</span> vax<span class="op">)</span> <span class="op">/</span> <span class="dv">2</span> <span class="op">-</span> <span class="dv">1</span></span>
|
||||
<p>First, the program deals with figuring out the address of the string. Then the
|
||||
<a href="https://en.wikipedia.org/wiki/Program_counter">program counter</a> is saved in a
|
||||
scratch <a href="https://en.wikipedia.org/wiki/Processor_register">register</a>. Since the
|
||||
program counter points at the second
|
||||
<a href="https://en.wikipedia.org/wiki/Instruction_set_architecture#Instructions">instruction</a>,
|
||||
we subtract 2 from the scratch register in the second instruction. Then we
|
||||
subtract the length of the string and store the result in the location with
|
||||
label 0. This has to do with the calling sequence of <a href="https://en.wikipedia.org/wiki/System_call">system
|
||||
calls</a> on the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>. Following the
|
||||
<code>sys</code> instruction is the system call number (4 for <code>write()</code>), the address of
|
||||
the buffer (pointed to by label 0), and the length of the buffer (9). The <a href="https://en.wikipedia.org/wiki/File_descriptor">file
|
||||
descriptor</a> is in register <code>r0</code>.
|
||||
The rest of the code implements a delay loop. In each iteration, a non-existing
|
||||
system call (55) slows things down.</p>
|
||||
<p>We assembled this program and extracted the <a href="https://en.wikipedia.org/wiki/Machine_code">machine
|
||||
code</a> from the resulting <a href="https://en.wikipedia.org/wiki/Object_file">object
|
||||
file</a>. We used this code in the
|
||||
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a> part. Since neither of us were fluent in
|
||||
VAX <a href="https://en.wikipedia.org/wiki/Assembly_language">assembly</a>, we wrote the
|
||||
VAX code in C and massaged the
|
||||
<a href="https://en.wikipedia.org/wiki/Compiler">compiler</a> output. The VAX assembly
|
||||
program that we came up with is as follows:</p>
|
||||
<div class="sourceCode" id="cb12"><pre class="sourceCode asm"><code class="sourceCode fasm"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="fu">vax:</span> .<span class="dt">word</span> <span class="dv">0400</span> <span class="op">+</span> <span class="op">(</span>pdp <span class="op">-</span> vax<span class="op">)</span> <span class="op">/</span> <span class="dv">2</span> <span class="op">-</span> <span class="dv">1</span></span>
|
||||
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a>1:</span>
|
||||
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a> pushl <span class="op">$</span><span class="bn">9</span></span>
|
||||
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a> pushal str</span>
|
||||
@@ -435,44 +392,38 @@ class="sourceCode asm"><code class="sourceCode fasm"><span id="cb12-1"><a href="
|
||||
<span id="cb12-18"><a href="#cb12-18" aria-hidden="true" tabindex="-1"></a><span class="fu">str:</span> .ascii <span class="st">" :-)\b\b\b\b"</span></span>
|
||||
<span id="cb12-19"><a href="#cb12-19" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb12-20"><a href="#cb12-20" aria-hidden="true" tabindex="-1"></a><span class="fu">pdp:</span> .<span class="dt">word</span> <span class="dv">4548</span><span class="op">,</span> <span class="dv">3044</span><span class="op">,</span> <span class="dv">58820</span><span class="op">,</span> <span class="dv">9</span><span class="op">,</span> <span class="dv">4407</span><span class="op">,</span> <span class="dv">6</span><span class="op">,</span> <span class="dv">5568</span><span class="op">,</span> <span class="dv">1</span><span class="op">,</span> <span class="dv">35076</span><span class="op">,</span> <span class="dv">0</span><span class="op">,</span> <span class="dv">9</span><span class="op">,</span> <span class="dv">5570</span><span class="op">,</span> <span class="dv">512</span><span class="op">,</span> <span class="dv">35117</span><span class="op">,</span> <span class="dv">32386</span><span class="op">,</span> <span class="dv">496</span></span></code></pre></div>
|
||||
<p>The first word (after the label <code>vax</code>) is the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
<a href="https://en.wikipedia.org/wiki/Branch_(computer_science)">branch
|
||||
instruction</a>. <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
branch instructions are octal <code>400+</code> the distance divided by
|
||||
2. The string that both the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
and <a href="https://en.wikipedia.org/wiki/VAX">VAX</a> programs use is
|
||||
after the <code>str</code> label, and the <a
|
||||
href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a>
|
||||
code is after the pdp label.</p>
|
||||
<p>On the <a href="https://en.wikipedia.org/wiki/VAX">VAX</a>, the
|
||||
program <a
|
||||
href="https://en.wikipedia.org/wiki/Stack_(abstract_data_type)">pushes</a>
|
||||
9 (the length of the string), the address of the string and 1 (the <a
|
||||
href="https://en.wikipedia.org/wiki/File_descriptor">file descriptor</a>
|
||||
on the <a
|
||||
href="https://en.wikipedia.org/wiki/Stack_(abstract_data_type)">stack</a>
|
||||
and calls <code>write(2)</code>. Since we didn’t know the exact calling
|
||||
sequence for <a href="https://en.wikipedia.org/wiki/System_call">system
|
||||
calls</a>, we just copied the source for the <code>write(2)</code>
|
||||
system call stub into our program. After <code>write(2)</code> finishes,
|
||||
the program executes a delay loop, after which it jumps back to the
|
||||
start of the program.</p>
|
||||
<p>We assembled this program, and extracted the <a
|
||||
href="https://en.wikipedia.org/wiki/Machine_code">machine code</a> from
|
||||
the <a href="https://en.wikipedia.org/wiki/Object_file">object file</a>.
|
||||
After this we only had to convert the machine code to <a
|
||||
href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> and write a little
|
||||
bit of C to glue everything together. We wanted to use different formats
|
||||
for each constant in the resulting array, and we wanted to choose the
|
||||
format randomly. So we wrote a program to choose an appropriate format
|
||||
at random. The program we wrote for that follows. This program actually
|
||||
also extracted the machine code from the object file.</p>
|
||||
<p>The first word (after the label <code>vax</code>) is the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> <a href="https://en.wikipedia.org/wiki/Branch_(computer_science)">branch
|
||||
instruction</a>.
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> branch
|
||||
instructions are octal <code>400+</code> the distance divided by 2. The string that both
|
||||
the <a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> and
|
||||
<a href="https://en.wikipedia.org/wiki/VAX">VAX</a>
|
||||
programs use is after the <code>str</code> label, and the
|
||||
<a href="https://en.wikipedia.org/wiki/Programmed_Data_Processor">PDP</a> code is after the
|
||||
pdp label.</p>
|
||||
<p>On the <a href="https://en.wikipedia.org/wiki/VAX">VAX</a>, the program
|
||||
<a href="https://en.wikipedia.org/wiki/Stack_(abstract_data_type)">pushes</a> 9 (the length
|
||||
of the string), the address of the string and 1 (the <a href="https://en.wikipedia.org/wiki/File_descriptor">file
|
||||
descriptor</a> on the
|
||||
<a href="https://en.wikipedia.org/wiki/Stack_(abstract_data_type)">stack</a> and calls
|
||||
<code>write(2)</code>. Since we didn’t know the exact calling sequence for <a href="https://en.wikipedia.org/wiki/System_call">system
|
||||
calls</a>, we just copied the source for
|
||||
the <code>write(2)</code> system call stub into our program. After <code>write(2)</code> finishes, the
|
||||
program executes a delay loop, after which it jumps back to the start of the
|
||||
program.</p>
|
||||
<p>We assembled this program, and extracted the <a href="https://en.wikipedia.org/wiki/Machine_code">machine
|
||||
code</a> from the <a href="https://en.wikipedia.org/wiki/Object_file">object
|
||||
file</a>. After this we only had to
|
||||
convert the machine code to <a href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> and
|
||||
write a little bit of C to glue everything together. We wanted to use different
|
||||
formats for each constant in the resulting array, and we wanted to choose the
|
||||
format randomly. So we wrote a program to choose an appropriate format at
|
||||
random. The program we wrote for that follows. This program actually also
|
||||
extracted the machine code from the object file.</p>
|
||||
<blockquote>
|
||||
<p>NOTE from judges: see <a href="gentab.c">gentab.c</a> for a copy of
|
||||
this file that can be compiled in modern systems.</p>
|
||||
<p>NOTE from judges: see <a href="gentab.c">gentab.c</a> for a copy of this file that can be
|
||||
compiled in modern systems.</p>
|
||||
</blockquote>
|
||||
<div class="sourceCode" id="cb13"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>\#include <span class="op"><</span>stdio<span class="op">.</span>h<span class="op">></span></span>
|
||||
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a>\#include <span class="op"><</span>a<span class="op">.</span>out<span class="op">.</span>h<span class="op">></span></span>
|
||||
@@ -527,75 +478,48 @@ this file that can be compiled in modern systems.</p>
|
||||
<span id="cb13-51"><a href="#cb13-51" aria-hidden="true" tabindex="-1"></a> printf<span class="op">(</span><span class="st">"};</span><span class="sc">\n</span><span class="st">"</span><span class="op">);</span></span>
|
||||
<span id="cb13-52"><a href="#cb13-52" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
|
||||
<span id="cb13-53"><a href="#cb13-53" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
|
||||
<p>As can be seen, there is a slight preference for decimal, and also a
|
||||
character format is sometimes used, but only if the data is a printable
|
||||
ASCII character.</p>
|
||||
<p>When we ran this program, we were almost completely satisfied with
|
||||
the result. The only problem we had was that the program had chosen an
|
||||
<a href="https://en.wikipedia.org/wiki/Octal">octal</a> representation
|
||||
for the first word. Since everybody knows what a <a
|
||||
href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> branch
|
||||
instruction looks like (everyone knows that the traditional magic word
|
||||
for an executable, <code>0407</code>, is a <a
|
||||
href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> <a
|
||||
href="https://en.wikipedia.org/wiki/Branch_(computer_science)">branch</a>),
|
||||
we changed that to decimal. After checking the size of the resulting
|
||||
program we saw that it was one byte too long. The limit was 512 bytes,
|
||||
and our program was 513 bytes. So we changed the word <code>and</code>
|
||||
in the comment to <code>&&</code>.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0
|
||||
License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights
|
||||
Reserved. You are free to share and adapt this file under the terms of
|
||||
this license:</p>
|
||||
<p>As can be seen, there is a slight preference for decimal, and also a character
|
||||
format is sometimes used, but only if the data is a printable ASCII character.</p>
|
||||
<p>When we ran this program, we were almost completely satisfied with the result.
|
||||
The only problem we had was that the program had chosen an
|
||||
<a href="https://en.wikipedia.org/wiki/Octal">octal</a> representation for the first word.
|
||||
Since everybody knows what a <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a>
|
||||
branch instruction looks like (everyone knows that the traditional magic word
|
||||
for an executable, <code>0407</code>, is a <a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a>
|
||||
<a href="https://en.wikipedia.org/wiki/Branch_(computer_science)">branch</a>), we changed
|
||||
that to decimal. After checking the size of the resulting program we saw that it
|
||||
was one byte too long. The limit was 512 bytes, and our program was 513 bytes.
|
||||
So we changed the word <code>and</code> in the comment to <code>&&</code>.</p>
|
||||
<h2 id="copyright-and-cc-by-sa-4.0-license">Copyright and CC BY-SA 4.0 License:</h2>
|
||||
<p>This file is Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
You are free to share and adapt this file under the terms of this license:</p>
|
||||
<pre><code>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)</code></pre>
|
||||
<p>For more information, see:
|
||||
https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
<p>For more information, see: https://creativecommons.org/licenses/by-sa/4.0/</p>
|
||||
|
||||
<!-- END: this line ends content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||||
<!-- START: this line starts content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||||
|
||||
<!-- START: this line starts content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
<h1 id="inventory-for-1984mullender"><a name="inventory"></a>Inventory
|
||||
for 1984/mullender</h1>
|
||||
<h1 id="inventory-for-1984mullender"><a name="inventory"></a>Inventory for 1984/mullender</h1>
|
||||
<p><a href="#top">Jump to top</a></p>
|
||||
<h2 id="primary-files">Primary files</h2>
|
||||
<ul>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.c">mullender.c</a>
|
||||
- entry source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/Makefile">Makefile</a>
|
||||
- entry Makefile</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.alt.c">mullender.alt.c</a>
|
||||
- alternative source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.orig.c">mullender.orig.c</a>
|
||||
- original source</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/a.out.h">a.out.h</a>
|
||||
- header file for gentab.c for compatibility with 1984 systems</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/gentab.c">gentab.c</a>
|
||||
- author tool to create constants</li>
|
||||
<li><a href="1984_mullender.tar.bz2">1984_mullender.tar.bz2</a> -
|
||||
download entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.c">mullender.c</a> - entry source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/Makefile">Makefile</a> - entry Makefile</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.alt.c">mullender.alt.c</a> - alternative source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.orig.c">mullender.orig.c</a> - original source</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/a.out.h">a.out.h</a> - header file for gentab.c for compatibility with 1984 systems</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/gentab.c">gentab.c</a> - author tool to create constants</li>
|
||||
<li><a href="1984_mullender.tar.bz2">1984_mullender.tar.bz2</a> - download entry source</li>
|
||||
</ul>
|
||||
<h2 id="secondary-files">Secondary files</h2>
|
||||
<ul>
|
||||
<li><a href="index.html">index.html</a> - entry home page</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/.entry.json">.entry.json</a>
|
||||
- description of entry in JSON</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/.gitignore">.gitignore</a>
|
||||
- list of files that should not be committed under git</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/.entry.json">.entry.json</a> - description of entry in JSON</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/.gitignore">.gitignore</a> - list of files that should not be committed under git</li>
|
||||
<li><a href=".path">.path</a> - directory path from top directory</li>
|
||||
<li><a
|
||||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/README.md">README.md</a>
|
||||
- markdown source for index.html</li>
|
||||
<li><a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/README.md">README.md</a> - markdown source for index.html</li>
|
||||
</ul>
|
||||
|
||||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||||
|
||||
Reference in new issue
Block a user