3 ms·
Suppose someone plans to create a multitasking OS for a z80 based computer lacking memory protection. With the goal of saving memory and to guarantee memory iso
by marcodiego 5y ago
Suppose someone plans to create a multitasking OS for a z80 based computer lacking memory protection. With the goal of saving memory and to guarantee memory isolation between processes, it is decided that the OS would actually be a byte-code interpreter capable of running multiple programs at the same time.
So, a byte-code must be chosen to the project. Brainfuck is considered at first: it is extremely simple to implement but is rejected because has very little code density. Then, Chip-8 is considered: it is simple to implement and there are many programs and tools already available. Then p-code is looked at, but it is nowhere near as popular as Chip-8 and apparently not as simple to implement. Other vm's are considered but are rejected because they are not simple or not very popular: SWEET16, ijvm and tinybasic.
Now, what is a good choice for such a situation? What is a good byte-code for such an endeavor? Restrictions are: 64kb of RAM not counting graphics or overlays for drivers that can be dynamically loaded, possibility of running 3 to 10 tasks at the same time, with a good balance of code density and performance, easy to implement and possibly with available tools or good example programs?
- akkartik 5y agoHave you looked into CollapseOS? It might fit your criteria if you're willing to put up with cooperative multitasking. http://collapseos.org http://collapseos.org
- AnIdiotOnTheNet 5y agoI've thought along similar lines a lot recently, and I think you end up wanting something like WASM, but without all the design-by-committee that comes with that. Specifically, ditch the parametric instructions, add arbitrary bit-width ints, multiple memories, a way to allocate and free memories, and hints[0]; and make the binary format simpler to parse by removing the completely unnecessary integer compression. [0] by which I mean the ability to tag functions and variables with an indication of what they're used for so the interpreter/jit is able to replace them with an efficient implementation if one is known to it. For instance, you possibly don't even need float types, just have routines for doing soft-float arithmetic tagged such that the interpreter knows they implement IEEE floating point operations that the processor may be able to handle on its own.
- imglorp 5y agoCP/M? https://hackaday.io/project/173633-cpm-on-a-minimal-z80-computer https://hackaday.io/project/173633-cpm-on-a-minimal-z80-comp...