2
9
Fork
You've already forked TPCPU
0
Tiny Portable CPU - Ethereal Silicon
  • TPCPU32-assembly 60.3%
  • C 28.3%
  • Coder's-Basilisk 11.2%
  • Perl 0.1%
  • Makefile 0.1%
2026年07月11日 10:00:20 -04:00
cbas_src gitap 2026年07月11日 08:34:14 -04:00
distro gitap 2026年07月11日 10:00:20 -04:00
phobos_workstation_files gitap 2026年07月08日 23:04:57 -04:00
planning re-init 2026年05月13日 16:52:40 -04:00
tests re-init 2026年05月13日 16:52:40 -04:00
.cbas_cfg re-init 2026年05月13日 16:52:40 -04:00
.gitattributes re-init 2026年05月13日 16:52:40 -04:00
.gitignore re-init 2026年05月13日 16:52:40 -04:00
CONTRIBUTORS re-init 2026年05月13日 16:52:40 -04:00
Ethereal_Silicon.png re-init 2026年05月13日 16:52:40 -04:00
Ethereal_Silicon_Chip_Logo.png re-init 2026年05月13日 16:52:40 -04:00
ipc.cbas re-init 2026年05月13日 16:52:40 -04:00
LICENSE re-init 2026年05月13日 16:52:40 -04:00
Makefile re-init 2026年05月13日 16:52:40 -04:00
PWLOGO.png re-init 2026年05月13日 16:52:40 -04:00
README.md gitap 2026年07月08日 23:57:31 -04:00

TINY PORTABLE CPU - Project Ethereal Silicon

A full virtual computer built to last

AAAB

Powered by...

AAA

TPCPU is a small, simple public domain computer implemented completely in software.

It was designed from the ground up to be a maximally effective "base" for software that can be re-implemented from scratch even by junior programmers in their spare time.

Its purpose is to provide a stable, reproducible, permanent platform for hosting software, primarily development tools. However, in principle, it should be useful for hosting all sorts of software.

TPCPU can go anywhere: A tiny and relatively straightforward interpreter needs to be replicated on any target, and suddenly that target can run a complete operating system with a shell, a text editor, an assembler (and hopefully compilers in the future) etc.

And it's fast. Despite being an interpreter optimized for ease of implementation rather than raw speed, it easily clocks hundreds of MIPs on a relatively old processor.

This makes TPCPU the optimal choice for:

  • Cross-compilation toolchain hosting
  • Bootstrapping new computing environments
  • Archiving runnable software implementations
  • Educational and Research use: Programs written for TPCPU are extremely portable and easy to replicate.

Building and Running

The Pre-compiled OS (Phobos Workstation) is already pre-compiled in distro/phobos_workstation. To run it, you just need to compile an emulator: The C emulator in distro/canon_pc should do.

cc -O3 distro/canon_pc/*.c -o distro/phobos_workstation/tpcpu
cd distro/phobos_workstation/
./tpcpu kernel.trom

If you want to rebuild the entire OS from the original source, that's tougher. I currently have the makefile configured for how my specific system is setup. However, in principle, you need:

  • Coder's Basilisk cloned from its repository.
  • A fairly standard Linux/POSIX system

Here's the basic procedure:

  • Edit .cbas_cfg to specify where the standard library is. Change this line:
system_include_dir: ../seabass/library/

to point to where on your system the library folder of your CBAS is.

  • from the root of the repository, run CBAS on a .cbas file in the cbas_src folder...
cbas cbas_src/kernel.cbas
  • After compiling, it will produce the file auto_out.t. You want to run the TPCPU assembler on that. The assembler TROM is already provided in distro/roms/as.trom. You can invoke the emulator on this rom while in the root of the repository to compile the file to a rom:
	tpcpu distro/roms/as.trom
	

This will produce the file auto_out.bin. This is a compiled TPCPU rom. Copy it to the proper location in distro/phobos_workstation

  • Repeat this process for all the other .cbas files in cbas_src/ (Except those which are not used by the OS - see the makefile to find out which programs are part of the OS).
  • Note that some cbas files compile to multiple programs - such as mvfile, which compiles to both mv and cp. The behavior of the program is determined by argv[0].

Doing a full bootstrap build

Requires a working CBAS installation and is only tested on Linux. See the Makefile to see how I do a full boostrap build. The general process is similar to the above, but as.trom is produced by first compiling the bootstrap assembler - cbas_src/as_bootstrap.cbas and then using it to compile cbas_src/sh_as.cbas. I also usually do a test compilation of as.trom on its own assembler source to make sure it works.

Technical Specs of TPCPU

  • Stack-based architecture
  • Privileged and user mode
  • Mask-and-offset based memory protection (faster than paging)
  • 32 bit address space capable of addressing 4 gigabytes
  • preemption via instruction counting
  • customizable dev_int instruction to provide additional functionality

What exists right now?

The C emulator works on both Windows (Confirmed: Windows 11) and Linux (Confirmed: Debian)

Why is this valuable? Aren't there other projects/programs built to do the same thing?

To put it bluntly, I have found that no other system quite achieves what TPCPU does.

Virtual Machine Software

Putting a linux distro in a VM to host your toolchain is currently the best solution available to the general public for hosting "permanent" software... however this only kicks the can down the road.

In order for your software to be permanent, the virtual machine software you rely on must be permanent.

This is good enough for enterprise users in most circumstances, but if your goal is to preserve software in a runnable state for 30+ years, it is not sufficient.

Java

Had the same idea of "Abstract away CPU hardware" but did it in a way which was difficult to re-implement. It also has massive Intellectual Property problems that mean it's difficult to actually write your own Java implementation without Oracle getting mad at you.

Lua, Python, Javascript, Most interpreted languages.

Not reasonably capable of running an entire operating system. None of these languages provide the utilities needed to provide preemptive multitasking on more or less arbitrary hardware. Furthermore, They are not designed to be re-implemented from scratch, the original source code is large, and must be ported.

Risc-V Emulation

A Risc-V emulator with memory protection and preemption is quite a bit easier to write than a full Java implementation, but it's still a huge project. It'll probably also run a lot slower than a TPCPU implementation. TPCPU was designed to be emulated fast, RISC-V was not.

It is not reasonable to expect an individual person 40 years from now to write a RISC-V implementation.

It is very reasonable to expect them to write a TPCPU implementation.

Oberon A2

A complete operating system in a box... but it's really hard to re-implement and programming it is exclusively in Oberon...

Uxn

The closest contender, but no cigar. Uxn is an easy-to-reimplement virtual machine... but it's only 16 bit. What's more, the assembly language is more than a little obtuse, making it difficult to have compilers target the machine.

The 16 bit address space ultimately makes UXN little more than a toy.

TPCPU is 32 bit, having a 4 gigabyte address space (rather than 64k). This makes it capable of hosting most modern toolchains (which typically use less than a single gigabyte of memory, but more than 64k).

TPCPU

Only TPCPU is:

  • Tiny - Can be re-implemented by a single person in a week or two. Much faster if you're experienced.
  • Free of IP restrictions - Fully public domain (CC0), you don't even have to credit the original author (me).
  • Capable of running a useful operating system - Preemption, multitasking, memory protection.
  • Not a toy - Actually has the capabilities and tooling to write and deploy real software.

Can I write programs for it?

Yes. There is an on-platform assembler which you can use in conjunction with the text editor to write software.

At the moment, the only high level language that can compile to TPCPU assembly is Coder's Basilisk but in the future I hope to write an on-platform C compiler.

I consider this lack of high-level language tooling to be TPCPU's greatest weakness at the moment, see the notice at the beginning of this README.

The CBAS-based software development pipeline for TPCPU is almost ready for deployment: there is a standard library and basically all the software on the system was written in CBAS, including the kernel however there is little documentation, as I intend the primary SDK to be on-platform.

The only on-platform tool available at the moment is the self-hosted metaprogramming-enabled macro assembler.

If you have a working emulator, you can use this in combination with the text editor to write software and compile it just using the machine itself.

The assembly standard library is just a direct port of the CBAS standard library and has yet to be documented (at time of writing). Stay tuned...

Is there documentation?

Yes x2 x3 however documentation is still in-development, and I expect that an individual cloning the repository won't be able to write new software for the OS immediately. please be patient.

Plans for The Commandline Phase of the Project

In order for the OS to complete, I need...

Manual

The manual has to be finished. I need to explain the use of Phobos Workstation, the syntax of the Assembly language, and the use of the shell.

Standard Library Reference Docs

I need to write reference material on the standard library.

Tutorials

I need small tutorial programs to demonstrate how to use the assembler and standard library to write programs for Phobos Workstation.

Promotional Material

I need a logo for Phobos Workstation and I need to advertise the software.

People need to know this exists!

Demos

I need actual demos that run on Phobos Workstation to draw intrigue to the OS. Cutesy, fun stuff. That's kind of hard to do with something as dry as a commandline OS, but I can probably come up with something...

High Level language on the machine

The assembler is the standard tool for writing code on TPCPU. However, this should eventually not be the case. I want to port C or some other high level language to the system.

Standard Library usage examples

I need examples of using the standard library to write utilities and programs for Phobos Workstation.

HLL2 usage examples

I need examples using HLL2.t to write programs for Phobos Workstation.