A bare-metal 32-bit x86 operating system written in NASM assembly.
Mellivora OS is a from-scratch hobby OS that boots on real x86 hardware or in QEMU. It includes a custom HBFS v3 filesystem with permissions and xattr, ring 3 user-mode execution, a DOS-inspired interactive shell with POSIX features, 182 syscalls, priority-based preemptive scheduling with per-task fd isolation, POSIX signals with a W^X trampoline, a VFS abstraction layer, AHCI SATA and Intel e1000 NIC drivers, a GDB remote stub, compositor surface IPC, an in-OS Tiny C Compiler, a package manager, 231 assembly programs, and 31 bundled samples (C, Perl, and BASIC).
New to the project? Start with the Installation Guide, then try the Tutorial or browse the Technical Reference.
- Boot path: BIOS 3-stage boot or UEFI (gnu-efi PE32+) into 32-bit protected mode; optional x86-64 long-mode path
- Userland: 90+ shell commands, 231 assembly programs, and 31 bundled samples (C, Perl, and BASIC)
- Core pieces: HBFS v3 filesystem + VFS layer, ELF32 loader, buddy PMM allocator, serial/VGA/ATA drivers
- Developer-ready: API docs, programming guide, regression tests, release packaging, and
hbpkgpackage manager
- 32-bit protected mode with flat memory model; optional x86-64 long-mode path (
make 64bit) - UEFI boot โ
boot/uefi_loader.efi(gnu-efi PE32+) for UEFI firmware;make uefi/make run-uefi - Ring 0 / Ring 3 privilege separation โ programs run in user mode
- 182 syscalls via
INT 0x80โ v10 adds dup/pipe2/mmap/mprotect/clock_gettime/surfaces; v11 adds sigaction/sigreturn/alarm/xattr; v12.0 adds full POSIX session/uid/signal/timer/termios set; v12.1 adds per-task errno (SYS_GETERRNO) - Virtual filesystem (VFS) โ unified open/read/write/stat/readdir front-end; backends: HBFS (
/), procfs (/proc), devfs (/dev), tmpfs (/tmp) - Priority-based preemptive scheduler โ 4 priority levels (HIGH/NORMAL/LOW/IDLE), 128 concurrent ring-3 tasks; blocking
waitpid - Per-task fd isolation (v12.1) โ each task has a private 4 KB fd table page; no cross-task aliasing
- POSIX-style signals โ SIGINT, SIGKILL, SIGTERM, SIGTSTP, SIGCONT, SIGUSR1/2, SIGALRM, SIGCHLD; W^X sigreturn trampoline at 0x1FFFF000
- Per-task errno (v12.1) โ
TCB_ERRNOin the TCB; read viaSYS_GETERRNO - Process groups โ PGID and SID support for job control
- ELF32 loader โ supports flat binaries and ELF executables
- Physical memory manager with buddy allocator (order 0โ11; malloc/free/realloc for user programs)
- VBE/BGA graphics driver โ high-resolution framebuffer modes (640ร480, 800ร600, 1024ร768 at 32 bpp) with double buffering
- Compositor surface IPC โ kernel-managed pixel buffers with z-order and dirty-rect compositing (SYS_SURFACE_CREATE/COMMIT/DESTROY/MOVE/RESIZE)
- Three-stage BIOS boot: MBR โ Stage 2 (A20, memory map, protected mode) โ Kernel
- Sequential hardware initialization โ VGA, PIC, IDT, PIT, keyboard, PMM, ATA, serial, TSS, scheduler, IPC, networking, e1000 NIC, paging, mouse, SB16, VBE, PCI, AC'97, ATA DMA, VirtIO, AHCI SATA, GDB stub
- Filesystem mount โ HBFS detection, validation, and auto-format
- Shell handoff โ drops into HB Lair interactive prompt after init completes
- 90+ built-in shell commands with aliases: file management, text processing, system info, process control
- Tab completion, command history (128 entries), Ctrl+C hard-abort with proper cleanup
- Enhanced line editing โ Ctrl+A/E (home/end), Ctrl+U (kill line), Ctrl+W (delete word), Ctrl+L (clear+redraw)
- Process management โ
ps,jobs,kill,bg,fg,nicefor task control - Pipes, redirection, and chaining โ
|,>,>>,<,&&, and||for shell workflows - Alias system โ define custom command shortcuts
- 32 environment variables with
$VARexpansion and$(cmd)command substitution,$((expr))arithmetic expansion - Batch scripting โ execute
.batfiles with sequential command processing source/.โ execute scripts in current shell context- PATH-based program search โ run programs from any directory
- Full path support โ
cat /docs/readme,run /bin/hello,diff /docs/a /docs/b - Multi-level subdirectories โ up to 16 levels deep with
cd,mkdir,pwd
- Honey Badger File System v3 โ custom filesystem with 4 KB blocks and write-ahead journal
- 455 entries per root directory, 224 entries per subdirectory (288-byte entries, 253-char max filename)
- File types: text, executable, directory, batch script
- File permissions โ Unix-style 12-bit mode (
HBFS_DE_MODE); owner/group/other rwx enforced byhbfs_check_permission - Extended attributes โ per-file xattr block;
hbfs_xattr_get/hbfs_xattr_setkernel API - Feature flags โ superblock
HBFS_SB_FEATURES: journal, xattr, permissions - VFS integration โ accessed via the VFS layer; raw
fd_open/fd_read/fd_writestill available - File descriptors: open/read/write/close/seek (8 legacy FDs; 64 VFS FDs)
- Wildcards:
*and?pattern matching indelandcopy
- VGA text mode (80ร25, 16 colors)
- PS/2 keyboard with shift, ctrl, and special key support
- PS/2 mouse โ 3-byte packet, IRQ12, cursor tracking
- ATA PIO disk with LBA48 addressing
- ATA Bus Master DMA โ Intel PIIX3/4 IDE controller, PRD-based DMA reads
- AHCI SATA (v11) โ polling-mode SATA driver; auto-detected via PCI; falls back to ATA PIO
- PIT timer at 100 Hz
- PC speaker for sound/music
- Sound Blaster 16 ISA DMA PCM playback
- AC'97 audio โ Intel ICH2/3/4 PCI DMA playback
- Serial port (COM1 at 115200 baud) for debug output and GDB remote stub
- Intel e1000 NIC (v11) โ 82540EM, 16-entry TX ring / 32-entry RX ring; Ctrl+Alt+G for GDB breakpoint
- RTC real-time clock for date/time
- PCI bus โ enumeration (buses 0โ7), 64-entry device table
- VirtIO PCI legacy โ virtio-blk (block) and virtio-net (network)
- GDB remote stub (v11) โ RSP protocol over COM1; supports registers, memory, continue, step, breakpoints
- Games (31): Snake, Tetris, Minesweeper, Galaga, Pac-Man, Game of Life, Maze, Kingdom, Outbreak, Neurovault, Blackjack, Rogue, Solitaire, Breakout, Raycaster, Robot Town, and more
- HBU (Honey Badger Utilities): grep, sort, sed, awk, tr, wc, cut, head, tail, diff, find, uniq, rev, paste, xargs, tar, nm, and more
- Tools: Text editor, hex viewer, file pager (
more/pager), CSV viewer, dual-pane file manager (burrow),topprocess monitor - Demos: Mandelbrot/Julia renderers, plasma effect, VBE sprite blit, rotating cube, banner, colors, Doom fire effect
- Languages: TCC (Tiny C Compiler), BASIC interpreter (
basic+basicccompiler), Brainfuck interpreter, Perl interpreter, Forth interpreter - Network tools: ping, wget, nc, ftp, telnet, irc, gopher, dig, traceroute, whois, daytime
- Daily-driver suite (new):
tutorial,pkginfo,meminfo,journal,bcal,theme,tag,histgrep,bnotify,mkprog,dnslook,play,nim,plasma,tldr,todo,pomodoro,morse,wiki,color,stopwatch,countdown,passgen,dice,coin,tip,roll,pick,reverse,upper,lower,countc - API Libraries: 17 reusable
.inclibraries inprograms/lib/(string, I/O, math, VGA, memory, data, net, GUI, VBE, font, audio, highscore, and more) - Samples: 17 C programs + 9 Perl scripts + 5 BASIC scripts in
/samples
# Debian/Ubuntu
sudo apt install nasm qemu-system-x86 make python3
# Fedora
sudo dnf install nasm qemu-system-x86 make python3
# Arch Linux
sudo pacman -S nasm qemu-full make python
# macOS
brew install nasm qemu make python3git clone https://github.com/James-HoneyBadger/Mellivora_OS.git
cd Mellivora_OS
make full # Build everything
make run # Launch in QEMUThat's it. You'll see the HB Lair boot banner and a shell prompt:
Lair:/>
Type help to see all available commands, or just start exploring:
Lair:/> dir # List files and directories
Lair:/> cd games # Enter the games directory
Lair:/> snake # Play Snake!
Lair:/> cd / # Back to root
Lair:/> cat /docs/readme # Read documentation
Lair:/> tetris # Play Tetris (found via PATH)
Lair:/> tcc /samples/hello.c # Compile and run a C program
Lair:/> perl /samples/hello.pl # Run a Perl script
/
โโโ bin/ 190 utility programs (edit, grep, sort, tcc, wget, nc, ...)
โโโ games/ 29 games (snake, tetris, galaga, pacman, rogue, robotown, ...)
โโโ samples/ 31 source files (hello.c, fib.c, hello.pl, fizzbuzz.pl, hello.bas, ...)
โโโ docs/ text files (readme.txt, license.txt, notes.txt, ...)
โโโ script.bat Example batch script
Programs in /bin and /games are in the default PATH, so they run from any directory.
Mellivora_OS/
โโโ boot.asm Stage 1 MBR boot sector (512 bytes, 16-bit)
โโโ stage2.asm Stage 2 loader (A20, E820, long mode switch)
โโโ kernel.asm Kernel entry + modular includes (22 files in `kernel/`)
โโโ Makefile Build system (make full / make run / make debug)
โโโ populate.py HBFS image populator with subdirectory support
โโโ CHANGELOG.md Version history (v1.0 โ v13.0.0)
โโโ README.md This file
โโโ programs/ User-space assembly programs
โ โโโ syscalls.inc Shared syscall constants and helpers
โ โโโ lib/ Reusable API libraries (string, io, math, vga, mem, data)
โ โโโ hello.asm Hello World
โ โโโ edit.asm Full-screen text editor
โ โโโ snake.asm Snake game
โ โโโ tetris.asm Tetris with rotation, scoring, levels
โ โโโ galaga.asm Space shooter
โ โโโ tcc.asm Tiny C Compiler (subset)
โ โโโ grep.asm Pattern search
โ โโโ sort.asm Line sorting
โ โโโ ... (231 programs total)
โโโ samples/ C, Perl, and BASIC source files
โ โโโ hello.c, fib.c, primes.c, calc.c, matrix.c, hanoi.c
โ โโโ bf.c, wumpus.c, boxes.c, stars.c, echo.c
โ โโโ hello.pl, factorial.pl, fizzbuzz.pl, guess.pl, strings.pl, arrays.pl
โ โโโ hello.bas, fib.bas, blackjack.bas, mandelbrot.bas, snake.bas
โ โโโ ... (31 samples total โ 17 C + 9 Perl + 5 BASIC)
โโโ tests/ Regression test suite
โ โโโ test_build.sh Build-time checks
โ โโโ test_hbfs.py HBFS filesystem integrity checks
โโโ docs/ Documentation
โโโ API_REFERENCE.md Library API reference
โโโ INSTALL.md Build & installation guide
โโโ USER_GUIDE.md Shell commands & usage manual
โโโ PROGRAMMING_GUIDE.md Writing programs for Mellivora
โโโ TECHNICAL_REFERENCE.md OS internals & architecture
โโโ TUTORIAL.md Step-by-step beginner tutorial
| Document | Description |
|---|---|
| Installation Guide | Prerequisites, building, QEMU, real hardware |
| User Guide | Complete shell command reference and usage |
| Programming Guide | Writing assembly programs with syscalls |
| Technical Reference | Architecture, memory map, HBFS, drivers |
| Tutorial | Step-by-step beginner walkthrough |
| API Reference | Library functions and calling conventions |
| Changelog | Version history and release notes |
| Program | Description |
|---|---|
snake |
Classic snake โ eat food, grow, avoid walls and tail |
tetris |
Tetris with 7 tetrominoes, rotation, scoring, levels |
mine |
Minesweeper with flag and reveal mechanics |
galaga |
Space shooter with enemy waves |
blackjack |
Blackjack (21) card game |
rogue |
ASCII dungeon crawler |
adventure |
Text adventure (interactive fiction) |
connect4 |
Connect Four |
mastermind |
Mastermind code-breaking game |
hangman |
Hangman word game |
tictactoe |
Tic-tac-toe |
simon |
Simon says memory game |
guess |
Number guessing game with hints |
kingdom |
Medieval kingdom management simulation |
life |
Conway's Game of Life (78ร23 grid) |
maze |
Random maze generator with BFS solver |
neurovault |
Sci-fi dungeon crawler RPG |
outbreak |
Zombie survival strategy game |
doomfire |
Doom fire effect demo |
matrix |
Matrix rain effect |
rain |
Rainfall animation |
starfield |
Starfield fly-through |
lunar |
Lunar lander game |
solitaire |
Klondike solitaire card game |
pacman |
Pac-Man-style 21ร21 maze chase โ eat dots and power pellets, hunt or flee 4 ghosts |
iago |
Othello / Reversi โ VBE board with greedy-AI opponent and persistent wins |
raycaster |
Wolfenstein 3D-style raycaster โ fixed-point 16.16 math, WASD movement |
robotown |
Robot Town โ logic-puzzle adventure inspired by Robot Odyssey |
breakout |
Breakout/Arkanoid clone โ 5ร10 bricks, three lives, LEFT/RIGHT paddle |
29 games total in
/gamesโ run any from anywhere thanks to PATH.
| Program | Description |
|---|---|
edit |
Full-screen text editor with save/load |
burrow |
Dual-pane file manager TUI (Midnight Commander-style) |
tcc |
Tiny C Compiler โ compile C to ELF inside the OS |
grep |
Pattern search in files |
sort |
Sort lines alphabetically |
hexdump |
Hex/ASCII file viewer |
sed |
Stream editor (search and replace) |
tr |
Character translator |
csv |
CSV file viewer with formatted columns |
wc |
Line, word, and byte counter |
pager |
File pager (like more) |
cal |
Calendar with current day highlighted |
calc |
Interactive calculator (+, -, ร, รท, %) |
mandel |
Mandelbrot set renderer (fixed-point) |
mandelbrot |
Full-color Mandelbrot at 640ร480ร32 bpp, rainbow escape-time palette |
julia |
Interactive Julia set renderer โ arrow keys move c, +/- zoom |
more |
Paging text viewer โ SPACE=next page, ENTER=line, Q=quit |
top |
Real-time process monitor with memory bar, refreshes every second |
tar |
HBTAR1.0 flat archive โ create, extract, list (up to 64 files) |
nm |
ELF32 symbol table reader โ address, type, and name |
awk |
Pattern/action processor โ $n, NR, NF, print, gsub, /regex/, BEGIN/END |
basic |
GW-BASIC-style interpreter with strings, loops, DATA/READ, and file mode |
bf |
Brainfuck interpreter |
| Library | Functions | Description |
|---|---|---|
string.inc |
30+ | String manipulation, comparison, search, memory ops |
io.inc |
20+ | Console I/O, file operations, argument parsing |
math.inc |
10+ | Number parsing/formatting, arithmetic |
vga.inc |
15+ | VGA text mode, cursor, color, UI drawing |
mem.inc |
10+ | Heap allocation, pool/arena allocators |
data.inc |
10+ | Stacks, queues, bitmaps, dynamic arrays |
net.inc |
10+ | TCP/UDP sockets, DNS, ICMP ping |
gui.inc |
10+ | Burrows desktop GUI wrappers |
sprite.inc |
4 | VBE sprite drawing: alpha, opaque, color-key, scaled |
| Command | Description |
|---|---|
make full |
Complete build: boot + kernel + programs + filesystem |
make run |
Launch in QEMU (i486-compatible x86, 128 MB RAM) |
make debug |
Launch with QEMU monitor on stdio |
make iso |
Create a bootable installer/live ISO with docs included |
make check |
Run the regression suite and HBFS integrity checks |
make clean |
Remove all build artifacts |
make sizes |
Show component sizes |
- QEMU 6.0+ with
qemu-system-i386(orqemu-system-x86_64in compatibility mode) - Any modern host OS (Linux, macOS, Windows with WSL)
- i486-or-newer x86 CPU with BIOS legacy boot support
- 1 MB RAM minimum (128 MB recommended)
- IDE/SATA disk or USB drive (BIOS legacy boot)
- VGA-compatible display
- PS/2 keyboard
| Metric | Value |
|---|---|
| Kernel source | Entry file + 26 modular include files |
| Syscalls | 182 (via INT 0x80) |
| Shell commands | 90+ built-ins, aliases, history (128 entries), tab completion |
| User programs | 231 assembly apps |
| Bundled samples | 31 (17 C + 9 Perl + 5 BAS) in /samples |
| API libraries | 17 reusable .inc modules in programs/lib/ |
| Disk image | 2 GB raw HBFS image |
| HBFS root capacity | 455 files; 224 files per subdirectory |
| Concurrent tasks | 128 (preemptive scheduler, 4 priority levels) |
This project is licensed under the MIT License.
Copyright (c) 2026 Honey Badger Universe
Mellivora capensis โ the honey badger. Small, tough, and fearless. Just like this OS.
| Component | Name | Full Name |
|---|---|---|
| Kernel | Mellivora | Mellivora OS kernel |
| Init System | Ratel | Hardware & subsystem initialization |
| Shell | HB Lair | Honey Badger Lair |
| Filesystem | HBFS | Honey Badger File System |
| Utilities | HBU | Honey Badger Utilities (GNU-like tools) |