Prepare for the winners of **IOCCC28**. > However these are not the 2024 droids you are looking for. :-) The HTML menu (both JavaScript and non-JavaScript) has been updated. The `Status -> Rules and guidelines' have been replaced with two separate menus `Status -> IOCCC rules` and `Status -> IOCCC guidelines`. Added a new top level `social.html` page: built from a new `social.md`. Sorted rules for building specific web pages in the top level `Makefile`. Added `make social` to make the `social.html` page from `social.md`. The `bin/gen-top-html.sh` now is able to process a argument of **social** to process the new top level `social.html` page. Changed `bin/gen-top-html.sh` VERSION from "2.0.0 2025-03-13" to "2.0.1 2025-07-25". Below `About -> Home page` a new `About -> IOCCC social media` menu item as added. Because the menu change touched every HTML file, we changed the general copyright date range for HTML files from "1984-2024" to "1984-2025" due to the extensive changes made for **IOCCC28**. Those markdown files that were modified in 2025 had their copyright date range also changed from "1984-2024" to "1984-2025". Rebuilt tarballs and sitemap due to the extensive HTML rebuilding. Ran `make update` to perform the above.
950 lines
40 KiB
HTML
950 lines
40 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 -->
|
||
|
||
<!-- END: this line ends content from: inc/top.default.html -->
|
||
<!-- START: this line starts content from: inc/head.default.html -->
|
||
|
||
<head>
|
||
<link rel="stylesheet" href="../../ioccc.css">
|
||
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap" rel="stylesheet">
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||
<title>1984/mullender - Grand Prize</title>
|
||
<link rel="icon" type="image/x-icon" href="../../favicon.ico">
|
||
<meta name="description" content="1984 IOCCC entry mullender - Grand Prize">
|
||
<meta name="keywords" content="IOCCC, 1984, IOCCC 1984, IOCCC entry, mullender, Grand Prize">
|
||
</head>
|
||
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- !!! 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/head.default.html -->
|
||
|
||
<!-- -->
|
||
<!-- This web page was formed via the tool: bin/readme2index.sh -->
|
||
<!-- The content of main section of this web page came from: 1984/mullender/README.md -->
|
||
<!-- -->
|
||
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 1984/mullender/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 1984/mullender/README.md !!! -->
|
||
<!-- !!! Do not modify this web page, instead modify the file: 1984/mullender/README.md !!! -->
|
||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||
|
||
<!-- Markdown content was converted into HTML via the tool: bin/md2html.sh -->
|
||
|
||
<!-- 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/topbar.default.html -->
|
||
|
||
<div class="theader">
|
||
<nav class="topbar">
|
||
<div class="container">
|
||
<div class="logo">
|
||
<a href="../../index.html" class="logo-link">
|
||
IOCCC
|
||
</a>
|
||
</div>
|
||
|
||
<div class="topbar-items">
|
||
<div class="item">
|
||
<span class="item-header">
|
||
Entries
|
||
</span>
|
||
|
||
<div class="sub-item">
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../years.html" class="sub-item-link">
|
||
Winning entries
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../authors.html" class="sub-item-link">
|
||
Winning authors
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../location.html" class="sub-item-link">
|
||
Location of authors
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../bugs.html" class="sub-item-link">
|
||
Bugs and (mis)features
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#fix_an_entry" class="sub-item-link">
|
||
Fixing entries
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#fix_author" class="sub-item-link">
|
||
Updating author info
|
||
</a>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="item">
|
||
<span class="item-header">
|
||
Status
|
||
</span>
|
||
|
||
<div class="sub-item">
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../news.html" class="sub-item-link">
|
||
News
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../status.html" class="sub-item-link">
|
||
Contest status
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../next/rules.html" class="sub-item-link">
|
||
IOCCC rules
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../next/guidelines.html" class="sub-item-link">
|
||
IOCCC guidelines
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../markdown.html" class="sub-item-link">
|
||
Markdown guidelines
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../SECURITY.html" class="sub-item-link">
|
||
Security policy
|
||
</a>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="item">
|
||
<span class="item-header">
|
||
FAQ
|
||
</span>
|
||
|
||
<div class="sub-item">
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html" class="sub-item-link">
|
||
Frequently asked questions
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../quick-start.html#enter" class="sub-item-link">
|
||
Enter the IOCCC
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#compiling" class="sub-item-link">
|
||
Compiling entries
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#running_entries" class="sub-item-link">
|
||
Running entries
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../faq.html#help" class="sub-item-link">
|
||
How to help
|
||
</a>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="item">
|
||
<span class="item-header">
|
||
About
|
||
</span>
|
||
|
||
<div class="sub-item">
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../index.html" class="sub-item-link">
|
||
Home page
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../social.html" class="sub-item-link">
|
||
IOCCC social media
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../about.html" class="sub-item-link">
|
||
About the IOCCC
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../judges.html" class="sub-item-link">
|
||
The judges
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../thanks-for-help.html" class="sub-item-link">
|
||
Thanks for the help
|
||
</a>
|
||
</div>
|
||
|
||
<div class="outfit-font">
|
||
<a href="../../contact.html" class="sub-item-link">
|
||
Contact us
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
|
||
<div class="header-mobile-menu">
|
||
<noscript>
|
||
<a href="../../nojs-menu.html" class="topbar-js-label">
|
||
Please Enable JavaScript
|
||
</a>
|
||
</noscript>
|
||
|
||
<button id="header-open-menu-button" class="topbar-mobile-menu">
|
||
<img
|
||
src="../../png/hamburger-icon-open.png"
|
||
alt="hamburger style menu icon - open state"
|
||
width=48
|
||
height=48>
|
||
</button>
|
||
|
||
<button id="header-close-menu-button" class="hide-content">
|
||
<img
|
||
src="../../png/hamburger-icon-closed.png"
|
||
alt="hamburger style menu icon - closed state"
|
||
width=48
|
||
height=48>
|
||
</button>
|
||
|
||
<div id="mobile-menu-panel" class="hide-content">
|
||
<div class="mobile-menu-container">
|
||
|
||
<div class="mobile-menu-wrapper">
|
||
<div class="mobile-menu-item">
|
||
Entries
|
||
</div>
|
||
<div class="mobile-submenu-wrapper">
|
||
|
||
<a class="mobile-submenu-item" href="../../years.html">
|
||
Winning entries
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../authors.html">
|
||
Winning authors
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../location.html">
|
||
Location of authors
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../bugs.html">
|
||
Bugs and (mis)features
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#fix_an_entry">
|
||
Fixing entries
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#fix_author">
|
||
Updating author info
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../thanks-for-help.html">
|
||
Thanks for the help
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mobile-menu-wrapper">
|
||
|
||
<div class="mobile-menu-item">
|
||
Status
|
||
</div>
|
||
<div class="mobile-submenu-wrapper">
|
||
|
||
<a class="mobile-submenu-item" href="../../news.html">
|
||
News
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../status.html">
|
||
Contest status
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../next/rules.html">
|
||
IOCCC rules
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../next/guidelines.html">
|
||
IOCCC guidelines
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../markdown.html">
|
||
Markdown guidelines
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../SECURITY.html">
|
||
Security policy
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mobile-menu-wrapper">
|
||
<div class="mobile-menu-item">
|
||
FAQ
|
||
</div>
|
||
<div class="mobile-submenu-wrapper">
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html">
|
||
Frequently asked questions
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../quick-start.html#enter">
|
||
Enter the IOCCC
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#compiling">
|
||
Compiling entries
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#running_entries">
|
||
Running entries
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../faq.html#help">
|
||
How to help
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mobile-menu-wrapper">
|
||
<div class="mobile-menu-item">
|
||
About
|
||
</div>
|
||
<div class="mobile-submenu-wrapper">
|
||
|
||
<a class="mobile-submenu-item" href="../../index.html">
|
||
Home page
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../social.html">
|
||
IOCCC social media
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../about.html">
|
||
About the IOCCC
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../judges.html">
|
||
The judges
|
||
</a>
|
||
|
||
<a class="mobile-submenu-item" href="../../contact.html">
|
||
Contact us
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<script>
|
||
var headerOpenMenuButton = document.getElementById("header-open-menu-button");
|
||
var headerCloseMenuButton = document.getElementById("header-close-menu-button");
|
||
var mobileMenuPanel = document.getElementById("mobile-menu-panel");
|
||
|
||
headerOpenMenuButton.addEventListener("click", () => {
|
||
headerOpenMenuButton.classList.remove("topbar-mobile-menu");
|
||
headerOpenMenuButton.classList.add("hide-content");
|
||
|
||
headerCloseMenuButton.classList.remove("hide-content");
|
||
headerCloseMenuButton.classList.add("topbar-mobile-menu");
|
||
|
||
mobileMenuPanel.classList.remove("hide-content");
|
||
mobileMenuPanel.classList.add("topbar-mobile-panel");
|
||
});
|
||
|
||
headerCloseMenuButton.addEventListener("click", () => {
|
||
headerCloseMenuButton.classList.remove("topbar-mobile-menu");
|
||
headerCloseMenuButton.classList.add("hide-content");
|
||
|
||
mobileMenuPanel.classList.add("hide-content");
|
||
mobileMenuPanel.classList.remove("topbar-mobile-panel");
|
||
|
||
headerOpenMenuButton.classList.add("topbar-mobile-menu");
|
||
headerOpenMenuButton.classList.remove("hide-content");
|
||
});
|
||
</script>
|
||
|
||
<!-- END: this line ends content from: inc/topbar.default.html -->
|
||
<!-- START: this line starts content from: inc/header.default.html -->
|
||
|
||
<div class="header">
|
||
<a href="../../2011/zucker/index.html">
|
||
<img src="../../png/ioccc.png"
|
||
alt="IOCCC image by Matt Zucker"
|
||
width=300
|
||
height=110>
|
||
</a>
|
||
<h1>The International Obfuscated C Code Contest</h1>
|
||
<h2>1984/mullender - Grand Prize</h2>
|
||
<h3>hardcoded vax and pdp-11 code to move :-) across the screen</h3>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/header.default.html -->
|
||
<!-- START: this line starts content from: inc/navbar.mid.html -->
|
||
|
||
<div class="navbar">
|
||
<a class="Left" href="../laman/index.html">← 1984/laman</a>
|
||
<a class="Left" href="../index.html">↑ 1984 ↑</a>
|
||
<a class="Left" href="../../1985/applin/index.html">1985/applin →</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/mullender.c">C code</a>
|
||
<a class="Right" href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/Makefile">Makefile</a>
|
||
<a class="Right" href="#inventory">Inventory</a>
|
||
<a class="Right" href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F1984%2Fmullender%2Findex.html">✓</a>
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/navbar.mid.html -->
|
||
<!-- START: this line starts content from: inc/before-content.default.html -->
|
||
|
||
<div class="content" id="content">
|
||
|
||
<!-- END: this line ends content from: inc/before-content.default.html -->
|
||
<!-- START: this line starts content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
|
||
|
||
<!-- START: this line starts content generated by: bin/output-index-author.sh -->
|
||
|
||
<div id="author">
|
||
<h2 id="authors">Authors:</h2>
|
||
</div>
|
||
<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>)</li>
|
||
</ul>
|
||
|
||
<!-- END: next line ends content generated by: bin/output-index-author.sh -->
|
||
|
||
<!-- END: this line ends content for HTML phase 20 by: bin/output-index-author.sh via bin/md2html.sh -->
|
||
<!-- START: this line starts content for HTML phase 21 by: bin/pandoc-wrapper.sh via bin/md2html.sh -->
|
||
|
||
<!-- BEFORE: 1st line of markdown file: 1984/mullender/README.md -->
|
||
<h2 id="to-build">To build:</h2>
|
||
<pre><code> make alt</code></pre>
|
||
<p><strong>NOTE</strong>: 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>
|
||
<blockquote>
|
||
<p><strong>STATUS: INABIAF - please DO NOT fix</strong></p>
|
||
</blockquote>
|
||
<p>For more detailed information see <a href="../../bugs.html#1984_mullender">1984/mullender in bugs.html</a>.</p>
|
||
<h2 id="to-use">To use:</h2>
|
||
<pre><code> ./mullender.alt [microseconds]</code></pre>
|
||
<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 alternate 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><strong>BTW</strong>: 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>
|
||
<pre><code> ./mullender.alt
|
||
|
||
./mullender.alt 5000 # wait for 5000 microseconds and see what happens
|
||
|
||
./mullender.alt 20000 # wait for 20000 microseconds and see what happens
|
||
|
||
./mullender.alt 100000 # wait for 100000 microseconds and see what happens</code></pre>
|
||
<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>
|
||
<h3 id="original-build">Original build:</h3>
|
||
<pre><code> make all</code></pre>
|
||
<h3 id="original-use">Original use:</h3>
|
||
<pre><code> ./mullender</code></pre>
|
||
<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>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>What happens if you hit enter after it writes a line of output?</p>
|
||
<p><strong>BTW</strong>: 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="https://github.com/ioccc-src/winner/blob/master/1984/mullender/a.out.h">a.out.h</a>, which <a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/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>
|
||
<pre><code> make gentab</code></pre>
|
||
<h3 id="gentab-use">gentab use:</h3>
|
||
<pre><code> ./gentab file</code></pre>
|
||
<h3 id="gentab-try">gentab try:</h3>
|
||
<pre><code> ./gentab gentab > g.c</code></pre>
|
||
<p><strong>NOTE</strong>: 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 we made a
|
||
typo though we 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>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>
|
||
<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/Call_stack">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>
|
||
<pre><code> for (;;) {
|
||
write(1, " :-)\b\b\b\b", 9);
|
||
delay();
|
||
}</code></pre>
|
||
<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>
|
||
<pre><code> pdp:
|
||
mov pc,r4
|
||
tst -(r4)
|
||
sub $9, r4
|
||
mov r4,0f
|
||
mov $1, r0
|
||
sys 4; 0:0; 9
|
||
mov $1000, r2
|
||
1:
|
||
sys 55
|
||
sob r2,1b
|
||
br pdp</code></pre>
|
||
<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 <code>0</code>. 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 <code>0</code>), 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>
|
||
<pre><code> vax: .word 0400 + (pdp - vax) / 2 - 1
|
||
1:
|
||
pushl $9
|
||
pushal str
|
||
pushl $1
|
||
calls $3, write
|
||
cvtwl $32767, r2
|
||
|
||
2:
|
||
decl r2
|
||
jneq 2b
|
||
jbr 1b
|
||
|
||
write: .word 0
|
||
chmk $4
|
||
ret
|
||
|
||
str: .ascii " :-)\b\b\b\b"
|
||
|
||
pdp: .word 4548, 3044, 58820, 9, 4407, 6, 5568, 1, 35076, 0, 9, 5570, 512, 35117, 32386, 496</code></pre>
|
||
<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 <code>2</code>. 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
|
||
<code>pdp</code> 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>NOTE from judges: see <a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/gentab.c">gentab.c</a> for a copy of this file that can be
|
||
compiled in modern systems.</p>
|
||
<pre><code> #include <stdio.h>
|
||
#include <a.out.h>
|
||
|
||
main(argc, argv) char **argv;
|
||
{
|
||
register FILE *fp;
|
||
register short pos = 0, c, n;
|
||
register char *fmt;
|
||
if (argc != 2) {
|
||
fprintf (stderr, "Usage: %s file\n", argv[0]);
|
||
exit (1);
|
||
}
|
||
|
||
if ((fp = fopen(argv[1], "r")) == NULL) {
|
||
fprintf(stderr, "%s: can't open %s\n", argv[0], argv[1]);
|
||
exit(2);
|
||
}
|
||
|
||
fseek (fp, (long) sizeof (struct exec), 0);
|
||
printf("/* portable between VAX and PDP11 */\n\n");
|
||
printf ("short main[] = {\n");
|
||
for (;;) {
|
||
if (pos == 0)
|
||
printf("\t");
|
||
|
||
c=getc(fp) & 0377;
|
||
if (feof(fp)) break;
|
||
n = getc(fp) << 8|c;
|
||
|
||
switch (rand() % 5) {
|
||
case 0:
|
||
case 1:
|
||
fmt = "%d"; break;
|
||
case 2:
|
||
fmt = "%u"; break;
|
||
case 3:
|
||
fmt = "0%o"; break;
|
||
case 4:
|
||
fmt = "0x%x"; break;
|
||
}
|
||
|
||
if (32 <= n && n < 127 && (rand() % 4)) fmt = "'%c'";
|
||
printf(n < 8 ? "%d" : fmt, n);
|
||
printf(",");
|
||
if (pos++ == 8) {
|
||
printf("\n");
|
||
pos = 0;
|
||
}
|
||
else printf(" ");
|
||
|
||
printf("};\n");
|
||
}
|
||
}</code></pre>
|
||
<p>As can be seen, there is a slight preference for
|
||
<a href="https://en.wikipedia.org/wiki/Decimal">decimal</a>, 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 <a href="https://en.wikipedia.org/wiki/Decimal">decimal</a>. 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>
|
||
<!--
|
||
|
||
Copyright © 1984-2024 by Landon Curt Noll. All Rights Reserved.
|
||
|
||
You are free to share and adapt this file under the terms of this license:
|
||
|
||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||
|
||
For more information, see:
|
||
|
||
https://creativecommons.org/licenses/by-sa/4.0/
|
||
|
||
-->
|
||
<!-- AFTER: last line of markdown file: 1984/mullender/README.md -->
|
||
|
||
<!-- 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 -->
|
||
|
||
<div id="inventory">
|
||
<h1 id="inventory-for-1984mullender">Inventory for 1984/mullender</h1>
|
||
</div>
|
||
<h2 id="primary-files">Primary files</h2>
|
||
<ul>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/mullender.c">mullender.c</a> - entry source code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/Makefile">Makefile</a> - entry Makefile</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/mullender.alt.c">mullender.alt.c</a> - alternate source code that works with modern systems</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/mullender.orig.c">mullender.orig.c</a> - original source code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/gentab.c">gentab.c</a> - authors’ tool to generate code</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/a.out.h">a.out.h</a> - gentab.c header file for compatibility with systems in 1984</li>
|
||
</ul>
|
||
<h2 id="secondary-files">Secondary files</h2>
|
||
<ul>
|
||
<li><a href="1984_mullender.tar.bz2">1984_mullender.tar.bz2</a> - download entry tarball</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/README.md">README.md</a> - markdown source for this web page</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/blob/master/1984/mullender/.entry.json">.entry.json</a> - entry summary and manifest in JSON</li>
|
||
<li><a href="https://github.com/ioccc-src/winner/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/winner/blob/master/1984/mullender/.path">.path</a> - directory path from top level directory</li>
|
||
<li><a href="index.html">index.html</a> - this web page</li>
|
||
</ul>
|
||
<hr style="width:10%;text-align:left;margin-left:0">
|
||
<h4>
|
||
Jump to: <a href="#">top</a>
|
||
</h4>
|
||
|
||
<!-- END: next line ends content generated by: bin/output-index-inventory.sh -->
|
||
|
||
<!-- END: this line ends content for HTML phase 22 by: bin/output-index-inventory.sh via bin/md2html.sh -->
|
||
<!-- START: this line starts content from: inc/after-content.default.html -->
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/after-content.default.html -->
|
||
<!-- START: this line starts content from: inc/footer.inventory.html -->
|
||
|
||
<!--
|
||
|
||
Copyright © 1984-2025 by Landon Curt Noll. All Rights Reserved.
|
||
|
||
You are free to share and adapt this file under the terms of this license:
|
||
|
||
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
|
||
|
||
For more information, see:
|
||
|
||
https://creativecommons.org/licenses/by-sa/4.0/
|
||
|
||
-->
|
||
|
||
<div class="footer">
|
||
|
||
<div id="copyright"><h3>Copyright © 1984-2025 by Landon Curt Noll:
|
||
<a href="https://creativecommons.org/faq/#what-does-some-rights-reserved-mean"
|
||
target="_blank"
|
||
rel="license noopener noreferrer">Some Rights Reserved</a></h3>
|
||
<p>
|
||
This work is <b>licensed by Landon Curt Noll</b> under
|
||
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1"
|
||
target="_blank"
|
||
rel="license noopener noreferrer"
|
||
style="display:inline-block;">CC BY-SA 4.0</a></b>.
|
||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||
src="../../png/cc.png"
|
||
alt="cc inside circle symbol">
|
||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||
src="../../png/by.png"
|
||
alt="person inside circle symbol">
|
||
<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;"
|
||
src="../../png/sa.png"
|
||
alt="arrow looping back on itself inside circle symbol"><br>
|
||
You should <b>carefully review</b> the
|
||
<b><a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode.en"
|
||
target="_blank"
|
||
rel="license noopener noreferrer">CC BY-SA 4.0 LEGAL CODE</a></b>
|
||
before using the licensed material.<br>
|
||
You may wish to review the
|
||
<b><a href="../../license.html"
|
||
target="_blank"
|
||
rel="license noopener noreferrer">highlights of some of the key features and terms</a></b>
|
||
of <b>CC BY-SA 4.0</b>.<br>
|
||
</p>
|
||
</div>
|
||
|
||
<div id="coda"><h3>Coda</h3>
|
||
<p>
|
||
<a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.ioccc.org%2F1984%2Fmullender%2Findex.html" rel="nofollow">Nu HTML check this web page</a><br>
|
||
<a href="#top">Jump to top</a> <a href="#content">Jump to Content</a> <a href="#inventory">Jump to Inventory</a><br>
|
||
</p>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- END: this line ends content from: inc/footer.inventory.html -->
|
||
<!-- START: this line starts content from: inc/bottom.default.html -->
|
||
|
||
</body>
|
||
</html>
|
||
|
||
<!-- END: this line ends content from: inc/bottom.default.html -->
|