Skip to content
Alexander Elfimow edited this page Sep 11, 2018 · 10 revisions

Welcome to the cppasm wiki!

cppasm is a C++ generator for x86 assembly code.

Generated assembly source code syntax is: AT&T.

The Idea

The idea behind this generator is to encapsulate every instruction and CPU register in its own class. Every class name can be found in the Intel developer's manuals, e.g. imm8 class represents an 8-bit immediate value, m16 class represents a memory address of a 16-bit data word.

All instructions are implemented as function objects, e.g. instruction instance of MOV can be used like this:

#include "cppasm.h"

int main(int argc, char *argv[])
{
    MOV(EAX, EBX);

    return 0;
}

EAX and EBX are global instances of corresponding CPU registers and the output is simply (AT&T syntax):

    mov %ebx, %eax
Clone this wiki locally