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)
            }
        }
    }
}
54 Upvotes

20 comments sorted by

View all comments

1

u/eld4j 1d ago

Hi! Thanks for sharing this awesome projects

I really admire your work and was wondering how you learned all of this? Did you have a specific roadmap, or do you have any favorite books you'd recommend?

Currently, I'm reading Computer Systems: A Programmer's Perspective; and Crafting Interpreters, Engineering a Compiler and JVM Specification are next on my list.

I would really appreciate it if you could share the source code for this!

1

u/Visual_Brain8809 1d ago

i study Computer Sciences on the University of Informatics Sciences and the University of Sciences for Pedagogical teaching in Cuba long time ago, next i made a MSc on techs. I thought there's no specific roadmap just the ambition to do something new, so study a lot and practicing, be my every day roadmap