Close
0%
0%

Manux

Simple kernel for the Z80

Similar projects worth following
Manux is a small UNIX-like operating system for the Z80 cpu. It supports monotasksing, features ROM based kernel and disk based userland programs. It aims partial POSIX support.

Manux runs on a custom Z80 emulator called bemu80(https://github.com/HelleBenjamin/bemu80).
The emulator is included in the repository and can be built using `make bemu80`.

Main features
=============
- Monotasking
- ROM based kernel
- Disk based userland programs
- POSIX support(partial)
- Custom filesystem (see `doc/filesystem.md`)
- File descriptor support

Status
======
The kernel is currently under development.
Most of the features are working as intended, but there are still some bugs and missing features.
Latest stable version: v0.3.0

History
=======
I started this project back in April 9th, 2025 after I figured out how to upload code as payload to a Z80 machine(http://searle.x10host.com/z80/SimpleZ80.html) that runs BASIC. That's why you see basicloader.c in older versions, fun fact or not. Initially I released the repository as private, but I made a public repository on May 1st, marking the "first" release. After that, I continued development, and kept a small break(less than a year), and now I'm back working on it again.

System calls
============
Programs can communicate with the kernel using system calls. The kernel preserves all general purpose registers, so the programmer shouldn't have to worry about them.

Syscall calling convention
- HL - Syscall argument 1
- DE - Syscall argument 2
- BC - Syscall argument 3
- A  - Syscall number

- HL - Return value if any

See `doc/syscalls.md` for more information

POSIX support
=============
Manux can run very simple POSIX programs. However, it's not fully POSIX-compliant, some programs might break or not work at all.
Stdio works now: printf/scanf are tested. File operations aren't tested/implemented yet. Note that stdio add greatly to the code size, around 2-6KB depending on functions used.
The current implementation relies on z88dk's newlib(also mixed with classic lib, little bit messy), so full custom target is needed. I haven't implemented the full target yet, but I've ported CRT0 and unistd/other POSIX-like functions.
See `include/sys/` folder for currently supported functions.

Minimum system requirements
===========================
Manux supports bemu80(https://github.com/HelleBenjamin/bemu80) as the offical target machine. Manux is going to be ported to other machines in the future when the kernel becomes stable.

- A Z80 CPU
- 56K RAM
- 8K ROM
- a serial interface
- floppy disk or other disk interface

These requirements may change in the future. Lower ram requirement is planned.

To do
====
- [] Add more drivers
- [] Rework memory management
- [] More POSIX features
- [] More documentation
- [x] A filesystem
- [] Use only SDCC compiler, not the whole z88dk toolchain
- [] Port Manux to other machines
- [] Better configuration
- [] Clean legacy code

Programs
========
Manux can run POSIX-like with limited functionality. Some programs may not work as intended. Currently stdio is not supported, so use read/write from unistd instead.

Userland programs are located in `userland/` directory. See its README for more information.

The OS comes with a few programs included in the `userland/` directory.
There are `ecalc`(a simple calculator) and `asmz80`(a simple assembler, WIP).

Pre-requisites
==============
- z88dk 2.4
- make
- kconfig-frontends-nox(for configuration)
- linux or other unix-like platform
- git

Building
========
Configure Manux using `kconfig-mconf Kconfig`. There's a preconfigured `.config` file included.
To build Manux, run `make`. The kernel is build with z88dk. You need to have z88dk installed to build the kernel.

Here's the steps to build Manux:
1. `git clone https://github.com/HelleBenjamin/Manux.git`
2. `cd Manux`
3. `kconfig-mconf Kconfig` (optional)
4. `make`, builds the kernel, userland, disk image, and bemu80

Here's some other make targets:
- `make kernel` builds only the kernel
- `make userland` builds the userland programs and the disk image
- `make bemu80` builds bemu80
- `make emulate` runs the OS in bemu80

`make testprogram` adds file `test.asm`, useful for testing the assembler

Note that compilation can take a while due to SDCC's optimizer. Especially with larger files, such as mfs.c and asmz80.c.
Reduce...
Read more »

Manux-main.zip

v0.3.0-prerelease

Zip Archive - 97.11 kB - 08/24/2026 at 16:57

Download

Manux-0.2.zip

Zip Archive - 37.21 kB - 06/24/2025 at 07:51

Download

Manux-0.1.zip

Initial version

Zip Archive - 23.31 kB - 06/09/2025 at 09:58

Download

  • v0.2

    Benjamin H.06/24/2025 at 07:51 0 comments

    I'm announcing a new update for Manux. Here are the core changes:

    - Updated process creation logic in proc.asm to include process count checks.
    - Enhanced syscall handling in system_call.asm with new syscalls for file operations (open, close, create, execs).
    - Modified shell.c to integrate new file handling commands and improved terminal interaction.
    - Introduced file descriptor management in fd.c for better resource handling.
    - Implemented device filesystem in devfs.c to manage device interactions.
    - Developed memory filesystem(MFS) in mfs.c.
    - Added bootloader in BOOT.bas and kernel initialization in kernel.c.
    - Created upload script upload.sh for automated kernel uploading via serial.
    - Updated syscall interface in syscall.c to support new functionalities.
    - Added debugging capabilities.

View project log

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates