
Sol – a sunny little virtual machine (2012) - maastaar
https://rsms.me/sol-a-sunny-little-virtual-machine
======
half-kh-hacker
(2012)

Having written a few toy VMs in the past (and some in production!), there are
always avenues to "make it weird."

Sol's yield/end instruction pair looks super abusable if you want to write
somethiing obfuscated.

My favourite alteration has always been to not have any control flow
instructions in the provided ISA, but allow the programmer direct write access
to the program counter register, or force them to write self modifying code.

After all, programming is fun.

~~~
praptak
While z80 does have control, it only has jumps to constant addresses. You had
to do a push and a ret in order to jump at a calculated address. Or use self-
modifying code, although I don't think it was really used.

~~~
geofb
Could this be done by JP (HL) or JP (IX) or JP (IY)

~~~
praptak
Ah, I misremembered. The push-ret trick was for things like emulating JP(BC)
or pushing multiple addresses to indirectly _call_ a few functions in a row.
There _was_ an indirect jump but no indirect call.

------
dang
Discussed at the time:
[https://news.ycombinator.com/item?id=4656605](https://news.ycombinator.com/item?id=4656605).

