2020年2月21日星期五

thumbnail

x64 Assembly Programming Tutorial 1 : Getting into x64 ASM from C++

x64 Assembly Programming Tutorial 1 : Getting into x64 ASM from C++




Setup x64 assembly programming in vs2010. The steps as following:
1) Create a empty visual c++ project;
2) Choose "Customize build" from project properties, select "MASM";
3) Add empty c++ source file named "code.asm" , write some code just as following:
.code

GetValueFromASM proc
    mov eax, 1234
    ret
GetValueFromASM endp

end

4) Add C++ source file, write some code like this:
#include 
using namespace std;

extern "C" int GetValueFromASM();

int main()
{
    cout << "ASM value: " << GetValueFromASM() << endl;

    int val;
    cin >> val;
    return 0;
}

5) build and run the progam.

Note: you need to set up MASM configure first before add any .asm source file. If you have some .asm file, then remove it and add it later.

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments