works and returns to DOS on dosbox
[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         mov ebp, 12345678h
25         call main
26         cli     ; XXX
27
28 .waitkey:
29         in al, 64h
30         test al, 1
31         jz .waitkey
32         in al, 60h
33         retf
34
35 ;       global putchar
36 ;putchar:
37 ;       mov eax, [esp + 4]
38 ;       cmp al, 10
39 ;       jnz .nonl
40 ;       push eax
41 ;       mov al, 13
42 ;       SER_PUTCHAR
43 ;       pop eax
44 ;.nonl: SER_PUTCHAR
45 ;       ret
46
47         section .data
48         global boot_mem_map_size
49         global boot_mem_map
50         align 4
51 boot_mem_map_size dd 0
52 boot_mem_map times 128 db 0
53
54 ; vi:set ts=8 sts=8 sw=8 ft=nasm: