All Projects → Reloaded-Project → Reloaded.Assembler

Reloaded-Project / Reloaded.Assembler

Licence: LGPL-3.0 license
Minimal .NET wrapper around the simple, easy to use Flat Assembler written by Tomasz Grysztar. Supports both x64 and x86 development.

Programming Languages

C#
18002 projects
assembly
5116 projects

Projects that are alternatives of or similar to Reloaded.Assembler

fasm
flat assembler 1 - reconstructed source history
Stars: ✭ 187 (+1000%)
Mutual labels:  x86-64, x86, fasm
kasm
Assembler library for Kotlin
Stars: ✭ 40 (+135.29%)
Mutual labels:  x64, x86-64, x86
X86 Bare Metal Examples
Dozens of minimal operating systems to learn x86 system programming. Tested on Ubuntu 17.10 host in QEMU 2.10 and real hardware. Userland cheat at: https://github.com/cirosantilli/linux-kernel-module-cheat#userland-assembly ARM baremetal setup at: https://github.com/cirosantilli/linux-kernel-module-cheat#baremetal-setup 学习x86系统编程的数十个最小操作系统。 已在QE…
Stars: ✭ 3,985 (+23341.18%)
Mutual labels:  x64, x86-64, x86
profiler-api
The portable version of JetBrains profiler API for .NET Framework / .NET Core / .NET / .NET Standard / Mono
Stars: ✭ 21 (+23.53%)
Mutual labels:  x64, x86-64, x86
Inflame
User-mode Windows DLL injector written in Assembly language (FASM syntax) with WinAPI.
Stars: ✭ 63 (+270.59%)
Mutual labels:  x86-64, x86, fasm
x86-Assembly-Reverse-Engineering
🛠 Knowledge about the topic of x86 assembly & disassembly 🛠
Stars: ✭ 27 (+58.82%)
Mutual labels:  x86-64, x86, x86-x64
Rappel
A linux-based assembly REPL for x86, amd64, armv7, and armv8
Stars: ✭ 818 (+4711.76%)
Mutual labels:  x64, x86-64, x86
Labeless
Labeless is a multipurpose IDA Pro plugin system for labels/comments synchronization with a debugger backend, with complex memory dumping and interactive Python scripting capabilities.
Stars: ✭ 378 (+2123.53%)
Mutual labels:  x64, x86-64, x86
X64dbg
An open-source x64/x32 debugger for windows.
Stars: ✭ 37,825 (+222400%)
Mutual labels:  x64, x86-64, x86
Beelzebub
The Lord of Flies - A hobby operating system
Stars: ✭ 24 (+41.18%)
Mutual labels:  x64, x86-64, x86
Capstone.NET
.NET Core and .NET Framework binding for the Capstone Disassembly Framework
Stars: ✭ 108 (+535.29%)
Mutual labels:  x64, x86-64, x86
Asm Cli
Interactive shell of assembly language(X86/X64) based on unicorn and keystone
Stars: ✭ 211 (+1141.18%)
Mutual labels:  x64, x86-64, x86
Distorm
Powerful Disassembler Library For x86/AMD64
Stars: ✭ 829 (+4776.47%)
Mutual labels:  x64, x86-64, x86
Asm
Assembly Tutorial for DOS
Stars: ✭ 125 (+635.29%)
Mutual labels:  x64, x86-64, x86
oberon-07-compiler
Oberon-07 compiler for x64 (Windows, Linux), x86 (Windows, Linux, KolibriOS), MSP430x{1,2}xx, STM32 Cortex-M3
Stars: ✭ 45 (+164.71%)
Mutual labels:  x64, x86-64, x86
FoxOS
The FoxOS main repository
Stars: ✭ 48 (+182.35%)
Mutual labels:  x64, x86-64
catsight
Cross-platform process memory inspector
Stars: ✭ 150 (+782.35%)
Mutual labels:  x64, x86-64
kar98k public
pwn & ctf tools for windows
Stars: ✭ 24 (+41.18%)
Mutual labels:  x64, x86
async
async is a tiny C++ header-only high-performance library for async calls handled by a thread-pool, which is built on top of an unbounded MPMC lock-free queue.
Stars: ✭ 25 (+47.06%)
Mutual labels:  x64, x86
pinktrace
Pink's Tracing Library
Stars: ✭ 20 (+17.65%)
Mutual labels:  x86-64, x86

Project Reloaded: Assembler Library



x86 Assembly is like IKEA Furniture

Coverage NuGet

Introduction

Reloaded.Assembler is a minimal .NET wrapper around the simple, easy to use Flat Assembler written by Tomasz Grysztar.

It combines the standard tried and tested FASM DLL and a and the recent experimental official FASMX64 DLL to provide JIT, on the fly assembly of user supplied mnemonics inside x86 and x64 programs.

Getting Started

To get started, install the package from NuGet and simply create a new instance of the Assembler class from the Reloaded.Assembler namespace:

var assembler = new Assembler();

And, uh... well... that's it.

From there you can call GetVersion() to retrieve the version of FASM assembler that the wrapper wraps around and assemble mnemonics with Assemble().

Example

var asm = new Assembler();
string[] mnemonics = new[]
{
    "use32",
    "jmp dword [0x123456]"
};
byte[] actual = asm.Assemble(mnemonics);
// Result: 0xFF, 0x25, 0x56, 0x34, 0x12, 0x00

Just don't forget to dispose the assembler when you're done 😉,

assembler.Dispose();

Small Tip

If the assembly operations fail, the wrapper library will throw an exception with a summary of the error.

You can obtain a slightly more detailed versions of the exceptions by catching them explicitly and checking their properties.

try { asm.Assemble(mnemonics); }
catch (FasmException ex)
{
    // Assembler result (e.g. Error, OutOfMemory) : ex.Result
    // Original text given to the assembler: ex.Mnemonics
    // Line of text error occured in: ex.Line
    // The error itself: ex.ErrorCode
}

Reloaded Assembler Compared to FASM.NET

Reloaded.Assembler is not the only standalone library that exposes FASM to the world of .NET. For a while now, there has been another wrapper worth mentioning willing to fulfill the same purpose.

Below is a quick list of differences you should expect when using Reloaded.Assembler as opposed to FASM.NET; and some of the reasons why I decided to write this library

Advantages

  • Does not require the Visual C++ Runtime to operate.
  • Can be used in both x64 and x86 applications vs only x86.
  • No memory allocation on each assembly request, reuses the same buffers resulting in better performance.

Other Differences

  • Reloaded.Assembler is written in pure C#, FASM.NET is written in C++/CLI.
  • Reloaded.Assembler has a slightly more minimal interface.

Misc Notes

Version 1.0.0 of the library uses custom modified FASMX64. (Official version at the time had a bug in DLLEntryPoint that prevented it from loading).

Version 1.0.1 and onward use the official FASMX64 DLL.

Other Links

Flat Assembler forums post : https://board.flatassembler.net/topic.php?p=207558#207558

This post briefly describes the changes I made to the experimental FASMX64 DLL for version 1.0.0 of this library that made it consumable from C# (and likely other high level languages).

Contributions

As with the standard for all of the Reloaded-Project, repositories; contributions are very welcome and encouraged.

Feel free to implement new features, make bug fixes or suggestions so long as they are accompanied by an issue with a clear description of the pull request 😉.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].