This repository has been archived on 2024-06-25. You can view files and clone it, but cannot push or open issues or pull requests.
rockOS/kernel/rockos/kernel.c

39 lines
991 B
C
Raw Normal View History

2022-07-20 02:23:23 +03:00
#include <stdio.h>
#include <rockos/tty.h>
2022-07-21 12:20:35 +03:00
#include <rockos/keyboard.h>
#include <rockos/pic.h>
#include <rockos/hal.h>
#include <rockos/timer.h>
2022-07-20 02:23:23 +03:00
void kernel_main(void) {
printf("Hello, kernel World!\n");
printf("String test: %s\n", "HELLOOOOO");
printf("Float test: %.10f\n", 0.123456789);
printf("Int test: %d\n", 747474);
printf("Hex test: 0x%x\n", 0xDEADBEEF);
printf("And now for 0.1 + 0.2...... which is: %.17f\n", 0.1 + 0.2);
2022-07-21 12:20:35 +03:00
initialize_keyset();
outb(0x70, (0x80 << 7) | 0x0); // Seconds
uint8_t sec = inb(0x71);
outb(0x70, (0x80 << 7) | 0x02); // Minutes
uint8_t min = inb(0x71);
outb(0x70, (0x80 << 7) | 0x04); // Hours
uint8_t hour = inb(0x71);
printf("Time: %x:%x:%x\n", hour, min, sec);
2022-07-20 02:23:23 +03:00
unsigned char oldkey;
unsigned char key = readkey();
for(;;){
oldkey = key;
key = readkey();
2022-07-21 12:20:35 +03:00
if (key != '\0') {
2022-07-20 02:23:23 +03:00
putchar(key);
2022-07-21 12:20:35 +03:00
}
2022-07-20 02:23:23 +03:00
}
asm("cli; hlt");
}