; second stage boot loader C startup cpu 8086 bits 16 section .startup ; memory reserved at the top of RAM for the kernel stack STACKSZ equ 4096 extern kmain extern _bss_start_off extern _bss_size global _start _start: ; TODO floppy off if necessary ; move stack to the top of RAM (TODO: detect and avoid Ext. BIOS data area) mov ax, (0xa0000 - STACKSZ) >> 4 mov ss, ax mov sp, STACKSZ ; zero .bss mov di, _bss_start_off mov cx, _bss_size shr cx, 1 rep stosw xor ax, ax mov es, ax call kmain hang: hlt jmp hang ; vi:set ts=8 sts=8 sw=8 ft=nasm: