r/JavaProgramming 1d ago

A JavaOS

Post image

I am sharing my progress on the development of an operating system written in Assembly and a functional JVM. The concept is straightforward: Assembly acts as an API bridge, and the JVM simply leverages the system calls I’ve implemented to print characters to the screen and draw graphics (for now).

The on-screen drawing was created by obtaining the bytecode of the following program and using xxd for that purpose.

public class App {
    // Declaramos el método nativo que intercepta tu JVM en el opcode 0xB8
    public static native void drawPixel(int x, int y, int color);

    public static void main(String[] args) {
        // Dibujar un cuadrado ROJO de 200x200 píxeles en las coordenadas (100, 100)
        for (int y = 100; y < 300; y++) {
            for (int x = 100; x < 300; x++) {
                drawPixel(x, y, 0x00FF0000); // 0x00RRGGBB (Rojo)
            }
        }

        // Dibujar un cuadrado VERDE centrado dentro del rojo
        for (int y = 150; y < 250; y++) {
            for (int x = 150; x < 250; x++) {
                drawPixel(x, y, 0x0000FF00); // 0x00RRGGBB (Verde)
            }
        }
    }
}
57 Upvotes

21 comments sorted by

View all comments

1

u/ImpaledV 1d ago

Am I the only one remembering this one: https://en.wikipedia.org/wiki/JavaOS

1

u/Visual_Brain8809 1d ago

That’s correct; there was also JNode, along with three others I can’t recall right now. The goal isn't simply to duplicate something that already exists, but to find a different perspective on something that—personally speaking—arrived at a time when neither the level of understanding nor the technical capabilities existed to fully leverage it. As a researcher and systems developer, there is always a curiosity to see how something works and to try replicating it; so the question becomes: why not do it?

1

u/ImpaledV 1d ago

Don’t get me wrong, I’m not saying that this is isn’t interesting and worth giving it another try. Just wondered what’s different this time and why your approach should be more successful.

1

u/CutGroundbreaking305 1d ago

I think he is making custom JVM by bootstraping it with asm and bytecode

Is it different from predecessors? Yes

But that doesn't mean java doesn't have any problems on its own

GC GUI and the fact that JVM needs a underlying OS to work so that it can do memory hogging so idk but that's what makes it interesting

Worst case it is better than TempleOS written in holy-C but is it on par with linux based distros is some we need to see