haker
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Starting on the Operating System 42

The answer to the life, the universe and everything.
The answer to the life, the universe and everything. (Courtesy of Fat Owl Tees.)

System 42

Considering that we are building a hacking simulator, our operating system should provide all the goodies we need, memory management, file system, networking, but without all the boring bits like memory/process protection, security etc. As I have been thinking of what we need, more and more it looks to me that System 42 will be a DOS like OS.

The initial goal for System 42 is to be able to provide these features:

  • console
  • file system
  • process control

This and addition of a modem, should give us everything we need to make a small network of computers, and thus first missions.

The progress on the System 42 will be documented in additional posts. You can also track individual items in the backlog and you can find the source code in the ‘/os’ directory in the download.

Console

On the console we need some basic functions like:

  • clear - clear screen
  • putch - output single character and move cursor
  • getch - get single key
  • print - print zero terminated string (no formatting)
  • printf - C like formatted print
  • println - move cursor to next line
  • readline - read input until enter is pressed
  • setpos - set cursor position

File System

Before file system can be implemented, a I will have to create a disk device. Look for a separate post that will talk about the disk.

The file system on top will be a simplified version of FAT 16.

The OS will provide low level disk routines:

  • readsector
  • writesector

And higher level ones:

  • create directory
  • delete directory
  • list files in directory
  • open file
  • close file
  • read from file
  • write to file
  • delete file

Process Control

Process control will be rather rudimentary. OS should be able to load an executable and pass execution control to it. When the process exits, the OS should recover the memory and be able to repeat the process again.

Possible stretch goal is for loaded programs to install interrupt handler and keep it resident in memory. This way we can have viruses.

Other then interrupt resident programs, no other facility for concurrency should be needed. While concurrency can be great, it is quite complicated to implement while it would not bring much in terms of fun.

Functions should be something like:

  • execute process
  • exit