diff options
| author | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-10-05 08:56:38 -0700 |
|---|---|---|
| committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-10-05 08:58:29 -0700 |
| commit | 4d21315f667c03eaf44a580c3435f73853b53dbf (patch) | |
| tree | 881a6caabe9f289a7bc6e8ad9fd67279f4d09eba /src/boot.asm | |
| download | macaroni-4d21315f667c03eaf44a580c3435f73853b53dbf.tar.gz macaroni-4d21315f667c03eaf44a580c3435f73853b53dbf.zip | |
Init
Diffstat (limited to 'src/boot.asm')
| -rw-r--r-- | src/boot.asm | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/boot.asm b/src/boot.asm new file mode 100644 index 0000000..cbf57d6 --- /dev/null +++ b/src/boot.asm @@ -0,0 +1,31 @@ +;> The Multiboot header must be contained completely within the first 8192 bytes of the OS +;> image, and must be longword (32-bit) aligned. +MULTIBOOT_ALIGN_TO_PAGE: equ 1 << 0 +MULTIBOOT_MEMORY_DESCRIBE: equ 1 << 2 +MULTIBOOT_MAGIC: equ 0x1BADB002 +MULTIBOOT_FLAGS: equ (MULTIBOOT_ALIGN_TO_PAGE | MULTIBOOT_MEMORY_DESCRIBE) +MULTIBOOT_CHECKSUM: equ -(MULTIBOOT_MAGIC + MULTIBOOT_FLAGS) +section .multiboot_header +align 4 + dd MULTIBOOT_MAGIC + dd MULTIBOOT_FLAGS + dd MULTIBOOT_CHECKSUM + +STACK_SIZE: equ (1 << 14) +section .bss +align 16 +stack_bottom: + resb STACK_SIZE +stack_top: + +section .text +global _start:function (_start.end - _start) +_start: + mov esp, stack_top + extern cmain + call cmain + cli + +jmp $ + +.end: |
