All Projects → akyoto → asm

akyoto / asm

Licence: MIT license
🏃 An x86-64 assembler written in Go.

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to asm

Ass Js
Assembler.js — X86_64 and Ethereum
Stars: ✭ 115 (+51.32%)
Mutual labels:  x86-64, asm
Rappel
A linux-based assembly REPL for x86, amd64, armv7, and armv8
Stars: ✭ 818 (+976.32%)
Mutual labels:  x86-64, asm
xorpd-solutions
[SPOILER ALERT] My attempt at tackling the x86_64 asm riddles in xorpd's xchg rax,rax book. Pull requests welcome.
Stars: ✭ 57 (-25%)
Mutual labels:  x86-64, asm
boot2flappy
Flappy Bird as bootable UEFI executable
Stars: ✭ 48 (-36.84%)
Mutual labels:  x86-64, asm
Asm Cli
Interactive shell of assembly language(X86/X64) based on unicorn and keystone
Stars: ✭ 211 (+177.63%)
Mutual labels:  x86-64, asm
Willos
💾 A minimal kernel (just a hobby, won't be big and professional). // Work In Progress
Stars: ✭ 163 (+114.47%)
Mutual labels:  x86-64, asm
The holy book of x86
A simple guide to x86 architecture, assembly, memory management, paging, segmentation, SMM, BIOS....
Stars: ✭ 577 (+659.21%)
Mutual labels:  x86-64, asm
Cyjon
A simple, clean code, multi-tasking operating system written in pure assembly language for 64-bit processors from the AMD64 family.
Stars: ✭ 184 (+142.11%)
Mutual labels:  x86-64, asm
kasm
Assembler library for Kotlin
Stars: ✭ 40 (-47.37%)
Mutual labels:  x86-64, asm
ArvernOS
💾 A minimal, experimental and "toy" monolithic kernel to learn about OS development // Work In Progress
Stars: ✭ 313 (+311.84%)
Mutual labels:  x86-64, asm
z80-sample-program
This is a small Z80 assembler program that just puts some colored lines on the ZX Spectrum's screen. The intention is to use this as a kind of tutorial for DeZog (Z80 debugger).
Stars: ✭ 14 (-81.58%)
Mutual labels:  asm
catsight
Cross-platform process memory inspector
Stars: ✭ 150 (+97.37%)
Mutual labels:  x86-64
CopyToAsm-Plugin-x86
CopyToAsm (x86) - A Plugin For x64dbg
Stars: ✭ 23 (-69.74%)
Mutual labels:  asm
creating-controls-in-assembler
Gitbook: https://mrfearless.gitbooks.io/creating-controls-in-assembler
Stars: ✭ 20 (-73.68%)
Mutual labels:  asm
cmake-nasm-test
Building a nasm hello world app with cmake
Stars: ✭ 18 (-76.32%)
Mutual labels:  asm
fp256
An efficient library for 256 bit integer arithmetic
Stars: ✭ 21 (-72.37%)
Mutual labels:  x86-64
kempe
Kempe is a compiled stack-based language
Stars: ✭ 54 (-28.95%)
Mutual labels:  x86-64
Onyx
UNIX-like operating system written in C and C++
Stars: ✭ 52 (-31.58%)
Mutual labels:  x86-64
DevSound
Game Boy sound driver
Stars: ✭ 48 (-36.84%)
Mutual labels:  asm
peekaboo
An standalone execution trace library built on DynamoRIO.
Stars: ✭ 17 (-77.63%)
Mutual labels:  x86-64

asm

Godoc Report Tests Coverage Sponsor

An x86-64 assembler written in Go. It is used by the Q programming language for machine code generation.

It was born out of the need for a highly performant assembler that had next to no overhead when compiling instructions to bytecode. When I started this project, I had no idea of how x86 instructions were constructed and I was forced to do a lot of reverse engineering via NASM.

Hopefully this repository helps someone who is learning about x86 assembly and its bytecode format.

There are a few examples to get an idea of the API I was aiming for.

x86-64 bytecode

An x86-64 program consists of a list of instructions. All of these instructions are built with the following format:

Name Size in bytes Required?
Legacy prefixes 1-4
OP code 1-4 required
Mod/RM 1
SIB 1
Displacement 1-8
Immediate 1-8

Out of these only the actual OP code which decides the instruction to execute is required. The remaining components depend on what instruction and what kind of parameters you have.

The maximum size for a single instruction is limited to 15 bytes.

Mod/RM

The Mod/RM byte has the following format:

Name Size in bits
Mod 2
Reg 3
RM 3
(mod << 6) | (reg << 3) | rm

SIB

The SIB byte has the same format as Mod/RM, just with different meanings:

Name Size in bits
Scale 2
Index 3
Base 3
(scale << 6) | (index << 3) | base

The opcode directory has a few helper functions to construct these components.

Registers

The following is a list of register names you can use. I decided to stick with the original names instead of r0-r7 for rax-rbp. I might still switch to r0-r7 for the future and enable the old names as synonyms.

64 bit 32 bit 16 bit 8 bit
rax eax ax al
rcx ecx cx cl
rdx edx dx dl
rbx ebx bx bl
rsi esi si sil
rdi edi di dil
rsp esp sp spl
rbp ebp bp bpl
r8 r8d r8w r8b
r9 r9d r9w r9b
r10 r10d r10w r10b
r11 r11d r11w r11b
r12 r12d r12w r12b
r13 r13d r13w r13b
r14 r14d r14w r14b
r15 r15d r15w r15b

Resources

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].