jordyOS
is a minimal, bootable operating system featuring a command-line shell, a calculator application, and a text editor with in-memory file support.
It’s written in x86 Assembly and C, and is built with an i686-elf cross-compiler toolchain. The OS runs in 16-bit real mode initially (via the bootloader), then switches to 32-bit protected mode where it executes a multitasking kernel.
Type: 32-bit x86 protected-mode kernel
Architecture: Cooperative multitasking with an in-memory file system
0x7C00
and jumps there0x0800
using BIOS interrupt 13h
0x0000:0800
to start executing the kernel0x0800
CLI
)0x08
)0x10
)CR0
0x08:protected_start
to enter full 32-bit modeDS
, SS
, etc. to 0x10
(data segment)ESP
to 0x9FC00
(kernel stack)kmain()
(now in 32-bit C)fs[]
)task_create(shell, sh_stack, size)
ctx_switch()
to jump to the shell tasktask_create()
sets up a fake stack:
0
s for EBP
, EBX
, ESI
, EDI
(callee-saved registers)tasks[i].sp
ctx_switch.asm
)push ebp
, ebx
, esi
, edi
)ESP
to the old task’s sp
ESP
pop edi
, esi
, ebx
, ebp
)RET
: jumps into the new task (starts running)yield
)tasks[]
that has a non-NULL
stackcur
index and calls ctx_switch()
sys_yield()
voluntarily to allow switchingsh>
promptcalc
→ launches calculator appedit
→ launches editor apphelp
, clear
, etc.task_create()
and gets its own stackapp_edit()
(Editor)new <file>
: creates a file bufferopen <file>
: loads file content from fs[]
edit
: enters live typing mode (ESC to exit)save [file]
: saves buffer to virtual file systemlist
: lists all virtual filesdelete <file>
: removes file from memoryquit
: exits the taskfs[]
of file structs:
in_use
flagsys_write_file(filename, buffer, size)
sys_read_file(filename, buffer, max_size)
sys_delete_file(filename)
sys_list_files(output_buffer, max_len)
sys_write(str)
: prints to screensys_getc()
: reads one keysys_yield()
: triggers task switchsys_exit_task()
: terminates current tasksys_read_file()
, sys_write_file()
, etc.: access virtual file systembootloader.asm
):
kernel.c
, kernel_entry.asm
, ctx_switch.asm
):
sys_write
, sys_getc
).sys_yield
, sys_exit_task
).sys_clear_screen
).sys_list_files
, sys_read_file
, sys_write_file
, sys_delete_file
).sh>
):
calc
: Launches the calculator application.edit
: Launches the text editor application.clear
(or cls
): Clears the terminal screen.help
: Displays available shell commands.app_calc
(Calculator):
calc>
).add
, sub
, mul
, div
.exit
or quit
command to return to the main shell.app_edit
(Text Editor):
edit#
or edit [filename]#
).new <filename>
: Create a new text file in memory.open <filename>
: Load an existing in-memory file.save [filename]
: Save the current text buffer to an in-memory file.list
: List all in-memory files.delete <filename>
: Remove an in-memory file.edit
command (within app_edit
) to add or modify text. Exit with ESC
.quit
: Exits the editor and returns to the main shell.jordyOS multitask w/ In-Memory FS
sh> help
Available commands:
calc - Run the calculator app
edit - Run the text editor app
clear - Clear the screen
help - Show this help message
sh> calc
Calculator App. Type 'exit' or 'quit' to close.
calc> add 10 5
15
calc> mul 3 7
21
calc> exit
Exiting calculator...
sh> edit
Editor v0.4 (In-Memory FS)
Commands: list, new <fn>, open <fn>, edit, save [fn], delete <fn>, quit
edit# new myfile.txt
New file 'myfile.txt' in buffer. Use 'edit', then 'save'.
edit [myfile.txt]# edit
--- Text Edit Mode (Press ESC to finish) ---
Hello world!
This is a test file.
--- Exiting Text Edit Mode ---
edit [myfile.txt]# save
File 'myfile.txt' saved (36 bytes).
edit [myfile.txt]# list
Files:
myfile.txt
edit [myfile.txt]# quit
Exiting editor...
sh> clear
$ brew install cdrkit
$ brew install cdrtools
$ brew install i686-elf-binutils i686-elf-gcc
$ brew install nasm qemu
$ make
$ make run