49 lines
775 B
C
49 lines
775 B
C
unsigned short * textmemptr = (unsigned short *)0xB8000;
|
|
static void placech(unsigned char c, int x, int y, int attr) {
|
|
unsigned short *where;
|
|
unsigned att = attr << 8;
|
|
where = textmemptr + (y * 80 + x);
|
|
*where = c | att;
|
|
}
|
|
|
|
static int x = 0;
|
|
static int y = 0;
|
|
static void print(char * str) {
|
|
while (*str) {
|
|
if (*str == '\n') {
|
|
x = 0;
|
|
y += 1;
|
|
if (y == 24) {
|
|
y = 0;
|
|
}
|
|
} else {
|
|
placech(*str, x, y, 0x07);
|
|
x++;
|
|
if (x == 80) {
|
|
x = 0;
|
|
y += 1;
|
|
if (y == 24) {
|
|
y = 0;
|
|
}
|
|
}
|
|
}
|
|
str++;
|
|
}
|
|
}
|
|
|
|
static void clear() {
|
|
for (int y = 0; y < 24; ++y) {
|
|
for (int x = 0; x < 80; ++x) {
|
|
placech(' ', x, y, 0x00);
|
|
}
|
|
}
|
|
}
|
|
|
|
int kmain() {
|
|
clear();
|
|
print("ToaruOS-NIH Bootloader v0.1\n\n");
|
|
print("Doing stuff.\n");
|
|
|
|
while (1);
|
|
}
|