显示标签为“X64-ASM”的博文。显示所有博文

2020年2月21日星期五

thumbnail

x64 Assembly Programming Tutorial 2 : Integer Data Types

x64 Assembly Programming Tutorial 2 : Integer Data Types



Integer Data Types

Type Bits Bytes C++ Type Signed other
Bit 1 - bit - -
Byte 8 1 char Yes -
Word 16 2 short Yes -
Double Word(dword) 32 4 int Yes -
quad word (qword) 64 8 long long Yes -
xmmword 128 16 - - SSE
ymmword 256 32 - - VAX

word: 2 byte
dword: 2 word, 4 byte
qword: 2 dword, 4 word, 8 byte
xmmword: 2 qword, 4 dword, 8 word, 16 byte
ymmword: 2 xmmword, 4 qword, 8 word, 32 byte
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.