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?

概要

ilasmでstack machineやってみた。
練習問題やってみた。

練習問題

ilasmで関数を書け。

方針

  • 数値が倍になる関数baiを作る。

サンプルコード



.assembly bai {}
.method public static int32 bai(int32 n) {
.maxstack 3
	ldarg n
	dup
	add
	ret
}
.method public static void Main() {
.maxstack 3
.entrypoint
	ldstr "enter n: "
	call void [mscorlib]System.Console::Write(string)
	call string [mscorlib]System.Console::ReadLine()
	call int32 [mscorlib]System.Int32::Parse(string)
	call int32 bai(int32)
	call void [mscorlib] System.Console::WriteLine(int32)
	ret
}


実行結果

>bai
enter n: 10
20

以上

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?