Skip to content
This repository was archived by the owner on Oct 11, 2021. It is now read-only.

Commit c628b5e

Browse files
committed
๐Ÿš€๐Ÿ’พ drippleMini
0 parents  commit c628b5e

16 files changed

+280
-0
lines changed

โ€ŽMakefileโ€Ž

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# $@ = target file
2+
# $< = first dependency
3+
# $^ = all dependencies
4+
5+
# First rule is the one executed when no parameters are fed to the Makefile
6+
all: run
7+
8+
# Notice how dependencies are built as needed
9+
kernel.bin: kernel_entry.o kernel.o
10+
/usr/local/i386elfgcc/bin/i386-elf-ld -o $@ -Ttext 0x1000 $^ --oformat binary
11+
12+
kernel_entry.o: kernel_entry.asm
13+
nasm $< -f elf -o $@
14+
15+
kernel.o: kernel.c
16+
/usr/local/i386elfgcc/bin/i386-elf-gcc -ffreestanding -c $< -o $@
17+
18+
# Rule to disassemble the kernel - may be useful to debug
19+
kernel.dis: kernel.bin
20+
ndisasm -b 32 $< > $@
21+
22+
bootsect.bin: bootsect.asm
23+
nasm $< -f bin -o $@
24+
25+
os-image.bin: bootsect.bin kernel.bin
26+
cat $^ > $@
27+
28+
run: os-image.bin
29+
qemu-system-i386 -fda $<
30+
31+
clean:
32+
rm *.bin *.o *.dis

โ€ŽREADME.mdโ€Ž

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# drippleMini OS
2+
3+
A 64 bit operating system made from scratch, using Assembly & C-lang to create kernels and other stuff.
4+
**Current version:** `1.0.0-public`
5+
6+
# Running Guide
7+
| :exclamation: This is very important |
8+
|-----------------------------------------|
9+
10+
### How can I create my own OS?
11+
One of the main GitHub repositories that helped me quite a lot is the [os-tutorial](https://github.com/cfenollosa/os-tutorial/) one, made by [cfenollosa](https://github.com/cfenollosa). It quite briefly explains what each commands are, in Assembly and how to use them; I also recommend learning the basics of Assembly.

โ€Žbin/bootsect.binโ€Ž

512 Bytes
Binary file not shown.

โ€Žbin/kernel.binโ€Ž

124 Bytes
Binary file not shown.

โ€Žbin/kernel.oโ€Ž

840 Bytes
Binary file not shown.

โ€Žbin/kernel_entry.oโ€Ž

480 Bytes
Binary file not shown.

โ€ŽdrippleOS.binโ€Ž

636 Bytes
Binary file not shown.

โ€Žos/32bit/gdt.asmโ€Ž

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
gdt_start:
2+
dd 0x0
3+
dd 0x0
4+
5+
gdt_code:
6+
dw 0xffff
7+
dw 0x0
8+
db 0x0
9+
db 10011010b
10+
db 11001111b
11+
db 0x0
12+
13+
gdt_data:
14+
dw 0xffff
15+
dw 0x0
16+
db 0x0
17+
db 10010010b
18+
db 11001111b
19+
db 0x0
20+
21+
gdt_end:
22+
23+
gdt_descriptor:
24+
dw gdt_end - gdt_start - 1
25+
dd gdt_start
26+
27+
CODE_SEG equ gdt_code - gdt_start
28+
DATA_SEG equ gdt_data - gdt_start

โ€Žos/32bit/print.asmโ€Ž

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[bits 32]
2+
3+
VIDEO_MEMORY equ 0xb8000
4+
WHITE_ON_BLACK equ 0x0f
5+
6+
print_str_pm:
7+
pusha
8+
mov edx, VIDEO_MEMORY
9+
10+
ps_pm_loop:
11+
mov al, [ebx]
12+
mov ah, WHITE_ON_BLACK
13+
14+
cmp al, 0
15+
je print_str_pm_done
16+
17+
mov [edx], ax
18+
add ebx, 1
19+
add edx, 2
20+
21+
jmp ps_pm_loop
22+
23+
print_str_pm_done:
24+
popa
25+
ret

โ€Žos/32bit/switch.asmโ€Ž

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[bits 16]
2+
switch_to_pm:
3+
cli
4+
lgdt [gdt_descriptor]
5+
mov eax, cr0
6+
or eax, 0x1
7+
mov cr0, eax
8+
jmp CODE_SEG:init_pm
9+
10+
[bits 32]
11+
init_pm:
12+
mov ax, DATA_SEG
13+
mov ds, ax
14+
mov ss, ax
15+
mov es, ax
16+
mov fs, ax
17+
mov gs, ax
18+
19+
mov ebp, 0x90000
20+
mov esp, ebp
21+
22+
call BEGIN_PM

0 commit comments

Comments
ย (0)