// Miscellaneous small programs // Author: xamidev // Licensed under the Unlicense. See the repo below. // https://github.com/xamidev/blankos #include "../libc/stdio.h" #include "../kernel/system.h" #include "../libc/string.h" #include "../drivers/framebuffer.h" #include "../drivers/ata.h" #include "../drivers/rtc.h" #include "../kernel/io.h" // Print a rainbow colorful text for testing #define BUF_SIZE 256 #define COLORS 20 void program_rainbow(int argc, char* argv[]) { if (argc < 2) { printf("Usage: %s \n", argv[0]); return; } char input_buffer[BUF_SIZE] = {0}; for (int i=1; i\n", argv[0]); } else if (argc == 2) { uint8_t buffer[512]; ata_read_sector(atoi(argv[1]), buffer); for (int i=0; i<512; i++) { if (i%50==0) puts("\n"); // hardcoded = bad printf("%02x ", buffer[i]); } puts("\n"); } else { puts("Invalid argument number\n"); } } // Reboots the machine (might just shutdown) void program_reboot() { puts("Rebooting...\n"); while(inb(0x64) & 0x02); outb(0x64, 0xFE); while (1) asm volatile("hlt"); }