Wheat Operating System (WheatOS)
- 13 Devlogs
- 30 Total hours
An Operating System with based on x86 for computers (might be AI-integrated)
An Operating System with based on x86 for computers (might be AI-integrated)
I got into protected mode in my stage 2 bootloader.
First, I have to enable the A20 line to give the computer permission to access more than 1MB memory.
Next, I write a part of code that informs the computer of the safe physical memory access range (tells the computer about memory areas)
Before switching to protected mode, the kernel has to know what memory areas is for what. That is why we have GDT to inform the kernel.
Finally, I enable protected mode through the register CR0.
I rebuilt the Stage 1 bootloader in a new way. It successfully loaded into the Stage 2 bootloader, but I didn’t fully develop the Stage 2 bootloader.
I made a new file named “disk.asm” to load data from the disk into memory. It will be used by both Stage 1 and 2 bootloaders.
Everything in Stage 1 is done. It only works for x86 machines that have a BIOS from 1998 or later because it supports the feature that my Stage 1 bootloader has (Int 0x13, AH=0x42).
I will work on the Stage 2 bootloader and load the machine into Long Mode (64-bit).
First of all is get the Real Mode setup.
After stage 1, I continue with stage 2, which will extend the memory limit, so the os can handle more complex tasks.
Surprisingly, I don’t know why it has an error.
disk_address_packet:
db 0x10
db 0
dw 1
dw 0x8000
dw 0x0000
dq 1
disk_error:
mov si, disk_error_message
call print_loop
jmp hang
ret
“disk_address_packet” and “disk_error” labels are to allow you to understand my screenshots more easily.
I just made a shortcut today, so it will help me later in this project.
I have added a PowerShell file to build a Binary file (.bin) and other files (.img, .vdi) from my main Assembly file (.asm).
& "C:\Program Files\NASM\nasm.exe" -f bin boot.asm -o boot.bin
del disk.img -ErrorAction SilentlyContinue
del disk.vdi -ErrorAction SilentlyContinue
$disk= New-Object byte[] (1474560)
[IO.File]::WriteAllBytes("disk.img", $disk)
$boot= [IO.File]::ReadAllBytes("boot.bin")
$disk= [IO.File]::ReadAllBytes("disk.img")
[Array]::Copy($boot, 0, $disk, 0, 512)
[IO.File]::WriteAllBytes("disk.img", $disk)
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" convertfromraw disk.img disk.vdi --format VDI
I finally get my operating system on a virtual machine and make it output some words
I am researching assembly programming and how hardware and software work together.