1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

wslで、最小のカーネルをコンパイル その29

Posted at

概要

wslで、kernel.elfのコンパイル、やってみた。
さらに、上のkernel見つけたので、コンパイルしてみた。
コンソールが小さいので、大きくしてみた。

写真

image.png

サンプルコード

struct SHEET * open_console(struct SHTCTL * shtctl, unsigned int memtotal) {
	struct MEMMAN * memman = (struct MEMMAN *) MEMMAN_ADDR;
	struct SHEET * sht;
	unsigned char * buf;
	sht = sheet_alloc(shtctl);
	buf = (unsigned char *) memman_alloc_4k(memman, 256 * 365);
	sheet_setbuf(sht, buf, 256, 365, -1);
	make_window8(buf, 256, 365, "console", 0);
	make_textbox8(sht, 8, 28, 240, 328, COL8_000000);
	sht->task = open_constask(sht, memtotal);
	sht->flags |= 0x20;
	return sht;
}


void cons_newline(struct CONSOLE * cons) {
	int x,
		y;
	struct SHEET * sheet = cons->sht;
	struct TASK * task = task_now();
	if (cons->cur_y < 28 + 320)
		cons->cur_y += 16;
	else
	{
		if (cons->sht != 0)
		{
			for (y = 28; y < 28 + 320; y++)
			{
				for (x = 8; x < 8 + 240; x++)
					sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize];
			}
			for (y = 28 + 320; y < 28 + 336; y++)
			{
				for (x = 8; x < 8 + 240; x++)
					sheet->buf[x + y * sheet->bxsize] = COL8_000000;
			}
			sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 336);
		}
	}
	cons->cur_x = 8;
	if (task->langmode == 1 && task->langbyte1 != 0)
		cons->cur_x += 8;
}


以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?