summaryrefslogtreecommitdiffhomepage
path: root/example/mb1/entry.asm
diff options
context:
space:
mode:
Diffstat (limited to 'example/mb1/entry.asm')
-rw-r--r--example/mb1/entry.asm48
1 files changed, 48 insertions, 0 deletions
diff --git a/example/mb1/entry.asm b/example/mb1/entry.asm
new file mode 100644
index 0000000..8b8f47e
--- /dev/null
+++ b/example/mb1/entry.asm
@@ -0,0 +1,48 @@
+; MIT License, Copyright (c) 2021 Marvin Borner
+
+bits 32
+
+%define MULTIBOOT_MAGIC 0x1badb002
+%define MULTIBOOT_PAGE_ALIGN 0x1
+%define MULTIBOOT_MEMORY_INFO 0x2
+%define MULTIBOOT_VIDEO_MODE 0x4
+%define MULTIBOOT_FLAGS (MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_VIDEO_MODE)
+%define MULTIBOOT_CHECKSUM -(MULTIBOOT_MAGIC + MULTIBOOT_FLAGS)
+
+section .text
+align 4
+
+dd MULTIBOOT_MAGIC
+dd MULTIBOOT_FLAGS
+dd MULTIBOOT_CHECKSUM
+
+; MULTIBOOT_MEMORY_INFO
+dd 0x00000000
+dd 0x00000000
+dd 0x00000000
+dd 0x00000000
+dd 0x00000000
+
+; MULTIBOOT_VIDEO_MODE
+dd 0x00000000
+dd 1920
+dd 1200
+dd 32
+
+global boot_entry
+extern kernel_main
+boot_entry:
+ mov esp, stack_top
+ push esp
+ push ebx
+ push eax
+ cli
+ call kernel_main
+ hlt
+ jmp $
+
+section .bss
+align 32
+stack_bottom:
+ resb 0x4000
+stack_top: