top | item 36756694

(no title)

pickledcods | 2 years 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

discuss

order

colejohnson66|2 years ago

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

pickledcods|2 years ago

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.

NobodyNada|2 years ago

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.