Hello devs! today I was thinking of some ideas and came up with the idea to have a fully fledged 16-bit CPU Emulator in roblox. Allowing the user to input code to the interface and if they wanted too, They could play games like Tetris. The only game (off roblox) that has done this (As far as i know) is the canceled Java game by Mojang called 0x10c I know poeple have made something like this. Example: @HooferBevelops and his team made a working gameboy emulator.
While something like this is definitely possible, it would most likely be rather slow for most use cases, due to the amount of performance overhead from emulating assembly code inside Lua which is compiled up from C++.
As for how you’d do it, you’re pretty much on your own there. I don’t think anyone here would just code something of that complexity for you. You’d most likely have to learn how CPUs work at a fundamental level first, and then write an interpreter for 16 bit assembly.
Well… I dont know… Its more of a test/idea i had. Idk if it will ever be a game. But if i get something working you could play any 16bit game maybe…
Creating an emulator in Lua is the same as creating an emulator in any other language, except Lua in Roblox is not as low-level as something like C++. It is totally possible to make this in Lua, it just requires a LOT of research on how emulators work. I suggest looking into that first, and then looking into how other people do it in other languages, and keep practicing from there.
If you would like to start simulating instruction sets or learning about CPUs, I would recommend checking out Ben Eater’s YouTube channel. He has a series on building an 8-bit cpu from scratch. It’s a great series and a good starting point if this topic interests you. I have built his CPU by hand and even simulated it.
Microprocessors are definitely an interesting area. I’d say to choose an instruction set that you can wrap your head around and then write it out in code.
If you wanted to make a gameboy emulator, you could emulate registers and memory, considering the Game Boy only had a resolution of 160x144 and a memory size of 8KiB but, technically 64KiB according to Wikipedia, therefore, it should be entirely possible to make a Game Boy emulator in Roblox and have a working display too.