;> 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 << 1 MULTIBOOT_VIDEO_MODE: equ 1 << 2 MULTIBOOT_MAGIC: equ 0x1BADB002 MULTIBOOT_FLAGS: equ (MULTIBOOT_ALIGN_TO_PAGE | MULTIBOOT_MEMORY_DESCRIBE | MULTIBOOT_VIDEO_MODE) MULTIBOOT_CHECKSUM: equ -(MULTIBOOT_MAGIC + MULTIBOOT_FLAGS) MULTIBOOT_VIDEO_TYPE: equ 0 MULTIBOOT_GODS_WIDTH: equ 640 MULTIBOOT_GODS_HEIGHT: equ 480 MULTIBOOT_VIDEO_BPP: equ 16 ; We don't set flags[16] because we assemble to ELF32 so header_addr, etc is useless to us ; (at least at the moment). UNUSED_BYTES_COUNT: equ 5*4 section .multiboot_header: ; I guess multiboot 2 requires a length field and we might migrate to that in the future. multiboot_header_start: align 4 dd MULTIBOOT_MAGIC dd MULTIBOOT_FLAGS dd MULTIBOOT_CHECKSUM times UNUSED_BYTES_COUNT db 0 dd MULTIBOOT_VIDEO_TYPE dd MULTIBOOT_GODS_WIDTH dd MULTIBOOT_GODS_HEIGHT dd MULTIBOOT_VIDEO_BPP multiboot_header_end: STACK_SIZE: equ (1 << 14) section .bss align 16 stack_bottom: ; ("haha bottom" somewhere in there??) 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: