2
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やってみた。
日本語プログラミング言語のMindで、ilasmをコンパイル、実行してみた。

サンプルコード


出力ファイルは ファイル。

メインとは
「hello.il」で 出力ファイルを 新規オープンし
「.assembly hello {}」で 出力ファイルに 一行書き込み
「.method static void Main() cil managed {」で 出力ファイルに 一行書き込み
「	.entrypoint」で 出力ファイルに 一行書き込み
「	ldstr "Hello World!!"」で 出力ファイルに 一行書き込み
「	call void [mscorlib]System.Console::WriteLine(string)」で 出力ファイルに 一行書き込み
「	ret」で 出力ファイルに 一行書き込み
「}」で 出力ファイルに 一行書き込み
出力ファイルを クローズし
「C:\Windows\Microsoft.NET\Framework\v4.0.30319\ilasm hello.il」を プログラム実行
「hello」を プログラム実行
。


実行結果

>il0

Microsoft (R) .NET Framework IL Assembler.  Version 4.8.9105.0
Copyright (c) Microsoft Corporation.  All rights reserved.
Assembling 'hello.il'  to EXE --> 'hello.exe'
Source file is ANSI

hello.il(5) : warning : Reference to undeclared extern assembly 'mscorlib'. Attempting autodetect
Assembled global method Main
Creating PE file

Emitting classes:

Emitting fields and methods:
Global  Methods: 1;

Emitting events and properties:
Global
Writing PE file
Operation completed successfully
Hello World!!

以上

2
0
1

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
2
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?