aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/kernel.c
blob: 1fca95b7ac0c0acd7c0e1364fac041bc04b0a170 (plain)
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
#include "print.h"

#if defined(__linux__)
#error "Not using cross compiler!"
#endif

// Only works for 32 bit ix86 target
#if !defined(__i386__)
#error "Must use ix86-elf compiler"
#endif

void motd() {
    char *empty_row = "                                                        "
                      "                        \n";
    empty_row[0] = (char)186;
    empty_row[79] = (char)186;

    printf("%c", 201);
    for (int i = 0; i < 78; i++)
        printf("%c", 205);
    printf("%c\n", 187);

    printf(empty_row);

    printf("%c", 186);
    for (int i = 0; i < 78 / 2 - 17 / 2; i++)
        printf(" ");
    printf("Welcome to gftos!");
    for (int i = 0; i < 78 / 2 - 17 / 2 - 1; i++)
        printf(" ");
    printf("%c\n", 186);

    for (int i = 0; i < 21; i++) {
        printf(empty_row);
    }

    printf("%c", 200);
    for (int i = 0; i < 78; i++)
        printf("%c", 205);
    printf("%c", 188);
}

void kernel_main(void) {
    print_clear();
    motd();
    // for (int r = 0; r < 24; r++) {
    //     for (int c = 0; c < 80; c += 3) {
    //         int color = (r + c) % 15 + 1;
    //         print_set_color(color, PRINT_COLOR_BLACK);
    //         printf(":3");
    //     }
    //     printf("%n");
    // }
    // print_set_color(PRINT_COLOR_YELLOW, PRINT_COLOR_BLACK);
    // printf("printf\n\tint: %d\n\tstring: %s\n\tchar: %c\n\tpercent: "
    //        "%%\n\tnothing: %n",
    //        99, "World! ", 't');

    // printf("\n0x%d\n", *((int *)(0x0010)));
}