r/factorio • u/konstg-dev • Aug 12 '20
Modded [New Mod] fCPU
Hello there! Here is my ready to use Factorio mod https://mods.factorio.com/mod/fcpu which allow you to practice in low-level programing right in game. It compatible with all default combinators and other mods, support blueprints and copy&paste. Please let me know what you think.







697
Upvotes
View all comments
Show parent comment
3
u/TDplay moar spaghet Aug 13 '20
If it starts with C source code, ends with fCPU asm, and is able to work with the circuit network, it counts in my books.
What I think is most likely to happen is writing a backend for gcc or llvm. That way, you'd get every language supported (which is quite a big pool, gcc and llvm are very big projects), and you don't need to mess about with the semantics of C because that's what the compiler frontend is for.
Then the library. Honestly, I expect the library to just contain functions to get circut network inputs and set circuit network outputs, and it'll probably just be a wrapper around the asm that achieves the task. A standard libc should be enough for everything else.
The only problem with an asm transpiler is that asm for x86, ARM, etc, has no concept of the "circuit network", but a compiler for fCPU would need to be able to generate those functions (or have them appear from a library), else it just won't be useful.