
Compiling C to printable x86, to make an executable research paper [video] - JoshTriplett
https://www.youtube.com/watch?v=LA_DrBwkiJA
======
saagarjha
Did not expect to get rickrolled while learning about assembly…

------
shakna
Damn. No mov (no movfuscator approach), and no interrupts. And only jumping
forwards, so no loops, they have to be unfolded in the compiler.

This is awesome.

~~~
loup-vaillant
Actually, there are loops: jumps are performed modulo 2^16, so jumping past
the end of the program actually wraps back to the beginning. By dividing the
program into blocks, and jump as many times as required, you can perform
loops. Just one problem: it takes a _looong_ time.

~~~
jsjohnst
Movfuscator is comparably just as slow or worse.

------
gallerdude
Totally recommend Dr. Tom PhD. Made a great video on automatically making NES
games 3D.

------
techwizrd
The brown paper and explanations reminded me of a Numberphile video (another
good channel to check out on YouTube). I'm very impressed out how he was able
to break down what he did and explain it simply.

~~~
JoshTriplett
Likewise; that impressed me just as much as the details themselves did. An
explanation that clear is a rare thing.

I actually appreciated the degree to which he glossed over certain things. For
instance, he described a register as a temporary thing inside the processor,
and then described the stack the same way. For the purposes of the explanation
he gave, it doesn't _matter_ that the stack actually lives in memory. And
anyone who already knows about the stack will already know that.

------
danbruc
I wonder why he implemented a | b as (a & b) - ((a ^ b ^ -1) + 1) instead of
(a & b) ^ a ^ b which seems much easier.

~~~
infogulch
He acknowledged this in the comments and said that he didn't notice! But also
that using add demonstrated the point he was making much better: decompose an
inaccessible desired instruction into a longer series of accessible
instructions. I agree.

------
cwyers
That was amazing.

------
hprotagonist
tom7 is a crazy man :D

