GitHub

GitHub forks GitHub last commit GitHub Repo stars GitHub License GitHub issues

32-bit Protected Mode OS

NovumOS is a simple operating system that successfully boots from 16-bit real mode into 32-bit protected mode with a working console!

Features

  • 32-bit Graphics - High-resolution Linear Framebuffer (LFB) with Double Buffering and Dirty Rectangles
  • Dynamic Resolution - Change screen resolution on-the-fly with the res command
  • Preemptive Multitasking - Round-robin scheduler with process lifecycle management (ps, kill)
  • SMP (Symmetric Multiprocessing) - Support for multiple CPU cores with task balancing and work-stealing
  • Relocated Kernel - Loaded at 1MB (0x100000) for maximum stability and compatibility
  • A20 Line Support - Full access to high memory via BIOS & Fast A20 activation
  • LBA Disk Support - Robust disk loading using Logic Block Addressing for larger kernels
  • VGA Emulation Layer - High-speed text console with wrapping and scrolling over 32-bit graphics
  • IDT Support - Interrupt Descriptor Table with exception handling
  • PIT Timer - System timer (1kHz) for precise timing and uptime
  • RTC Driver - Real-time clock support for date and time
  • Keyboard Driver - Full keyboard input support with interrupts (Shift, CAPS, NUM)
  • Command Shell - Interactive console with Tab Autocomplete, Command History (persisted to disk), and cycling matches
  • Piping & Redirection - Support for pipes (|) and output redirection (>, >>)
  • FAT12/16 Support - Native disk support for ATA drives with Long File Name (LFN) and Hidden Files support
  • PCI Bus Enumeration - Support for scanning and identifying hardware devices on the PCI bus
  • Nova Language v0.24 - Integrated custom interpreter with multi-line REPL, mandatory semicolons, modular system, and context-aware tab completion
  • Filesystem Overhaul - Native implementation of create_file, delete, rename, and copy directly in the Nova interpreter
  • Embedded Scripts - Built-in commands written in Nova (syscheck, hello)
  • Native Commands - Native implementation of install and uninstall for Nova scripts
  • Recursive FS - cp and delete now support recursive directory operations throughout the shell
  • Hierarchical Paths - Full support for Current Working Directory (CWD), absolute/relative paths, and quoted arguments for spaces
  • Serial Terminal - Support for QEMU -nographic mode with full bidirectional shell interaction

Building and Running

Requirements:

  • NASM assembler
  • Zig compiler (v0.12+)
  • QEMU emulator

Build:

.\build.bat

Run:

qemu-system-i386 -drive format=raw,file=build\os-image.bin -serial stdio

Run with Custom Res (BGA):

qemu-system-i386 -drive format=raw,file=build\os-image.bin -drive format=raw,file=disk.img -nographic

Available Commands

  • help - Show available commands (auto-synced)
  • res <w> <h> - Change resolution dynamically (e.g., res 800 600)
  • clear - Clear screen
  • matrix - Enterprise-grade Matrix screensaver (resolution-aware)
  • about - Show OS information (Version, Architecture)
  • nova - Start Nova Language Interpreter
  • syscheck - Run system health check (Embedded Nova Script)
  • uptime - Show system uptime and current RTC time
  • time - Show current date and time
  • reboot - Reboot system
  • shutdown - Shutdown system (ACPI support)
  • ls, la - List files (la shows hidden files)
  • pwd - Print current working directory
  • lspci - List PCI devices and hardware bridges
  • cd <path> - Change directory (supports .., /, and relative paths)
  • lsdsk - List storage devices and partitions
  • mount <d> - Select active disk (0/1 or ram)
  • touch <file> - Create file on disk (Supports LFN)
  • mkdir <dir> - Create directory (Supports LFN)
  • cp <src> <dst> - Copy file or folder recursively
  • mv <src> <dst> - Move or rename file/folder
  • cat <file> - Show file contents (Raw)
  • more <file> - Paginated file viewer with scrolling and wrapping
  • edit <file> - Open built-in text editor
  • rm <file> - Delete file/folder (recursive support)
  • history - Show command history
  • mkfs-fat12 - Format disk with FAT12 filesystem
  • mkfs-fat16 - Format disk with FAT16 filesystem
  • install - Install a Nova script as a system command
  • uninstall - Remove an installed Nova command
  • echo <text> - Print text (supports pipes)
  • top - Real-time CPU and Task Monitor
  • ps - List active system processes
  • kill <pid> - Terminate a running process
  • mem - Test memory allocator
  • smp-test - Test global task queue across cores (Debug only)
  • stress-test - Run heavy math on AP cores (Debug only)

SDK (Software Development Kit)

NovumOS includes a complete SDK for developing user-mode applications in C or Zig.

Quick Start:

cd sdk/examples/hello_world
../../build-app.bat main.c hello.elf  # Windows
../../build-app.sh main.c hello.elf   # Linux

Available APIs:

  • nv_print() - Print text to console
  • nv_getchar() - Read keyboard input
  • nv_set_cursor() - Position cursor
  • nv_clear_screen() - Clear display
  • nv_exit() - Exit program

See sdk/README.md for full documentation and examples.

Nova Language

A powerful statement-based interpreted language built into NovumOS. Version 0.23-beta.6 introduces Modular Sub-systems, Multi-line REPL, Mandatory Semicolons, and Context-aware Tab Completion.

Features:

  • Variables: set string name = "Value";, set float pi = 3.14159;
  • Arithmetic: +, -, *, /, % with full support for integer and floating point math.
  • Precision Math: Built-in high-precision sin() and cos() using Bhaskara I approximation.
  • Math Functions: abs(), min(), max(), random(), rad(), deg()
  • Filesystem: create_file, write, mkdir, delete, copy, rename, read, size, exists
  • Interactive: input() for reading user input, set_color() for UI control.
  • System: reboot();, shutdown();, exit();
  • Scripting: argc(), args(n) with full argument persistence.

Architecture

BIOS → Bootloader (16-bit) → Protected Mode Switch → Copy (0x10k to 1MB) → Kernel (32-bit) → Zig Modules

Bootloader:

  • Loads kernel via LBA (Logical Block Addressing)
  • Activates A20 Line (BIOS + Port 0x92)
  • Performs VBE mode detection and validation
  • Switches CPU to protected mode
  • Relocates kernel to 1MB in 32-bit mode for EBDA safety

Kernel:

  • Written in x86 Assembly and Zig
  • Interrupt management (IDT & PIC remapping)
  • System timer (PIT) and Real-Time Clock (RTC)
  • 32-bit Linear Framebuffer (LFB) drawing logic
  • Keyboard driver (IRQ1 based)
  • Command shell with persistent history (hidden .HISTORY) and LFN autocomplete
  • Preemptive Scheduler - Multi-process management with time-slicing
  • SMP Core Balancing - Handshake-based AP initialization and global task distribution
  • Integrated Nova Interpreter

Roadmap

Current progress (v0.24)

  • Graphic mode support (VBE/BGA) (32-bit LFB, dynamic resolution)
  • Kernel Relocation to 1MB (EBDA safety, A20 activation)
  • PCI Bus Enumeration (Config space access, device ID database)
  • Modular Sub-systems (sys, math mod)
  • Multi-line REPL (Accumulator buffer, continuation prompt)
  • Mandatory Semicolons (Complete statement tracking)
  • Context-aware Tab Completion (Import detection)
  • Enhanced Error Handling (Soft errors in REPL)
  • Full Floating Point Engine
  • High-Precision Trig (Bhaskara I formula)
  • Informative REPL (Descriptive status strings)
  • Advanced VM FS Functions (Native delete, rename, copy)
  • Multicore Support
  • FAT32 Support
  • IDT (Interrupt Descriptor Table)
  • Timer (PIT) & Precise Sleep
  • RTC Driver (Date/Time)
  • Keyboard Interrupts (Extended keys, Shift/Caps/Num)
  • Command Shell with LFN Tab Autocomplete
  • Persistent command history on disk (Hidden .HISTORY)
  • FAT12/FAT16 file system with LFN and Hidden Files
  • Recursive Directory Operations (cp, rm)
  • Hierarchical Path Support & CWD (Absolute/Relative paths, cd, pwd)
  • Built-in Text Editor (edit)
  • Dynamic Shell Commands table
  • Nova Language (Multi-line REPL, Modules, Mandatory Semicolons, Context-aware Tab)
  • Native script management (install, uninstall)
  • File Management improvements (LFN create/read/delete)
  • PCI Bus Enumeration
  • Preemptive Multitasking
  • SMP Support (4 cores tested)
  • Process Management (kill, exit, return stubs)
  • Paging & Virtual Memory Management (Basic implementation)
  • User Mode (Ring 3) (Experimental ELF loading)
  • Security Fixes (CVE-2026-40317)
  • GitHub CI/CD (Automated build and build-test validation)

Future improvements

  • Improved User Mode & Syscall API
  • PS/2 Mouse Support
  • Simple Sound Driver (PC Speaker)
  • Network Stack (Initial research)

Author

MinecAnton209

License

See LICENSE file for details.


Made with ❤️ in x86 Assembly & Zig

Read the original on github.com ↗