XionKB

 

Sirius DOS

Sirius DOS is a research software platform devised by American computer scientist Alexander Nicholi based on MS-DOS 6.22 and running on IBM-PC compatibles.

Sirius DOS
A research operating system to endeavour towards Anodyne.
Created by Alexander Nicholi
Written in C, C*, x86 assembly, 68k assembly, ARMv4T assembly
OS family DOS
Working state In active development
Source model Closed source
Initial release Unreleased
Available in English
Supported platforms IBM-PC (i286 or later, i486+ recommended), DOSBox-X (as Sirius DOSBox), Sega Mega Drive and Nintendo Game Boy Advance (as Sirius OS)
Kernel type Exokernel
Userland none
Default user interface Command-line interface
Licence ASL v1.1

Why?

The Anodyne personal supercomputer project poses a dilemma: with how conjoined hardware and software are both in theory and in product, it is hard to significantly improve one without being held back by the other. Just try installing Xilinx Vivado and marvel at all of the gigabytes of disk space you will end up needing – and that’s the minimum required to start making anything.

The cause of this problem is something programmers are, incidentally, already familiar with: it’s called coupling, and it is indeed a scourge. Even though products continue to climb into the stratosphere as measured by benchmarks, scientific computing and visual rendering of 3D and video, the experience of using them and programming them has become severely stunted. One does not simply “do whatever” as they could in the 1990s now that programming has become pigeonholed into existing architectures, paradigms and ways of being.

We have to break this coupling in order to reopen the door to impactful experimentation. The only way to do that is by solving the catch-22, hence the creation of Sirius DOS. DOS was chosen as a foundation because of its widespread use, unassuming architecture that can be expanded upon easily and its virtue as a period piece of the 1980s and early 1990s when it was an open question what media formats or instruction sets your computer might be using. Indeed, even on DOS we will fast be realising some great innovations—such as the software modular memory technique—without even having to touch an FPGA.

How so?

To start, the project will retread the footprints of Ken Thompson:

  1. an editor
  2. an assembler
  3. a kernel overlay

In our case, the following software will do these jobs, respectively:

  1. Quindle
  2. Oración
  3. Hinterlib

Unlike Thompson’s original UNIX, these will not be a crummy amalgamation of primitive tools. Quindle will be a high-colour program running up to 1280×1024 in resolution with a fully-fledged virtual terminal and fixed tiling window system, Oración will be a modular assembler with instruction encodings and aliases composed in source files, and Hinterlib will subsume the MS-DOS subsystems already present while also pulling double duty to converge the programs using it onto a unified API for both DOS applications and hosted applications on other systems it supports.

These are just the basics however. With these in hand, the creation of the so-called ‘developmental quartet’—Inbound, Outbound, Rebound and Earthbound—can begin. These tools provide the rest of the plumbing necessary to develop software products to completion: build orchestration, software package creation, software distribution strategies, and finally the procurement of software from yonder, respectively.

Memory maps

To tamp a foundation for a proper exokernel, defining a set of memory maps for the various target hardware platforms is an early must. So far, these have been tentatively defined for the IBM-PC, Sega Mega Drive and Nintendo Game Boy Advance.

Before the Sirius DOS specific conceptual maps can be detailed, it is necessary to know the hardware memory maps provided by each of the target platforms to software:

IBM-PC
Memory map, in real mode (i286+)
Ident Start End Size Description
IVT $00:0000 $00:03FF 1KiB Interrupt vector table.
BDA $00:0400 $00:04FF 256 bytes BIOS data area.
LRAM0 $00:0500 $00:0FFF 2.75KiB Lower RAM region 0.
LRAM1 $00:1000 $00:3FFF 12KiB
Lower RAM region 1. This is a compatibility ledge: RAM regions beyond this are not guaranteed to be present on IBM-PC compatible systems.
LRAM2 $00:4000 $00:7BFF 15KiB Lower RAM region 2.
BOOT $00:7C00 $00:7DFF 512 bytes
Relocation target address for boot sector copied from floppy or hard disk by PC/XT and later BIOS routines.
LRAM3 $00:7E00 $00:7FFF 512 bytes
Lower RAM region 3. (Separated to round out with BOOT region.)
LRAM4 $00:8000 $00:FFFF 32KiB
Lower RAM region 4. This is a compatibility ledge: 64KiB of total RAM addressed so far is the limit of full-fat original IBM PCs sporting diskette drives.
LRAM5 $01:0000 $01:FFFF 64KiB
Lower RAM region 5. This is a compatibility ledge: 128KiB of total RAM addressed so far is the minimum that shipped with the IBM PC/XT.
LRAM6 $02:0000 $03:FFFF 128KiB
Lower RAM region 6. This is a compatibility ledge: 256KiB of total RAM addressed so far is the minimum that shipped with the IBM PC/AT.
LRAM7 $04:0000 $07:FFFF 256KiB
Lower RAM region 7. This is a compatibility ledge: 512KiB of total RAM addressed so far is the minimum that shipped with the IBM PS/2.
XDBA $08:0000 $09:FFFF 128KiB Extended BIOS data area.
VRAM $0A:0000 $0B:FFFF 128KiB Video display RAM.
VBIOS $0C:0000 $0C:7FFF 32KiB Video card BIOS. Also called the ‘VGA BIOS’.
URAM0 $0C:8000 $0C:FFFF 32KiB
Upper RAM region 0. This is reserved for use by the BIOS. (Separated to round out with VBIOS region.)
URAM1 $0D:0000 $0E:FFFF 128KiB
Upper RAM region 1. This is reserved for use by the BIOS.
BIOS $0F:0000 $0F:FFFF 64KiB Motherboard BIOS ROM.
HRAM0 $10:0000 $1F:FFFF 1MiB High RAM region 0.
HRAM1 $20:0000 $2F:FFFF 1MiB High RAM region 1.
HRAM2 $30:0000 $3F:FFFF 1MiB High RAM region 2.
HRAM3 $40:0000 $4F:FFFF 1MiB High RAM region 3.
HRAM4 $50:0000 $5F:FFFF 1MiB High RAM region 4.
HRAM5 $60:0000 $6F:FFFF 1MiB High RAM region 5.
HRAM6 $70:0000 $7F:FFFF 1MiB High RAM region 6.
HRAM7 $80:0000 $8F:FFFF 1MiB High RAM region 7.
HRAM8 $90:0000 $9F:FFFF 1MiB High RAM region 8.
HRAM9 $A0:0000 $AF:FFFF 1MiB High RAM region 9.
HRAM10 $B0:0000 $BF:FFFF 1MiB High RAM region 10.
HRAM11 $C0:0000 $CF:FFFF 1MiB High RAM region 11.
HRAM12 $D0:0000 $DF:FFFF 1MiB High RAM region 12.
HRAM13 $E0:0000 $EF:FFFF 1MiB High RAM region 13.
ISA $F0:0000 $FF:FFFF 1MiB
The ISA memory hole, reserved for memory-mapped I/O with ISA add-in cards.

Some notes about memory on the IBM-PC:

Mega Drive
Memory map, including 32X and CD peripherals
Ident 68000 mapping SH-2 mapping Size Description
Start End Start End
ROM0 $00:0000 $07:FFFF $0200:0000 $0207:FFFF 512KiB
Each comprise one bank of the active window to the ROM cartridge.
ROM1 $08:0000 $0F:FFFF $0208:0000 $020F:FFFF 512KiB
ROM2 $10:0000 $17:FFFF $0210:0000 $0217:FFFF 512KiB
ROM3 $18:0000 $1F:FFFF $0218:0000 $021F:FFFF 512KiB
ROM4 $20:0000 $27:FFFF $0220:0000 $0227:FFFF 512KiB
ROM5 $28:0000 $2F:FFFF $0228:0000 $022F:FFFF 512KiB
ROM6 $30:0000 $37:FFFF $0230:0000 $0237:FFFF 512KiB
ROM7 $38:0000 $3F:FFFF $0238:0000 $023F:FFFF 512KiB
FBRAM0 $84:0000 $85:FFFF $0400:0000 $0401:FFFF 128KiB 32X frame buffer.
FBRAM1 $86:0000 $87:FFFF $0402:0000 $0403:FFFF 128KiB 32X frame buffer (overwrite mode).
MROM0 $88:0000 $8F:FFFF 512KiB Bank 0 of 32X cartridge ROM data.
MROM1 $90:0000 $9F:FFFF 1MiB
32X-controlled switchable banks of 32X cartridge ROM data.
Z80RAM $A0:0000 $A0:1FFF 8KiB Working memory of the Z80 coprocessor.
$A0:2000 $A0:3FFF 8KiB Mirror of the Z80RAM region.
Z80IO $A0:4000 $A0:7FFF 16KiB Memory-mapped I/O ports for the Z80.
IO $A1:0000 $A1:7FFF 32KiB Memory-mapped I/O ports for the 68000.
VDP $C0:0000 $C0:001F 32 bytes
Memory-mapped I/O ports for interfacing with the VDP.
WRAM $FF:0000 $FF:FFFF 64KiB 68000 general-purpose working RAM.
Game Boy Advance
Memory map
Ident Start End Size
Description

Outgrowing MS-DOS

Sirius DOS must necessarily have humble beginnings. With Quindle as its editor, Oración as its assembler, Hinterlib as its kernel overlay, and the developmental quartet to orchestrate the development cycle, work can begin in realising the first new systems unique to Sirius DOS in contrast to other DOSes, contemporary and historical.

Prime and subprime ABIs

Sirius DOS will provide two distinct application binary interface minimums, the prime and subprime ABIs. The prime ABI is also further distinguished into the the single-wide prime ABI and the double-wide prime ABI, while the subprime ABI stands alone in its clade.

Prime ABI

In general, the prime ABI is a graphical interface for the ‘full fat’ Sirius DOS user experience. It provides 15-bit high colour support at the pel level directly to software, and supports up to three compatible displays simultaneously in this way (see below). Programs adhering to the prime ABI are written to operate in both ‘single-wide’ and ‘double-wide’ modes:

ISA requirements

Furthermore, the prime ABI requires (and thus provides), at a minimum, the full instruction set provided by the Intel 80486 and Intel 80387 together, excluding all instructions that are either used for switching to and from protected mode or are simply not usable in real mode.

Subprime ABI

The subprime ABI is a textual interface for the ‘low fat’ Sirius DOS user experience. It provides a single reversible unidirectional monochrome ASCII text stream as its interactive medium with the user. This stream is congruent with the standard C stdinstdout pair, notably excluding stderr (though there are mechanisms to get ahold of that otherwise).

Input

The subprime textual stream provides three interactive input modes for submitting data into stdin:

  1. character-based input where one ASCII character at a time is (irreversibly) typed and consumed without buffering
  2. line-based input where a continuous stream of ASCII characters are consumed as a single contiguous line, allowing the user freedom to Backspace and re-type the content until Enter is pressed to submit it to the program
  3. page-based input where a continuous stream of ASCII characters including newlines are consumed as a single block, allowing the user freedom to Backspace and retype the content until they press Shift+Enter to submit the page to the program

The input methods also provide the ability to register transformation subroutines of combinatorial complexity at the primitive level, making it practical to do simple one-for-one transformations for things like password masking or choice rendering of [Y/N/Q]-type user prompts.

Output

Output is always permanent and linear, and is modelled to be one of the three possible states the shell rendering loop can be in (the others being input and idle). Only printable ASCII characters and the non-printable control codes BEL and LF are permitted to be sent.


All of these design restrictions help to minimise incompatibility and improve the consistency of the user experience across many platforms and conforming applications.

ISA requirements

Unlike the prime ABI—which expects at least an i486—the subprime ABI is more forgiving, only mandating the full instruction set as provided by the Intel 80286 and Intel 80287 together. Like the prime ABI, the subprime ABI also excludes all instructions that are either used for switching to and from protected mode or are simply not usable in real mode.

Multi-monitor support

While much development happens in a DOSBox-X session, Sirius DOS is not an apocryphal development; therefore, stretching its legs involves taking advantage of hardware features provided by some of the components it will commonly come to employ even though they may not have been widely used contemporarily or even implemented in virtual environments such as DOSBox. True multi-monitor support—that is, using multiple displays independently to increase the sum of one’s total screen real estate—is one such feature.

Many SKUs in Cirrus Logic’s popular line of 2D ‘Windows accelerator’ ISA and PCI cards provide the ability to relocate the card’s VGA registers from their original IBM-standard location. This essentially makes it practical to control and feed more than one such video card at the same time. This feature is not to be confused with the CGA–Hercules ‘dual monitor’ configuration, as each monitor–card pair is fully equipped, however a similar user experience to it is often constructed anyway.

Revisiting modularity

One of the big concepts in modern computing Sirius DOS gives a lot of thought to is that of software modularity in the context of binary formats for application code and data. While this was mostly an afterthought left to application developers, there were some trends that persisted somewhat for their obvious virtue; for example, many code blobs had a file extension bearing the x86 variant they expected to be run on, most often .386 for ‘32-bit capable’ code. Also considered are the various strategies—now considered antique or even downright novel— for code reuse and what would later become known as ‘dynamic linking’, such as the technique of overlays.

To start with, Sirius DOS takes the toolset of software modular memory as a premise in how it approaches the subdivision of data (including code treated as such). In general, regardless of the underlying architecture, Sirius DOS handles prime ABI code blobs with the .486 file extension and subprime ABI code blobs with the .286 file extension, with a catch-all .X86 file extension for brave souls.

These code blobs are not run or executed directly; instead, they are collated into a bill of lading that contains basic metadata needed to start up a fully-fledged application with all of its data collections and code modules. It is at the level of this bill of lading that dynamic loading of architecture-dependent code blobs can take place, constituting a simple sort of ‘fat binary’ provision in practise. It also means that regardless of architecture, a data module need only be named and filed once.

In general, all code blobs are nothing but pure, straight machine code with no adornments or sanctioned metadata included in-line whatsoever. Furthermore, they are all limited to 64 kibibytes in size, starting from offset 0 (in contrast to 0x100 offset of COM files). They are also required to be fully relocatable, meaning their instruction stream is not allowed to modify segment registers directly. Not to worry, though: Sirius DOS will provide a straightforward and performant way to accomplish just the same in a more intelligent way by adding no more than a single additional step.