Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 925 Bytes

File metadata and controls

41 lines (30 loc) · 925 Bytes

AssemblySharp

C/C++ 의 __asm 혹은 __asm__ 키워드를 C#에서 최대한 비슷하게 구현해보려는 프로젝트입니다. 신택스는 Microsoft Macro Assembler (MASM)의 standard intel syntax 를 사용합니다. .Net core 2.1 에서 돌아갑니다

Usage

int a = 200;
int result = (int)X86Assembly.ExecuteScript(
    ASM.MOV, REG.EAX, 100,
    ASM.ADD, REG.EAX, a,
    ASM.RET);
Console.WriteLine(result); // 300
int i = 100;
result = X86Assembly.ExecuteScript(
    ASM.mov, REG.EAX, 0,
    ASM.mov, REG.ECX, i,
    new Label("myloop"),
    ASM.add, REG.EAX, REG.ECX,
    ASM.loop, "myloop",
    ASM.ret));
Console.WriteLine(result); // 5050

Requirements

gcc, objdump 가 설치되어 있고 환경변수에 추가되있어야 합니다.

The MIT License (MIT) Copyright (c) 2017 phillyai