The Aqua_Seven_OS Operating System

Zina Youhan
5 min readMay 15, 2019

For version 1.0.0 May 2019

This documentation explains how to build AquaSevenOS from source code and AquaSevenOS displays the hardware information.

Overview

Introduction

The AquaSevenOS kernel is written in 16-bit x86 real mode assembly language. This gives the information of the hardware.

Structure

source/.. contains the entire OS source code

source/bootload/.. — source to generate bootload.bin, which is added to the disk image when building

source/kernel.asm — The core kernel source file, which pulls in other source files and it includes source code which needs to display the hardware information.

programs/..— Source code for programs added to the disk image

Memory Map

This is the makeup of the 64KiB memory segment after AquaSevenOS has loaded:

Code Path

When the PC starts up, it loads the bootblock, bootload.bin that was inserted into the first sector (512 bytes) of the floppy disk image by the build script. It loads this at memory location 31744 (7C00h in hex) and begins executing it.

Bootload.bin then scans the floppy disk for kernel.bin and loads it at memory location 2000h:0000h. Here, the 2000h is the segment and 0000h is the offset in that segment — you don’t need to concern yourself with this, but effectively it means that the kernel is loaded at location 131072 (128KiB) in the PC’s RAM. (You get a complete memory location by multiplying the segment by 16 and adding the offset.)

Once the bootloader has loaded the kernel, it jumps to memory location 131072 (aka 2000h:0000h) to begin executing it. After this, for simplicity we ignore segments and just use offsets (0000h to FFFFh), thereby giving us 64KiB of RAM to use.

At the start of the kernel we have a series of jmp instructions. There’s a jmp just before these vectors to skip over them, and then the main kernel execution starts.

Building

Linux

I have used to build AquaSevenOS operating system using Linux.

Build requirements: the NASM assembler, dosfstools package, ‘mkisofs’ utility ,virtualbox and root access. We need root access because we loopback-mount the floppy disk image to insert our files.

To build AquaSevenOS, open a terminal and switch into the expanded AquaSevenOS package.

This will use NASM to assemble the bootloader, kernel and supplied programs, then write the bootloader to the aquasevenos.flp floppy disk image in the disk_images/ directory. (It writes the 512-byte bootloader to the first sector of the floppy disk image to create a boot sector and set up a DOS-like filesystem.) Next, the build script loopback-mounts the aquasevenos.flp image onto the filesystem — in other words, mounting the image as if it was a real floppy. The script copies over the kernel (kernel.bin) and binaries from the programs/ directory, before unmounting the floppy image.

With that done, the script runs the ‘mkisofs’ utility to generate a CD-ROM ISO image of AquaSevenOS, injecting the floppy image as a boot section. So we end up with two files in the disk_images/ directory: one for floppy disks and one for CD-Rs. You can now use them in an emulator or on a real PC as described in the Running section above.

Bootloader

When we power up the PC, all registers are blanked and microprocessor is set to reset state. Then the address 0xFFFF is loaded into the code segment and instruction present at the location is executed. Taking this fact into consideration the basic software called BIOS(Basic input and output system) is present at that location.So BIOS is execute as a result.

The BIOS will run a neccessary check for all memory for errors,connected devices -like serial ports, drives etc, and after completion of these system checks will search for the operating system,load it and execute it.

The BIOS will not load the complete operating system. It will just load a fragment of code in the first sector(boot-sector) of the floppy disk.

It scans the FAT12 floppy for kernel.bin, loads it and executes it. This must grow no larger than 512 bytes (one sector), with the final two bytes being the boot signature (AA55h). Note that in FAT12, a cluster is the same as a sector: 512 bytes.

This fragment of code that has to be present in the boot sector is the Bootloader.

You can find the source code by the following link.

Go to source/bootload/bootload.asm

Kernel

The kernel is a computer program that is the core of a computer’s operating system,with complete control over everything in the system.Kernel is one of the first programs loaded on start-up(after the bootloader).

You can find the source code by the following link.

Go to source/kernel.asm

In AquaSevenOS operating system, the source code for displaying hardware information is also included in kernel.asm

And the features of the operating system is included in souce/features/..

In kernel.asm each source code is explained using comments.And programs/aquadev.inc is described the system call vectors.

Booting

Disk images

After you have extracted the Aquaseven.zip file, switch into the disk_images/ directory and you’ll see three files:

Aquasevenos.flp — Floppy disk image containing AquasevenOS and programs

Aquasevenos.iso — CD ISO image built using the floppy disk image

So, these files are virtual disk images that you can write to real floppy disks or CD-Rs, or run in a PC emulator as described in a moment.In Linux, you can run build-linux.sh to make cd iso image.

Build-linux.sh

This script assembles the AquasevenOS bootloader, kernel and programs
with NASM, and then creates floppy and CD images (on Linux).Only the root user can mount the floppy disk image as a virtual drive (loopback mounting), in order to copy across the files.

Now you can run the iso image using virtualbox.

--

--