I created an emulator for a RISC-V 32 bit cpu inside of Roblox, after lots of hours spent debugging, it finally works!
For the Linux image, I used one built from cnlohr’s emulator on GitHub, his is written in C and was really helpful for debugging and fixing mine.
The emulator supports 32 bit integers, multiplication, division, basic math and bitwise operations.
It currently takes between 3-8 minutes to load and boot into Linux, depending on the speed of your device.
The emulator runs 64 MiB of memory and has no MMU.
The terminal supports basic ANSI escape codes for colors, bold text, italics.
Aside from the Welcome UI not able to be closed, and leaving it idle too long breaking it (inputs do nothing), I see no issues with this.
Have you considered trying to get something like the legacy DamnSmallLinux on this?
50mb means fast download (no idea what the size of the current one is), requires far less specs than what you’re stating (can run on 16mb opposed to the 64mb you’ve got here) and could potentially be easier to code a proper UI for (note: I don’t have any idea how hard it was to get the shell working to begin with)
…although with EditableImage you could theoretically have a really tiny resolution screen full of squares - I’d imagine the refresh rate would suck, but 800x600, or even 400x300 sounds plausible (admittedly at a 1 frame per whenever speed)
I’ll definitely try and make the welcome ui closable, and the emulator itself too. The inputs doing nothing is a tricky problem to debug but I’ll try my best to fix it as soon as possible!
Currently, it does not run an os like DSL, it runs only the kernel, made with buildroot and uses busybox, which means it’s only 3-4mb BUT since it’s only a kernel, it can not do much, so I really want to try something like DSL and use editableimages for the display.
Currently the kernel is just loaded into the start of the RAM, and I’ll try getting an MMU working or something similar so that I can have operating systems on it without a million tweaks and fixes. The UI is not that complicated, just a rich text textlabel in a screen with a UI drag thing.
Looks cool, however please remove the debug prints as that makes it significantly slower, even though it doesn’t look like it, print is expensive and especially when called in a loop.
What debug prints exactly? The ones inside the Linux screen are just the output of the kernel, and I do not think I use many prints in my code. Only once every second or so
Yeah those are once every 1/20th of a second or so, they do not lag the game much since it’s only 20 per second and not displayed if not looking in the console. It might make a tiny difference but not noticeable.
I think you don’t get me, printing to the console when performance is critical is expensive. Maybe you didn’t get the memo or you simply don’t know how much CPU cycles it takes to process a Lua call and then Roblox’s code to print something to the screen with the GPU (even if it’s not shown, it has to allocate memory which is another expensive thing to do and then insert your log)