-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChaOSKernel.c
71 lines (63 loc) · 1.79 KB
/
ChaOSKernel.c
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* ChaOSKernel.h - Chaos kernel file
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-
* ShareAlike 3.0 Unported License. To view a copy of this license, visit
* http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to:
* Creative Commons
* 444 Castro Street, Suite 900
* Mountain View, California, 94041, USA.
*
* Author(s): Drew Cross <[email protected]>
*/
#include "ChaOSKernel.h"
void kmain( void* mbd, unsigned int magic )
{
if ( magic != 0x2BADB002 )
{
/* Something went not according to specs. Print an error */
/* message and halt, but do *not* rely on the multiboot */
/* data structure. */
}
/* (http://www.gnu.org/software/grub/manual/multiboot/multiboot.html#multiboot_002eh) */
char * boot_loader_name =(char*) ((long*)mbd)[16];
if(*boot_loader_name == " ")
{
//TODO what is boot loader name?
}
/* Print a letter to screen to see everything is working: */
/* Write your kernel here. */
char * welcome = "\tWelcome to ChaOS OS! \n123456789\n\0";
screen_clear();
int i;
screen_write(welcome);
}
//TODO: Test functionality
void kprint(char letter, int row, int col)
{
int lineWidth = 80;
//TODO: Prints each letter inputted to the correct locaiton on the screen
unsigned char *videoram = (unsigned char *) 0xb8000;
videoram[row * lineWidth * 2 + col * 2] = letter;
}
void kscroll()
{
//TODO: Scrolls all the characters up one removing the first line
}
//TODO: Doesn't clear the screen.
void kScreenClear()
{
int lineWidth = 80;
int numLines = 25;
int x = 0;
int y = 0;
while(x < lineWidth)
{
while(y < numLines)
{
kprint(' ', x, y);
y++;
}
y = 0;
x++;
}
}