-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel.c
More file actions
53 lines (47 loc) · 860 Bytes
/
Copy pathkernel.c
File metadata and controls
53 lines (47 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
unsigned int i=0, j=0;
char * vidptr = (char*)0xb8000; //video memory begins here.
int linecount=0;
void clear ()
{
i=0;
/* This loop clears the screen*/
while (i < 80*25*2)
{
// insert blank character
vidptr[i] = ' ';
// attribute-byte : red on black screen
vidptr[i+1]=0x04;
i=i+2;
}
i=0;
}
void printf (const char* words)
{
//int linecount=0;
while (words[j]!='\0')
{
if (words[j]=='\n')
{
linecount++;
i=160*linecount;
j++;
}
/* the character's ascii*/
vidptr[i]=words[j];
/* attribute-byte: give character black bg and light grey fg*/
vidptr[i+1]=0x04;
++j;
i=i+2;
}
j=0;
}
void kernel_main()
{
const char *str = "Hello World \nWelcome to My First Kernel\n-Elix";
const char *str2 = "\nThis is a new function call \nI love this!!";
clear();
printf (str);
// clear();
printf (str2);
return;
}