Cosmos (operating system)

C# Open Source Managed Operating System (Cosmos) is a toolkit for building GUI and command-line based operating systems, written mostly in the programming language C# and small amounts of a high-level assembly language named X#.

As of 2022[update], Cosmos encompasses an ahead-of-time (AOT) compiler named IL2CPU to translate Common Intermediate Language (CIL) into native instructions.

Cosmos compiles user-made programs and associated libraries using IL2CPU to create a bootable native executable that can run independently.

The resulting output can be booted from a USB flash drive, CD-ROM, over a network via Preboot Execution Environment (PXE), or inside a virtual machine.

Recent releases also allow deploying to certain x86 embedded devices over Universal Serial Bus (USB).

More recently, the project switched to simply naming new releases after the latest commit number.

Most work on Cosmos is currently aimed at improving debugger functionality and Microsoft Visual Studio integration.

Kernel work is focused on implementing file systems, memory management, and developing a reliable network interface.

Cosmos has many facilities to improve the experience of developing operating systems, and is designed to make the process as fast and painless as possible.

A key feature of Cosmos, which separates it from other operating systems of its type, is its tight integration with Microsoft Visual Studio.

Other virtualisation environments are supported as well, such as Bochs and Hyper-V. An ISO disk image may also be generated that can be burned to a USB flash drive, CD-ROM, or similar media.

PXE booting is also supported, allowing for remote machines to run Cosmos over a network connection.

X# is a low-level programming language designed for the x86 processor architecture as part of Cosmos operating system.

The X# compiler is an open source command-line interface (console) program that parses code lines into tokens, compares them with patterns, and translates matched patterns to intel syntax x86 assembly, typically for the YASM assembler.

[clarification needed] The syntax of X# is straightforward but stricter compared to C. X# supports only single-line comments in the C++ style, starting with - //.

Because line-fixed patterns are specified in syntax implemented in code parser, the opening curly bracket can't be placed on the next line, unlike in many other C-style languages.

X# can access an address with a specified offset using square brackets: There are two ways to compare values in X#: pure comparison and if-comparison.

Additional references are made in the start of the program which give access to the Cosmos libraries.

This is a modified version of a console application, with the Cosmos compiler and bootup stub code already added.

Cosmos allows users to boot the operating system in an emulated environment using a virtual machine.

The default Cosmos template as seen in QEMU.