annotate kernel/kernel.c3 @ 353:b8ad45b3a573

Started with strings
author Windel Bouwman
date Sun, 09 Mar 2014 18:49:10 +0100
parents 899ae3aea803
children 5477e499b039
rev   line source
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
1 module kernel;
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
2
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
3 import memory;
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
4 import process;
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
5 import scheduler;
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
6 import arch;
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
7
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
8 // Main entry point of the kernel:
293
6aa721e7b10b Try to improve build sequence
Windel Bouwman
parents: 292
diff changeset
9 function void start()
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
10 {
353
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
11 arch.init();
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 308
diff changeset
12
353
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
13 print("Welcome to lcfos!");
308
2e7f55319858 Merged analyse into codegenerator
Windel Bouwman
parents: 301
diff changeset
14 process.init();
301
6753763d3bec merge codegen into ppci package
Windel Bouwman
parents: 296
diff changeset
15 //memory:init();
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
16
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
17
296
9417caea2eb3 Directorized some backend files
Windel Bouwman
parents: 295
diff changeset
18 //Process proc = new process:Process();
292
534b94b40aa8 Fixup reorganize
Windel Bouwman
parents: 283
diff changeset
19
296
9417caea2eb3 Directorized some backend files
Windel Bouwman
parents: 295
diff changeset
20 //scheduler:queue(proc);
340
c7cc54c0dfdf Test featurebranch
Windel Bouwman
parents: 308
diff changeset
21 while(true) {}
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
22 }
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
23
353
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
24 function int strlen(string txt)
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
25 {
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
26
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
27 }
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
28
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
29 function int getchar(string txt, int index)
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
30 {
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
31 if (index < strlen(txt))
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
32 {
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
33 }
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
34 }
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
35
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
36 function void print(string txt)
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
37 {
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
38 var int i;
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
39 i = 0;
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
40
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
41 while (i < strlen(txt))
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
42 {
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
43 arch.putc(getchar(txt, i));
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
44 i = i + 1;
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
45 }
b8ad45b3a573 Started with strings
Windel Bouwman
parents: 352
diff changeset
46 }
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
47
293
6aa721e7b10b Try to improve build sequence
Windel Bouwman
parents: 292
diff changeset
48 function void panic()
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
49 {
308
2e7f55319858 Merged analyse into codegenerator
Windel Bouwman
parents: 301
diff changeset
50 arch.halt();
283
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
51 }
c9781c73e7e2 Added first kernel files
Windel Bouwman
parents:
diff changeset
52