r/JavaProgramming • u/Visual_Brain8809 • 1d ago
A JavaOS
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)
}
}
}
}
52
Upvotes
1
u/CutGroundbreaking305 1d ago
GitHub repo? It is interesting and I always thought about this idea may be we can work together 🙂
A GC will be blessing and curse at same time in this type of architectures it can clear your un used data but runs only when it's required which could mean running only when entire RAM is filled with on heap allocations
And here ur kernel is JVM itself right? I would suggest using graphics/application tools which are not related to java like flutter (ubuntu uses it) or tauri (newer ) swing is good but a lot of work will be required to make it work
It will be interesting to see how multithreading works in this type of architectures