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?

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

Posted at

概要

wslで、kernel.elfのコンパイル、やってみた。
さらに、上のkernel見つけたので、コンパイルしてみた。
俺言語インタープリタを、移植してみた。
キー入力する機能を実装して、じゃんけん、やってみた。

写真

スクリーンショット 2024-03-31 082731.png

サンプルコード

void facto() {
	unsigned char cc;
	char ch;
	if (RD(Ptr) == '\0')
	{
		Val = 0;
		return;
	}
	if (getnm2())
		return;
	cc = RD(Ptr++);
	if (cc == '?')
	{
		putstr("> ");
		ch = api_getkey(1);
		if (ch == 0x31)
			Val = 1;
		else if (ch == 0x32)
			Val = 2;
		else if (ch == 0x33)
			Val = 3;
		else
			Val = 0;
	}
	else if (cc == '$')
	{
		Val = 55;
	}
	else if (cc == '!')
	{
		Val = _rand() % 3 + 1;
	}
	else
	{
		Ptr--;
		getvr2();
		Val = RD(Adr2);
		Ptr++;
	}
}

以上。

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?