8c7dfbb12def99dfd54c854923f0fcc260f4b91a
[com32] / src / startup.asm
1         bits 32
2         section .text
3
4 %include 'macros.inc'
5
6         extern main
7         extern _bss_start
8         extern _bss_end
9
10         global startup
11 startup:
12         ; clear .bss
13         mov eax, _bss_end
14         sub eax, _bss_start
15         test eax, eax
16         jz .nobss
17         mov ecx, eax
18         mov edi, _bss_start
19         xor eax, eax
20         shr ecx, 2
21         rep stosd
22 .nobss:
23
24         call main
25         cli     ; XXX
26
27 .waitkey:
28         in al, 64h
29         test al, 1
30         jz .waitkey
31         in al, 60h
32         ret
33
34 ;       global putchar
35 ;putchar:
36 ;       mov eax, [esp + 4]
37 ;       cmp al, 10
38 ;       jnz .nonl
39 ;       push eax
40 ;       mov al, 13
41 ;       SER_PUTCHAR
42 ;       pop eax
43 ;.nonl: SER_PUTCHAR
44 ;       ret
45
46         section .data
47         global boot_mem_map_size
48         global boot_mem_map
49         align 4
50 boot_mem_map_size dd 0
51 boot_mem_map times 128 db 0
52
53 ; vi:set ts=8 sts=8 sw=8 ft=nasm: