4043 byte PC emulator (2013)
ioccc.org
ioccc.org
Edit: 8086tiny.freeforums.net is functional and has had a few recent posts.
I would love to see a version of it written to be as readable as possible. (If there is such a thing already out there, pointers are welcome, thanks!)
That is some nice code, many thanks for the link.
http://ioccc.org/2013/cable3/cable3.c
There are some nice easter eggs in the source
If you are interested in an actual minification process of a winning IOCCC entry, Don Yang [1], who has eight (!) winning entries, has put a compressed screencast alongside with recent winning entries (example: [2] is a screencast for [3]). My experience (I too have one winning entry) had been similar.
[1] http://uguu.org/
Many years ago I wrote some obfuscated Perl, assisted by the fact that the language is pretty obfuscated to start with. https://flatline.org.uk/snowflake.pl.txt - I think I may have had a tool to help it fit the template, but since you can't have a space in the middle of an operator restructuring the program to make the operators fit the snowflake was a major part of the effort.
While there's an "unobfuscated" version of the emulator program in this thread, it's clearly not the same program - there's no "switch/case" in the obfuscated version.
switch(a) { case x: do1(); break; case y: do2(); break; default do3(); break; }
becomes
a == x ? do1() : a == y ? do2() : do3();
These structures can be seen in the minimized version (and a few other IOCCC winners :-).This code likely doesn't optimize quite as well. Several cute things you can do with switch statements cannot be translated so easily.
The instruction decode mechanism is a chain of "e--||(expression), e--|| ..." expressions. At the point where e-- is zero the expression will be evaluated.
The program makes heavy use of the equivalence between "index[pointer]" and "pointer[index]", presumably to save brackets.
I n t,e,l[80186],*E,m,u,L,a,T,o,r Int L[A],m,b,*D=A,
*c,*a=L,C,*U=L,u;s
requiring compile time defs -DInt=int/long -DA=500000.But it did include its own Basic I/O System in the source:
char*B,I,O;S(){b=b
...
"-,&,,/.--/,:-,'/"
".-,-,,/.-,*,//..,"If you liked this, I also suggest take a look at Christopher Mills entry from 2018, which is a PDP-7 emulator, which doesn't use the BIOS tables trick.
http://www.ioccc.org/2018/mills/hint.html
[disclaimer: I am an IOCCC Judge]