Hacker News new | ask | show | jobs
by pickledcods 1070 days ago
This begs for the challenge: How would a program look like if the opcodes it could use exclusively consists of ASCII characters?

This has been a niche programming challenge which was popular before I knew it existed, so I upped the ante by using alpha-numeric only.

The usable opcodes where practically IMUL and XOR with severe limitation on registers and offset. But with them I managed to create a random number generator that magically outputs fragments of codes at the location where the next instruction would be located. This would snowball adding more opcodes/functionality as it unrolls into a complete application.

It felt like the instruction set was so restricting and that the designers of the instruction set deliberately mapped the most critical instruction to make this possible to the opcode values. This has made me wonder what the considerations were to select which binary byte value to match with the instructions. if MUL/XOR were mapped differently, this project most likely would not have existed.

Synchronicity in overdrive:

  https://xyzzy.github.io/smile/README.html
2 comments

Tom Murphy VII (tom7) did such a thing. It's a partial C89 compiler that outputs only printable characters. In meta fashion, the compiler is compiled by itself to also contain only printable characters. The TXT and EXE files below are exactly the same.

Video: https://youtube.com/watch?v=LA_DrBwkiJA

Paper (PDF): http://tom7.org/abc/paper.pdf

Paper (TXT): http://tom7.org/abc/paper.txt

Compiler (EXE): http://tom7.org/abc/paper.exe

Yes, like many others. That's why I upped the ante by stating "numeric and lowercase characters only". And with the glyph differences between them also create a "hidden" image.

Editted: What you reference to is a compiler and something completely different.

Not completely different, because the output of the compiler is itself ASCII. So it compiles any C program into an ASCII exe
Both projects stem from the same root, TXT=EXE. However, both branch in totally different directions. One says "any printable goes" whereas the other says "only the smallest subset (preferably also for ASCII art) goes", mainly being being “0123456789acemnorsuvwxz”.

These are two different projects with different design goals and challenges. Tom's built a compiler around it, I created a bootloader that consists of only MUL and XOR.

I don't understand why I feel that I have to defend myself, I thought hackers love these kind of projects, yet it seems I got cancelled.

A true innovation would be to combine both projects. One that inputs source code plus an image and outputs ASCII art that runs like a program.

>yet it seems I got cancelled.

Holy hyperbole captain. Apparently not being heaped in praise and getting the usual amount of hyper cynical HN criticism is "being cancelled" now.

A friend of mine (and one of the best CTF players I’ve ever met) once wrote shellcode that used only the [0-9A-F] ASCII character range and self-modified to access other instructions.