diff --git a/2024/2024.tar.bz2 b/2024/2024.tar.bz2 index be3c1d233..da4e17619 100644 Binary files a/2024/2024.tar.bz2 and b/2024/2024.tar.bz2 differ diff --git a/2024/anders/.entry.json b/2024/anders/.entry.json index f59b1a457..a561946dc 100644 --- a/2024/anders/.entry.json +++ b/2024/anders/.entry.json @@ -1,12 +1,12 @@ { "no_comment" : "mandatory comment: because comments were removed from the original JSON spec", "entry_JSON_format_version" : "1.2 2024-09-25", - "award" : "Prize in sound coding", + "award" : "Prize in imitative rebooting", "year" : 2024, "dir" : "anders", "entry_id" : "2024_anders", - "title" : "aks", - "abstract" : "layered music generator", + "title" : "endian_bender", + "abstract" : "OpenRISC CPU and Linux", "author_set" : [ { "author_handle" : "Anders_Kaare_Straadt" @@ -45,6 +45,30 @@ "display_via_github" : true, "entry_text" : "script to try entry" }, + { + "file_path" : "wasm_include/stdio.h", + "inventory_order" : 200, + "OK_to_edit" : true, + "display_as" : "c", + "display_via_github" : true, + "entry_text" : "wasm include file" + }, + { + "file_path" : "wasm_include/termios.h", + "inventory_order" : 200, + "OK_to_edit" : true, + "display_as" : "c", + "display_via_github" : true, + "entry_text" : "wasm include file" + }, + { + "file_path" : "wasm_include/unistd.h", + "inventory_order" : 200, + "OK_to_edit" : true, + "display_as" : "c", + "display_via_github" : true, + "entry_text" : "wasm include file" + }, { "file_path" : "2024_anders.tar.bz2", "inventory_order" : 1415926535, @@ -85,6 +109,22 @@ "display_via_github" : true, "entry_text" : "markdown source for this web page" }, + { + "file_path" : "a", + "inventory_order" : 4000000000, + "OK_to_edit" : true, + "display_as" : "binary", + "display_via_github" : true, + "entry_text" : "virtual machine" + }, + { + "file_path" : "prog.wasm", + "inventory_order" : 4000000000, + "OK_to_edit" : true, + "display_as" : "binary", + "display_via_github" : true, + "entry_text" : "WebAssembly binary module" + }, { "file_path" : "index.html", "inventory_order" : 4294967295, diff --git a/2024/anders/.gitignore b/2024/anders/.gitignore index f3143b448..cb588a635 100644 --- a/2024/anders/.gitignore +++ b/2024/anders/.gitignore @@ -1 +1,7 @@ -prog.wav +# +# sort with: ../../bin/sgi.sh +*~ +*.dSYM +*.o +.DS_Store +.*.swp diff --git a/2024/anders/2024_anders.tar.bz2 b/2024/anders/2024_anders.tar.bz2 index e11d04044..8afeffa26 100644 Binary files a/2024/anders/2024_anders.tar.bz2 and b/2024/anders/2024_anders.tar.bz2 differ diff --git a/2024/anders/Makefile b/2024/anders/Makefile index 2b41f1721..f4a80a113 100644 --- a/2024/anders/Makefile +++ b/2024/anders/Makefile @@ -1,6 +1,6 @@ #!/usr/bin/env make # -# 2024/anders +# 2024/straadt ############################# # shell used by this Makefile @@ -22,19 +22,15 @@ include ../../var.mk # Common C compiler warnings to silence # -# NOTE: Please don't add -Wno-unknown-warning-option to CSILENCE -# (or to CUNKNOWN) +# Example: CSILENCE= -Wno-poison-system-directories # -# NOTE: The author says this about -Wno-unsafe-buffer-usage -# -# # nah i'm not really into rust -# -CSILENCE= -Wno-int-in-bool-context -Wno-out-of-line-declaration \ - -Wno-unsafe-buffer-usage +CSILENCE= -Wno-bitwise-op-parentheses -Wno-int-in-bool-context \ + -Wno-strict-prototypes -Wno-misleading-indentation -Wno-parentheses \ + -Wno-sign-compare # Attempt to silence unknown warning options # -CUNKNOWN= +CUNKNOWN= -Wno-unknown-warning-option # Common C compiler warning flags # @@ -46,7 +42,7 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} ${CUNKNOWN} # Compiler standard # -CSTD= -std=gnu17 +CSTD= -std=c11 # Compiler bit architecture # @@ -82,7 +78,7 @@ COTHER= # # Example: OPT= -O0 -g # -OPT= -O3 +OPT= -Os # Default flags for ANSI C compilation # @@ -92,7 +88,7 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${COTHER} ${OPT} # # Example: LDFLAGS= -lncurses -lm # -LDFLAGS= -lm +LDFLAGS= # C compiler to use # @@ -121,7 +117,11 @@ ifeq "$(findstring $(CLANG),${CC})" "$(CLANG)" # # make all CC=clang # -CSILENCE+= -Wno-poison-system-directories -Wno-unknown-warning-option +CSILENCE+= -Wno-bitwise-op-parentheses -Wno-cast-align -Wno-comma \ + -Wno-implicit-int-conversion -Wno-int-in-bool-context \ + -Wno-missing-prototypes -Wno-missing-variable-declarations \ + -Wno-poison-system-directories -Wno-shorten-64-to-32 -Wno-sign-conversion \ + -Wno-strict-prototypes -Wno-unsafe-buffer-usage # CWARN+= -Weverything # @@ -160,7 +160,7 @@ ALT_TARGET= # # Example: DATA= curds whey # -DATA= +DATA= a ${PROG}.wasm ################# @@ -177,6 +177,15 @@ all: data ${TARGET} ${PROG}: ${PROG}.c ${CC} ${CFLAGS} ${PROG}.c -o $@ ${LDFLAGS} +${PROG}.wasm: ${PROG}.c wasm_include/stdio.h wasm_include/termios.h wasm_include/unistd.h + @if [[ ! -s ${PROG}.wasm ]]; then \ + echo ${CLANG} -Os -nostdlib -Iwasm_include --target=wasm32 ${PROG}.c -o ${PROG}.wasm -Wno-builtin-requires-header -Wno-c23-extensions -Wl,--allow-undefined -Wl,--no-entry -Wl,--export-all; \ + ${CLANG} -Os -nostdlib -Iwasm_include --target=wasm32 ${PROG}.c -o ${PROG}.wasm -Wno-builtin-requires-header -Wno-c23-extensions -Wl,--allow-undefined -Wl,--no-entry -Wl,--export-all; \ + else \ + echo "make $@: File already exists: ${PROG}.wasm"; \ + echo "make $@: To force a rebuild: ${RM} -f ${PROG}.wasm ; ${MAKE} $@"; \ + fi + # alternative executable # alt: data ${ALT_TARGET} @@ -206,7 +215,6 @@ clean: clobber: clean ${RM} -f ${TARGET} ${ALT_TARGET} ${RM} -rf *.dSYM - ${RM} -f prog.wav ###################################### diff --git a/2024/anders/README.md b/2024/anders/README.md index 0ed5d3f2a..3ea48d82e 100644 --- a/2024/anders/README.md +++ b/2024/anders/README.md @@ -15,68 +15,159 @@ ## Try: ``` - ./prog + ./try.sh ``` -and then play the resulting `prog.wav` using a sound player. - ## Judges' remarks: -When you run the program, after several moments, a `prog.wav` sound file is produced. +When we ran this entry the first time (in a virtual machine window), it felt like the VM has rebooted. +Then, after the initial feeling had subsided, we were able to appreciate the entry in greater detail. -Using a sound player (you may find `sox(1)` is a good choice), you may enjoy the result. +Have you ever wondered would what would happen if you recursively removed +files starting from the root directory? Are you curious what happens when +you launch a [fork bomb](https://en.wikipedia.org/wiki/Fork_bomb)? +Within the safety of an virtual walls, can safely give those and other scenarios: +just check out the "[Things You Can Do](#todo")" section below. -Can you figure out how it produces the various layers of instruments? +**NOTE**: For those who do not have a clang compiler environment that +supports the `wasm32` target, we provide a `prog.wasm` file. + +**SUGGESTION / REQUEST**: Having a way to build custom boot-up images for this entry would be of interest. ## Author's remarks: -### Obfuscations +### Emulator Running Linux - - "Helpful" formatting - - Character salad - - Loop exit trying to hide by a switch statement - - Strong string encryption. By that I mean "fmt"=>"gnu". - - A `/*{*/` that throws off bracket matching in vim. Begun the editor wars - have! (Wait, I'm **on** the vim-team!) - - `cm` and `ap` stands for "allpass" and "comb", respectively. - - One effect was created with deliberate "memory corruption". -To encourage tinkering I've obfuscated the song data and program (see Y()) less -than the "library code". Sorry if you wanted to tinker with the library code! +#### What It Does -### Sound quality +This is an emulator capable of running a full modern Linux system with a minimal set of features. The system includes: -The sample rate of prog.wav is 256kHz because creating aliasing-free waveforms -would require more code, but you can always oversample the audio and pass the -anti-aliasing problem on to the audio player :-) However, the downsampler in my -`mplayer(1)` is poor, but you can use the high-quality resampler in `sox(1)` to create a -48kHz version: +* An OpenRISC 32-Bit CPU +* A Memory Management Unit +* A UART connected to the Terminal +* An Interrupt Controller +* A Timer Controller -``` - sox prog.wav -r 48000 prog.48kHz.wav + +
+### Things You Can Do +
+ + +#### Look Up Specs + +First, you can look up the specs of the emulated system. The following commands will give you a good overview: + +``` + uname -a + free -h + cat /proc/cpuinfo + cat /proc/meminfo + cat /proc/interrupts + cat /proc/timer_list ``` -### Tricks (the condescending part) - - Kick drum from sines, pitched up to create toms. - - Roland TR-808 style hi-hats (a bunch of high-pass filtered square waves). - - SID/C64-style snare drum (oscillates between noise and square wave). - - There's some FM synthesis in the bass. - - Schroeder reverberator a la Freeverb. The same building blocks are used for - the echo effect. - - Waveshaping/overdrive using tanh(x), ohh yeaaah.. +#### Fork Bomb Visualized -I used this Python snippet to generate `q0[2]` and `q0[3]`: +For educational purposes, type the following two lines and watch the process tree grow: -``` - def X(s): print(hex(int(s.replace("x","1").replace(".","0")[::-1],2))) # not for iopcc-use - X(".x.x..xx.x.xx.xxx.xx.xxx..xx.xxx") - X("x.xx.x.x.x.xxxxxx.xx.xxx.xxxxxxx") +``` + b(){ sleep 2; b|b; } + (b &) && watch -n1 pstree -p ``` +Or just run: + +``` + ./fork_bomb.sh +``` + +Note: You won't be able to stop the emulator anymore and will need to kill the process. + + +#### Delete Filesystem + +Ever wanted to know what happens when you delete your computer's filesystem? +Now is your chance to find out! + +``` + rm -rf / +``` + +Even after removal, your system will still be in a well-defined state. +For example, you can still run commands such as: + +``` + cd /proc + echo * +``` + +Be careful: You won't be able to stop the emulation anymore and will need to kill the process. + + +#### Run C64 Emulation + +A full-fledged C64 emulator is included. Run it via: + +``` + ./c64 +``` + +Since the C64 is little-endian and runs on a big-endian machine, which itself runs on a little-endian machine, it combines the best of both worlds into a cool intermediate format. Might this be the future of endianness? šŸ¤” + + +#### Run Itself + +With `./prog`, you can run the emulator within itself. This is a bit meta, but it works. +The emulator would be able to run Linux as well, but it is tweaked to run with less memory and on a big-endian machine. + + +#### Full scripting capabilities + +With `vi`, you got an awesome editor and can write scripts in *ash* such as. + +``` + i=1 + while [ "$i" -le 10 ] + do + echo "Hello World" + i=$(expr "$i" + 1) + done +``` + + +#### Run in the Web Browser + +Did you know that you can run this emulator in a web browser? + +First, compile with Clang on systems that support a target of `wasm32`: + +``` + make prog.wasm +``` + +Then, for example, run a local web server with the following command: + +``` + python3 -m http.server 8000 +``` + +Open your browser and go to `http://localhost:8000/prog.html`. You can now run the emulator in the browser. + + +### Obsfucation + +The obfuscation is mainly a result of compression, plus a healthy dose of recursion and the usual endian mischief. +For some reason, LLMs might think that this is a Smoothed Particle Hydrodynamics (SPH) simulation. + +Sigh, so much space left. More than enough for multi-core support, a full-fledged windowing system, or networking. +Well, there's always next year. + @@ -433,8 +433,8 @@ height=110>

The International Obfuscated C Code Contest

-

2024/anders - Prize in sound coding

-

layered music generator

+

2024/anders - Prize in imitative rebooting

+

OpenRISC CPU and Linux

@@ -477,47 +477,83 @@ Location: DK - Denmark

To use:

    ./prog

Try:

-
    ./prog
-

and then play the resulting prog.wav using a sound player.

+
    ./try.sh

Judges’ remarks:

-

When you run the program, after several moments, a prog.wav sound file is produced.

-

Using a sound player (you may find sox(1) is a good choice), you may enjoy the result.

-

Can you figure out how it produces the various layers of instruments?

+

When we ran this entry the first time (in a virtual machine window), it felt like the VM has rebooted. +Then, after the initial feeling had subsided, we were able to appreciate the entry in greater detail.

+

Have you ever wondered would what would happen if you recursively removed +files starting from the root directory? Are you curious what happens when +you launch a fork bomb? +Within the safety of an virtual walls, can safely give those and other scenarios: +just check out the ā€œThings You Can Do(#todoā€)ā€ section below.

+

NOTE: For those who do not have a clang compiler environment that +supports the wasm32 target, we provide a prog.wasm file.

+

SUGGESTION / REQUEST: Having a way to build custom boot-up images for this entry would be of interest.

Author’s remarks:

-

Obfuscations

+

Emulator Running Linux

+

What It Does

+

This is an emulator capable of running a full modern Linux system with a minimal set of features. The system includes:

-

To encourage tinkering I’ve obfuscated the song data and program (see Y()) less -than the ā€œlibrary codeā€. Sorry if you wanted to tinker with the library code!

-

Sound quality

-

The sample rate of prog.wav is 256kHz because creating aliasing-free waveforms -would require more code, but you can always oversample the audio and pass the -anti-aliasing problem on to the audio player :-) However, the downsampler in my -mplayer(1) is poor, but you can use the high-quality resampler in sox(1) to create a -48kHz version:

-
    sox prog.wav -r 48000 prog.48kHz.wav
-

Tricks (the condescending part)

- -

I used this Python snippet to generate q0[2] and q0[3]:

-
    def X(s): print(hex(int(s.replace("x","1").replace(".","0")[::-1],2))) # not for iopcc-use
-    X(".x.x..xx.x.xx.xxx.xx.xxx..xx.xxx")
-    X("x.xx.x.x.x.xxxxxx.xx.xxx.xxxxxxx")
+
+

Things You Can Do

+
+

Look Up Specs

+

First, you can look up the specs of the emulated system. The following commands will give you a good overview:

+
    uname -a
+    free -h
+    cat /proc/cpuinfo
+    cat /proc/meminfo
+    cat /proc/interrupts
+    cat /proc/timer_list
+

Fork Bomb Visualized

+

For educational purposes, type the following two lines and watch the process tree grow:

+
    b(){ sleep 2; b|b; }
+    (b &) && watch -n1 pstree -p
+

Or just run:

+
    ./fork_bomb.sh
+

Note: You won’t be able to stop the emulator anymore and will need to kill the process.

+

Delete Filesystem

+

Ever wanted to know what happens when you delete your computer’s filesystem? +Now is your chance to find out!

+
    rm -rf /
+

Even after removal, your system will still be in a well-defined state. +For example, you can still run commands such as:

+
    cd /proc
+    echo *
+

Be careful: You won’t be able to stop the emulation anymore and will need to kill the process.

+

Run C64 Emulation

+

A full-fledged C64 emulator is included. Run it via:

+
    ./c64
+

Since the C64 is little-endian and runs on a big-endian machine, which itself runs on a little-endian machine, it combines the best of both worlds into a cool intermediate format. Might this be the future of endianness? šŸ¤”

+

Run Itself

+

With ./prog, you can run the emulator within itself. This is a bit meta, but it works. +The emulator would be able to run Linux as well, but it is tweaked to run with less memory and on a big-endian machine.

+

Full scripting capabilities

+

With vi, you got an awesome editor and can write scripts in ash such as.

+
    i=1
+    while [ "$i" -le 10 ]
+    do
+        echo "Hello World"
+        i=$(expr "$i" + 1)
+    done
+

Run in the Web Browser

+

Did you know that you can run this emulator in a web browser?

+

First, compile with Clang on systems that support a target of wasm32:

+
    make prog.wasm
+

Then, for example, run a local web server with the following command:

+
    python3 -m http.server 8000
+

Open your browser and go to http://localhost:8000/prog.html. You can now run the emulator in the browser.

+

Obsfucation

+

The obfuscation is mainly a result of compression, plus a healthy dose of recursion and the usual endian mischief. +For some reason, LLMs might think that this is a Smoothed Particle Hydrodynamics (SPH) simulation.

+

Sigh, so much space left. More than enough for multi-core support, a full-fledged windowing system, or networking. +Well, there’s always next year.

- ./try.sh + ./prog ``` +and then play the resulting `prog.wav` using a sound player. + ## Judges' remarks: -When we ran this entry the first time (in a virtual machine window), it felt like the VM has rebooted. -Then, after the initial feeling had subsided, we were able to appreciate the entry in greater detail. +When you run the program, after several moments, a `prog.wav` sound file is produced. -Have you ever wondered would what would happen if you recursively removed -files starting from the root directory? Are you curious what happens when -you launch a [fork bomb](https://en.wikipedia.org/wiki/Fork_bomb)? -Within the safety of an virtual walls, can safely give those and other scenarios: -just check out the "[Things You Can Do](#todo")" section below. +Using a sound player (you may find `sox(1)` is a good choice), you may enjoy the result. -**NOTE**: For those who do not have a clang compiler environment that -supports the `wasm32` target, we provide a `prog.wasm` file. - -**SUGGESTION / REQUEST**: Having a way to build custom boot-up images for this entry would be of interest. +Can you figure out how it produces the various layers of instruments? ## Author's remarks: -### Emulator Running Linux +### Obfuscations + - "Helpful" formatting + - Character salad + - Loop exit trying to hide by a switch statement + - Strong string encryption. By that I mean "fmt"=>"gnu". + - A `/*{*/` that throws off bracket matching in vim. Begun the editor wars + have! (Wait, I'm **on** the vim-team!) + - `cm` and `ap` stands for "allpass" and "comb", respectively. + - One effect was created with deliberate "memory corruption". -#### What It Does +To encourage tinkering I've obfuscated the song data and program (see Y()) less +than the "library code". Sorry if you wanted to tinker with the library code! -This is an emulator capable of running a full modern Linux system with a minimal set of features. The system includes: +### Sound quality -* An OpenRISC 32-Bit CPU -* A Memory Management Unit -* A UART connected to the Terminal -* An Interrupt Controller -* A Timer Controller +The sample rate of prog.wav is 256kHz because creating aliasing-free waveforms +would require more code, but you can always oversample the audio and pass the +anti-aliasing problem on to the audio player :-) However, the downsampler in my +`mplayer(1)` is poor, but you can use the high-quality resampler in `sox(1)` to create a +48kHz version: - -
-### Things You Can Do -
- - -#### Look Up Specs - -First, you can look up the specs of the emulated system. The following commands will give you a good overview: - -``` - uname -a - free -h - cat /proc/cpuinfo - cat /proc/meminfo - cat /proc/interrupts - cat /proc/timer_list +``` + sox prog.wav -r 48000 prog.48kHz.wav ``` +### Tricks (the condescending part) -#### Fork Bomb Visualized + - Kick drum from sines, pitched up to create toms. + - Roland TR-808 style hi-hats (a bunch of high-pass filtered square waves). + - SID/C64-style snare drum (oscillates between noise and square wave). + - There's some FM synthesis in the bass. + - Schroeder reverberator a la Freeverb. The same building blocks are used for + the echo effect. + - Waveshaping/overdrive using tanh(x), ohh yeaaah.. -For educational purposes, type the following two lines and watch the process tree grow: +I used this Python snippet to generate `q0[2]` and `q0[3]`: -``` - b(){ sleep 2; b|b; } - (b &) && watch -n1 pstree -p +``` + def X(s): print(hex(int(s.replace("x","1").replace(".","0")[::-1],2))) # not for iopcc-use + X(".x.x..xx.x.xx.xxx.xx.xxx..xx.xxx") + X("x.xx.x.x.x.xxxxxx.xx.xxx.xxxxxxx") ``` -Or just run: - -``` - ./fork_bomb.sh -``` - -Note: You won't be able to stop the emulator anymore and will need to kill the process. - - -#### Delete Filesystem - -Ever wanted to know what happens when you delete your computer's filesystem? -Now is your chance to find out! - -``` - rm -rf / -``` - -Even after removal, your system will still be in a well-defined state. -For example, you can still run commands such as: - -``` - cd /proc - echo * -``` - -Be careful: You won't be able to stop the emulation anymore and will need to kill the process. - - -#### Run C64 Emulation - -A full-fledged C64 emulator is included. Run it via: - -``` - ./c64 -``` - -Since the C64 is little-endian and runs on a big-endian machine, which itself runs on a little-endian machine, it combines the best of both worlds into a cool intermediate format. Might this be the future of endianness? šŸ¤” - - -#### Run Itself - -With `./prog`, you can run the emulator within itself. This is a bit meta, but it works. -The emulator would be able to run Linux as well, but it is tweaked to run with less memory and on a big-endian machine. - - -#### Full scripting capabilities - -With `vi`, you got an awesome editor and can write scripts in *ash* such as. - -``` - i=1 - while [ "$i" -le 10 ] - do - echo "Hello World" - i=$(expr "$i" + 1) - done -``` - - -#### Run in the Web Browser - -Did you know that you can run this emulator in a web browser? - -First, compile with Clang on systems that support a target of `wasm32`: - -``` - make prog.wasm -``` - -Then, for example, run a local web server with the following command: - -``` - python3 -m http.server 8000 -``` - -Open your browser and go to `http://localhost:8000/prog.html`. You can now run the emulator in the browser. - - -### Obsfucation - -The obfuscation is mainly a result of compression, plus a healthy dose of recursion and the usual endian mischief. -For some reason, LLMs might think that this is a Smoothed Particle Hydrodynamics (SPH) simulation. - -Sigh, so much space left. More than enough for multi-core support, a full-fledged windowing system, or networking. -Well, there's always next year. - @@ -433,8 +433,8 @@ height=110>

The International Obfuscated C Code Contest

-

2024/straadt - Prize in imitative rebooting

-

OpenRISC CPU and Linux

+

2024/straadt - Prize in sound coding

+

layered music generator

@@ -477,83 +477,47 @@ Location: DE - Federal Republic of Germ

To use:

    ./prog

Try:

-
    ./try.sh
+
    ./prog
+

and then play the resulting prog.wav using a sound player.

Judges’ remarks:

-

When we ran this entry the first time (in a virtual machine window), it felt like the VM has rebooted. -Then, after the initial feeling had subsided, we were able to appreciate the entry in greater detail.

-

Have you ever wondered would what would happen if you recursively removed -files starting from the root directory? Are you curious what happens when -you launch a fork bomb? -Within the safety of an virtual walls, can safely give those and other scenarios: -just check out the ā€œThings You Can Do(#todoā€)ā€ section below.

-

NOTE: For those who do not have a clang compiler environment that -supports the wasm32 target, we provide a prog.wasm file.

-

SUGGESTION / REQUEST: Having a way to build custom boot-up images for this entry would be of interest.

+

When you run the program, after several moments, a prog.wav sound file is produced.

+

Using a sound player (you may find sox(1) is a good choice), you may enjoy the result.

+

Can you figure out how it produces the various layers of instruments?

Author’s remarks:

-

Emulator Running Linux

-

What It Does

-

This is an emulator capable of running a full modern Linux system with a minimal set of features. The system includes:

+

Obfuscations

-
-

Things You Can Do

-
-

Look Up Specs

-

First, you can look up the specs of the emulated system. The following commands will give you a good overview:

-
    uname -a
-    free -h
-    cat /proc/cpuinfo
-    cat /proc/meminfo
-    cat /proc/interrupts
-    cat /proc/timer_list
-

Fork Bomb Visualized

-

For educational purposes, type the following two lines and watch the process tree grow:

-
    b(){ sleep 2; b|b; }
-    (b &) && watch -n1 pstree -p
-

Or just run:

-
    ./fork_bomb.sh
-

Note: You won’t be able to stop the emulator anymore and will need to kill the process.

-

Delete Filesystem

-

Ever wanted to know what happens when you delete your computer’s filesystem? -Now is your chance to find out!

-
    rm -rf /
-

Even after removal, your system will still be in a well-defined state. -For example, you can still run commands such as:

-
    cd /proc
-    echo *
-

Be careful: You won’t be able to stop the emulation anymore and will need to kill the process.

-

Run C64 Emulation

-

A full-fledged C64 emulator is included. Run it via:

-
    ./c64
-

Since the C64 is little-endian and runs on a big-endian machine, which itself runs on a little-endian machine, it combines the best of both worlds into a cool intermediate format. Might this be the future of endianness? šŸ¤”

-

Run Itself

-

With ./prog, you can run the emulator within itself. This is a bit meta, but it works. -The emulator would be able to run Linux as well, but it is tweaked to run with less memory and on a big-endian machine.

-

Full scripting capabilities

-

With vi, you got an awesome editor and can write scripts in ash such as.

-
    i=1
-    while [ "$i" -le 10 ]
-    do
-        echo "Hello World"
-        i=$(expr "$i" + 1)
-    done
-

Run in the Web Browser

-

Did you know that you can run this emulator in a web browser?

-

First, compile with Clang on systems that support a target of wasm32:

-
    make prog.wasm
-

Then, for example, run a local web server with the following command:

-
    python3 -m http.server 8000
-

Open your browser and go to http://localhost:8000/prog.html. You can now run the emulator in the browser.

-

Obsfucation

-

The obfuscation is mainly a result of compression, plus a healthy dose of recursion and the usual endian mischief. -For some reason, LLMs might think that this is a Smoothed Particle Hydrodynamics (SPH) simulation.

-

Sigh, so much space left. More than enough for multi-core support, a full-fledged windowing system, or networking. -Well, there’s always next year.

+

To encourage tinkering I’ve obfuscated the song data and program (see Y()) less +than the ā€œlibrary codeā€. Sorry if you wanted to tinker with the library code!

+

Sound quality

+

The sample rate of prog.wav is 256kHz because creating aliasing-free waveforms +would require more code, but you can always oversample the audio and pass the +anti-aliasing problem on to the audio player :-) However, the downsampler in my +mplayer(1) is poor, but you can use the high-quality resampler in sox(1) to create a +48kHz version:

+
    sox prog.wav -r 48000 prog.48kHz.wav
+

Tricks (the condescending part)

+ +

I used this Python snippet to generate q0[2] and q0[3]:

+
    def X(s): print(hex(int(s.replace("x","1").replace(".","0")[::-1],2))) # not for iopcc-use
+    X(".x.x..xx.x.xx.xxx.xx.xxx..xx.xxx")
+    X("x.xx.x.x.x.xxxxxx.xx.xxx.xxxxxxx")