annotate kernel.c @ 1:42ba76f77035 default tip

the kernel with output and mem alloc
author meillo@marmaro.de
date Sun, 01 Nov 2009 23:50:51 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
1 /* markus schnalke <meillo@marmaro.de> */
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
2
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
3 #include "io.h"
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
4 #include "mem.h"
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
5
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
6 void
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
7 kmain(void)
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
8 {
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
9 unsigned char* p;
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
10
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
11 cls();
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
12 printf("OS says: Hi!\n\n");
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
13
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
14 initmem(0x00400000); /* heap starts at 4MB */
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
15
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
16 printf("init done\n");
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
17 printf("\n");
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
18
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
19 p = malloc(28);
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
20 printf("allocated %d bytes at %p\n", 28, p);
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
21 p = malloc(15);
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
22 printf("allocated %d bytes at %p\n", 15, p);
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
23
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
24 printf("aa %d bb %c cc %s\n", 5, '@', "hallo");
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
25 printf("minmem: %p\n", 0x00400000);
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
26
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
27 setpos(24, 0);
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
28 printf("loop\n");
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
29 while (1) {
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
30 }
42ba76f77035 the kernel with output and mem alloc
meillo@marmaro.de
parents:
diff changeset
31 }