In terms of instruction set and simplicity of emulation. I would like to implement a virtual CPU and figured why not emulate an existing one, so to be able to compile C code to it.
-
Another route is to search for backends to single instruction set architectures: https://stackoverflow.com/questions/3711443/minimal-instruction-set-to-solve-any-problem-with-a-computer-program People seem to have done a clang backend for subleq: https://stackoverflow.com/questions/3711443/minimal-instruction-set-to-solve-any-problem-with-a-computer-program/38523869#38523869 – Ciro Santilli OurBigBook.com Sep 08 '17 at 07:08
7 Answers
Moxie is a great target because it was designed specifically to be an ideal target for GCC. I am the author and would be happy to answer any questions. green at moxielogic dot com

- 643
- 1
- 4
- 9
-
Is there reference documentation about the architecture and instructions set? – Tamás Szelei Feb 02 '11 at 14:48
-
What there is exists at http://moxielogic.org/wiki ... although it will take me a bit to undo damage from the wiki vandals. Check back soon. – Anthony Green Feb 02 '11 at 17:11
-
Can Moxie architecture be used in a closed source commercial project (think inclusion of it's emulator in a video game)? On your site I didn't find a license that clearly specifies that. – ezolotko Jan 04 '16 at 22:31
-
1Hi @ezolotko. Thanks for asking. The answer is, in general, yes. I'll try to update the docs/website soon, but please contact me directly at green AT moxielogic.com. Thanks again. – Anthony Green Jan 06 '16 at 03:10
This probably isn't an uncommon question; I'd hope that most CPU/machine simulation toolkits would include a simple example implementation, but some don't.
I haven't worked with it, but Knuth's MMIX architecture (wikipedia) looks interesting. Like Moxie, it was created to "illustrate machine-level aspects of programming" and is simpler than real machines. It's supported by GCC and there appear to be multiple existing simulators that could be used as a reference in your efforts.

- 76
- 2
MIPS I (one of the targets of GCC) is a surprisingly easy-to-emulate 32-bit platform. Here is an short and simple emulator which can load and run a statically linked Linux MIPS I executable: https://github.com/pts/pts-mips-emulator

- 80,836
- 20
- 110
- 183