Improved `all-run.sh` and `readme2index.sh` so that certain command line options (e.g., -p, -P, -u, -U ...) are only passed along to other tools if they are given on the command line. all-run.sh VERSION changed from "1.1.1 2024-01-19" to "1.1.2 2024-01-20", readme2index.sh VERSION changed from "1.1 2024-01-16" to "1.1.1 2024-01-20". Added `quick-readme2index.sh` that only calls `readme2index.sh` if the `index.html` is not a non-empty file, or of either `.winner.json` and/or `README.md` is newer than `index.html`. Updated all `index.html` files because the the file contains a comment that includes the newly modified readme2index.sh VERSION.
344 lines
18 KiB
HTML
344 lines
18 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||
<!-- START: two lines up starts content from: inc/top.default.html -->
|
||
<!-- -->
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||
<!-- !!! DO NOT MODIFY THIS FILE - This file is generated by a tool !!! -->
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- -->
|
||
<!-- END: this line ends content from: inc/top.default.html -->
|
||
<!-- -->
|
||
<!-- This file was formed by the tool: bin/readme2index.sh version: 1.1.1 2024-01-20 -->
|
||
<!-- -->
|
||
<!-- START: this line starts content from: inc/head.default.html -->
|
||
|
||
<head>
|
||
<link rel="stylesheet" href="/temp-test-ioccc/ioccc.css">
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||
<title>2004/gavin</title>
|
||
<meta name="description" content="2004 IOCCC winner gavin">
|
||
<meta name="keywords" content="IOCCC, 2004, IOCCC 2004, IOCCC winner, gavin">
|
||
</head>
|
||
|
||
<!-- END: this line ends content from: inc/head.default.html -->
|
||
<!-- START: this line starts content from: inc/body.default.html -->
|
||
|
||
<body>
|
||
|
||
<!-- END: this line ends content from: inc/body.default.html -->
|
||
<!-- START: this line starts content from: inc/header.default.html -->
|
||
|
||
<div class="header">
|
||
<img src="/temp-test-ioccc/png/ioccc.png" alt="IOCCC image by Matt Zucker" width=300 height=110>
|
||
<h1>The International Obfuscated C Code Contest</h1>
|
||
<h2>2004/gavin</h2>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/header.default.html -->
|
||
<!-- START: this line starts content from: inc/topnav.mid.html -->
|
||
|
||
<div class="topnav">
|
||
<a class="Left" href="../gavare/index.html">← gavare</a>
|
||
<a class="Left" href="../index.html">↑ 2004 ↑</a>
|
||
<a class="Left" href="../hibachi/index.html">hibachi →</a>
|
||
<a class="Right" href="#inventory">Inventory</a>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/topnav.mid.html -->
|
||
<!-- START: this line starts content from: inc/begin-row.default.html -->
|
||
|
||
<div class="row">
|
||
|
||
<!-- END: this line ends content from: inc/begin-row.default.html -->
|
||
<!-- START: this line starts content from: inc/begin-leftcolumn.default.html -->
|
||
|
||
<div class="leftcolumn">
|
||
|
||
<!-- END: this line ends content from: inc/begin-leftcolumn.default.html -->
|
||
<!-- START: this line starts content from: inc/sidenav.default.html -->
|
||
|
||
<div class="sidenav">
|
||
<a href="#content">Jump to contents</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="/temp-test-ioccc/index.html">IOCCC Home</a>
|
||
<a href="/temp-test-ioccc/years.html">Winning Entries</a>
|
||
<a href="/temp-test-ioccc/winners.html">People who have won</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="/temp-test-ioccc/news.html">IOCCC News</a>
|
||
<a href="/temp-test-ioccc/faq.html#submit">How to enter the IOCCC</a>
|
||
<a href="/temp-test-ioccc/faq.html">FAQ</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="/temp-test-ioccc/bugs.html">Bugs & (mis)features</a>
|
||
<a href="/temp-test-ioccc/faq.html#fix_a_winner">Fixing IOCCC winners</a>
|
||
<a href="/temp-test-ioccc/faq.html#fix_web_site">Fixing the web site</a>
|
||
<a href="/temp-test-ioccc/faq.html#fix_author">Fixing winner info</a>
|
||
<a href="/temp-test-ioccc/thanks-for-help.html">Thanks for the help</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="/temp-test-ioccc/judges.html">The IOCCC Judges</a>
|
||
<a href="/temp-test-ioccc/contact.html">Contacting the IOCCC</a>
|
||
</div>
|
||
<hr>
|
||
<div class="sidenav">
|
||
<a href="#top">Jump to top</a>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/sidenav.default.html -->
|
||
<!-- START: this line starts content from: inc/end-leftcolumn.default.html -->
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/end-leftcolumn.default.html -->
|
||
<!-- START: this line starts content from: inc/begin-rightcolumn.default.html -->
|
||
|
||
<div class="rightcolumn">
|
||
|
||
<!-- END: this line ends content from: inc/begin-rightcolumn.default.html -->
|
||
<!-- START: this line starts content from: inc/before-content.default.html -->
|
||
|
||
<a name="content"></a>
|
||
|
||
<!-- END: this line ends content from: inc/before-content.default.html -->
|
||
<!-- START: this line starts content generated by: bin/gen-author.sh -->
|
||
|
||
<p><a name="author"><strong>Author:</strong></a> <br><br>Name: <a
|
||
href="/temp-test-ioccc/winners.html#Gavin_Barraclough">Gavin
|
||
Barraclough</a><br> Location: <a
|
||
href="/temp-test-ioccc/location.html#null">unknown</a></p>
|
||
|
||
<!-- END: next line ends content generated by: bin/gen-author.sh -->
|
||
<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></span></code></pre></div>
|
||
<p>There is an alternate version for those who wish to use QEMU rather
|
||
than having to reboot and rely on having a floppy drive (if you even
|
||
remember what those are :-) ) etc. See <a
|
||
href="#alternate-code">alternate code</a> below.</p>
|
||
<h3 id="bugs-and-misfeatures">Bugs and (Mis)features:</h3>
|
||
<p>The current status of this entry is:</p>
|
||
<pre><code>STATUS: compiled executable crashes - please help us fix
|
||
STATUS: doesn't work with some platforms - please help us fix
|
||
STATUS: INABIAF - please **DO NOT** fix</code></pre>
|
||
<p>For more detailed information see <a href="/bugs.md#2004-gavin">2004
|
||
gavin in bugs.md</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">./gavin</span></span></code></pre></div>
|
||
<h2 id="try">Try:</h2>
|
||
<p>To enjoy the results (on a Linux/x86 machine) with a floppy drive
|
||
(remember those? We do!):</p>
|
||
<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">su</span></span></code></pre></div>
|
||
<p>Make a floppy with an ext2 filesystem (<code>mke2fs /dev/fd0</code>
|
||
replacing <code>fd0</code> with whatever the floppy device is!), mount
|
||
it under <code>/mnt/floppy</code> and then:</p>
|
||
<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">cp</span> kernel fs.tar lilo.conf boot.b /mnt/floppy</span></code></pre></div>
|
||
<p>NOTE: If the version of your lilo is not 21.4, use the appropriate
|
||
boot.b file.</p>
|
||
<p>NOTE: If your floppy drive is not <code>/dev/fd0</code>, edit
|
||
lilo.conf appropriately.</p>
|
||
<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">lilo</span> <span class="at">-C</span> /mnt/floppy/lilo.conf</span></code></pre></div>
|
||
<p>Boot from the floppy on an x86 machine with a PS/2 keyboard and
|
||
mouse. Move the window away from the corner.</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">vi</span> gavin.c</span></code></pre></div>
|
||
<p>Scroll up and down the file with up-arrow and down-arrow.</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="fu">sh</span></span></code></pre></div>
|
||
<p>You can have several shell windows:</p>
|
||
<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="fu">vi</span> README.md</span>
|
||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="ex">./prim</span></span></code></pre></div>
|
||
<p>Press and hold any key.</p>
|
||
<h2 id="alternate-code">Alternate code:</h2>
|
||
<p>This version’s main difference is that the macro <code>K</code> is
|
||
redefined to <code>1</code> so that you can use it with
|
||
<code>QEMU</code>.</p>
|
||
<h3 id="alternate-build">Alternate build:</h3>
|
||
<div class="sourceCode" id="cb10"><pre
|
||
class="sourceCode sh"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span> alt</span></code></pre></div>
|
||
<h3 id="alternate-use">Alternate use:</h3>
|
||
<p>The use is mostly the same as <code>gavin</code> except that one
|
||
initially executes <code>gavin.alt</code> (which <code>make alt</code>
|
||
will do) and one will have to use <code>QEMU</code> instead. The files
|
||
generated are the same names. See <a href="#to-use">to use</a> and <a
|
||
href="#try">try</a> above as well as the judges’ remarks below plus <a
|
||
href="gavin.md">gavin.md</a>.</p>
|
||
<h2 id="judges-remarks">Judges’ remarks:</h2>
|
||
<p>Over the years, we’ve seen a program that immediately dumps core if
|
||
executed on the “wrong” architectures (<a
|
||
href="1984/mullender/README.md">1984/mullender</a>) and a program that
|
||
dumps core after a while (<a
|
||
href="/2001/bellard/bellard.c">2001/bellard</a>). This entry will
|
||
happily compile and execute on most any architecture - the trick is that
|
||
the result, to be useful, must be produced (and can only be enjoyed) on
|
||
a particular architecture. We have not decided yet whether to disallow
|
||
this for future contests.</p>
|
||
<p>If you do not want to mess with a floppy and you use GRUB, see <a
|
||
href="gavin.md">gavin.md</a>.</p>
|
||
<p>You can put additional text files in <code>fs.tar</code> for browsing
|
||
with vi.</p>
|
||
<p>If you do not want to bother rebooting your computer at all, see <a
|
||
href="http://bellard.org" class="uri">http://bellard.org</a> for QEMU
|
||
(<a href="/winners.html#Fabrice_Bellard">Fabrice Bellard</a> is an IOCCC
|
||
2001 winner), but your experience will be limited; use the <a
|
||
href="#alternate-code">alternate code</a> instead. You’ll have to move
|
||
the mouse to trigger the initial screen update.</p>
|
||
<p>The judges were able to write a few more programs to run in this OS.
|
||
What are the limitations for such programs?</p>
|
||
<p>What can you do and what can you not do in such programs?</p>
|
||
<p>The program called <code>prim</code>, written by the judges, computes
|
||
and prints prime numbers.</p>
|
||
<h2 id="authors-remarks">Author’s remarks:</h2>
|
||
<p>This is a 32-bit multitasking operating system for x86 computers,
|
||
with GUI and filesystem, support for loading and executing user
|
||
applications in ELF binary format, with PS/2 mouse and keyboard drivers,
|
||
and VESA graphics. And a command shell. And an application - a simple
|
||
text-file viewer.</p>
|
||
<p>The OS has ended up as a traditional monolith with one entry point
|
||
for syscalls, with apps treated as cooperative-multitasking tasks that
|
||
can be sent different messages (e.g. ‘initialize’, ‘key hit’, ‘render to
|
||
buffer’) through their main entry point, and which will return control
|
||
to the OS after having performed the necessary work. Applications are
|
||
passed a pointer to their task structure, which is partially defined by
|
||
the OS, and partially for the application’s own use.</p>
|
||
<p>The program compiles into a tool to build a kernel image, so having
|
||
built the program, the <a href="Makefile">Makefile</a> will run it,
|
||
redirecting the output into a file called <code>kernel</code>. The
|
||
Makefile will then proceed to build a root filesystem image. This
|
||
involves rebuilding the program with different compiler flags, then
|
||
building a tarball containing the resulting programs (the filesystem
|
||
format supported by the OS is the tarball format).</p>
|
||
<p>For further usage information see <a
|
||
href="gavin.md">gavin.md</a>.</p>
|
||
<p>The filenames <code>vi</code> and <code>sh</code> are significant,
|
||
and should not be changed.</p>
|
||
<h3 id="known-features">Known ‘features’</h3>
|
||
<p>Known issues are really too plentiful to list.</p>
|
||
<p>If the mouse pointer goes off the left hand side of the screen it
|
||
will reappear on the right, and vice-versa. If it goes off the top or
|
||
bottom, it will go and corrupt some memory.</p>
|
||
<p>The file system is kinda optimistic about matching names, so, for
|
||
example if you type the command <code>shell</code> into a command-line
|
||
it will execute the program <code>sh</code> - close enough a match for
|
||
it.</p>
|
||
<p>The <a
|
||
href="https://en.wikipedia.org/wiki/Executable_and_Linkable_Format">ELF
|
||
binaries</a> are not loaded at the correct address, and their entry
|
||
point must be the start address of the <a
|
||
href="https://en.wikipedia.org/wiki/Code_segment">text segment</a>.</p>
|
||
<p>The keyboard driver can cope with the basic alpha-numeric keys, but
|
||
gets confused by fancy things like <code>shift</code> or
|
||
<code>backspace</code>.</p>
|
||
<p>In the text-file viewer, <code>vi</code>, the up/down and PgUp/PgDn
|
||
keys scroll up or down by one line. There is nothing to stop you from
|
||
scrolling above the top of the file, and pressing any other keys might
|
||
have an undefined effect.</p>
|
||
<p>The x86 is bootstrapped into 32bit mode in 6 instructions, with 4
|
||
more to set up data/stack segments and a stack-pointer to allow C code
|
||
to be run. On top of this there are also about a dozen instructions to
|
||
switch the video card into graphics mode. All in all, a relatively tiny
|
||
number of instructions next to the size of the C program. Also, the
|
||
string is mostly composed of data - a Linux-esque kernel header for the
|
||
bootloader, protected mode descriptor tables, keyboard maps, etc. (I
|
||
should also mention that it contains mini functions to perform an x86
|
||
<code>in</code> and <code>out</code> instruction - to allow the keyboard
|
||
& mouse to be driven from C code).</p>
|
||
<p>Porting to another architecture should be relatively easy* - the
|
||
string simply needs be replaced with one containing data & code
|
||
suitable for the new target platform. Accesses to data in the string are
|
||
made relative to the define <code>V</code>, so these may need updating
|
||
as appropriate (<code>0x90200</code> is the address at which a Linux
|
||
bootloader loads an x86 kernel image).</p>
|
||
<pre><code>\* ;-)</code></pre>
|
||
<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>
|
||
<!-- START: this line starts content generated by: bin/gen-inventory.sh -->
|
||
|
||
<h1 id="inventory-for-2004gavin"><a name="inventory"></a>Inventory for
|
||
2004/gavin</h1>
|
||
<h2 id="primary-files">Primary files</h2>
|
||
<ul>
|
||
<li><a href="index.html">index.html</a> - winner home page</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/gavin/gavin.c">gavin.c</a>
|
||
- winning source</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/gavin/Makefile">Makefile</a>
|
||
- winner Makefile</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/gavin/gavin.alt.c">gavin.alt.c</a>
|
||
- alternative source</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/gavin/gavin.orig.c">gavin.orig.c</a>
|
||
- original source</li>
|
||
<li><a href="gavin.html">gavin.html</a> - author usage guide</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/gavin/lilo.conf">lilo.conf</a>
|
||
- boot loader configuration</li>
|
||
<li><a href="boot.b">boot.b</a> - boot sector</li>
|
||
<li><a href="img/fs.tar">img/fs.tar</a> - tar of root file system</li>
|
||
<li><a href="img/kernel">img/kernel</a> - Linux kernel x86 boot
|
||
executable zImage</li>
|
||
<li><a href="prim">prim</a> - prime number printing program</li>
|
||
<li><a href="2004_gavin.tar.bz2">2004_gavin.tar.bz2</a> - download
|
||
winning source</li>
|
||
</ul>
|
||
<h2 id="secondary-files">Secondary files</h2>
|
||
<ul>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/gavin/.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/2004/gavin/.winner.json">.winner.json</a>
|
||
- description of winner in JSON</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/gavin/README.md">README.md</a>
|
||
- markdown source for index.html</li>
|
||
<li><a
|
||
href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2004/gavin/gavin.md">gavin.md</a>
|
||
- markdown source for gavin.html</li>
|
||
</ul>
|
||
|
||
<!-- END: next line ends content generated by: bin/gen-inventory.sh -->
|
||
<!-- START: this line starts content from: inc/after-content.default.html -->
|
||
|
||
<!-- END: this line ends content from: inc/after-content.default.html -->
|
||
<!-- START: this line starts content from: inc/end-rightcolumn.default.html -->
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/end-rightcolumn.default.html -->
|
||
<!-- START: this line starts content from: inc/end-row.default.html -->
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/end-row.default.html -->
|
||
<!-- START: this line starts content from: inc/footer.default.html -->
|
||
|
||
<div class="footer">
|
||
<hr>
|
||
<h2>Coda</h2>
|
||
<p><a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fioccc-src.github.io%2Ftemp-test-ioccc%2F2004%2Fgavin%2Findex.html">Nu HTML check this web page</a></p>
|
||
<p><a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a></p>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/footer.default.html -->
|
||
<!-- START: this line starts content from: inc/bottom.default.html -->
|
||
|
||
</body>
|
||
</html>
|
||
|
||
<!-- END: this line ends content from: inc/bottom.default.html -->
|