build multiple disk images, and console to vid & serial
[eightysix] / kern / src / startup.asm
1 ; second stage boot loader C startup
2         cpu 8086
3         bits 16
4         section .startup
5
6 ; memory reserved at the top of the kernel segment for the stack
7 STACKSZ equ 4096
8
9 extern kmain
10 extern _bss_start
11 extern _bss_size
12
13 global _start
14 _start:
15         ; TODO floppy off if necessary
16
17         ; move stack to the top of the kernel segment
18         xor ax, ax
19         mov sp, ax
20
21         mov ds, ax
22         mov es, ax
23         mov ss, ax
24
25         ; zero .bss
26         mov di, _bss_start
27         mov cx, _bss_size
28         shr cx, 1
29         rep stosw
30
31         call kmain
32
33 hang:   hlt
34         jmp hang
35
36 ; vi:set ts=8 sts=8 sw=8 ft=nasm: