概要
wslで、kernel.elfのコンパイル、やってみた。
さらに、上のkernel見つけたので、コンパイルしてみた。
コンソールにヘルプが無いので、作ってみた。
写真
サンプルコード
void cmd_help(struct CONSOLE * cons) {
cons_putstr0(cons, "mem - memory\n");
cons_putstr0(cons, "cls - clear console\n");
cons_putstr0(cons, "dir - file list\n");
cons_putstr0(cons, "type - print file\n");
cons_putstr0(cons, "exit - exit\n");
cons_putstr0(cons, "start - start\n");
cons_putstr0(cons, "ncst - ncst file\n");
cons_putstr0(cons, "langmode - langmode\n");
cons_putstr0(cons, "winhelo - Ore Gengo\n");
cons_putstr0(cons, "tview - tview file\n");
cons_putstr0(cons, "gview - gview file\n");
cons_newline(cons);
}
void cons_runcmd(char * cmdline, struct CONSOLE * cons, int * fat, unsigned int memtotal) {
//cons->shtを見ているのはコンソールがない場合は実行しなくていいから
if (_strcmp(cmdline, "mem") == 0 && cons->sht != 0)
cmd_mem(cons, memtotal);
else if (_strcmp(cmdline, "help") == 0 && cons->sht != 0)
cmd_help(cons);
else if (_strcmp(cmdline, "cls") == 0 && cons->sht != 0)
cmd_cls(cons);
else if (_strcmp(cmdline, "dir") == 0 && cons->sht != 0)
cmd_dir(cons);
else if (_strncmp(cmdline, "type ", 5) == 0 && cons->sht != 0)
cmd_type(cons, fat, cmdline);
else if (_strcmp(cmdline, "exit") == 0)
cmd_exit(cons, fat);
else if (_strncmp(cmdline, "start ", 6) == 0)
cmd_start(cons, cmdline, memtotal);
else if (_strncmp(cmdline, "ncst ", 5) == 0)
cmd_ncst(cons, cmdline, memtotal);
else if (_strncmp(cmdline, "langmode ", 9) == 0)
cmd_langmode(cons, cmdline);
else if (cmdline[0] != 0)
{
if (cmd_app(cons, fat, cmdline) == 0)
cons_putstr0(cons, "Bad Command.\n\n");
}
}
以上。