C ++ visual studio内联汇编抓取整数

问题描述:

我遇到的问题是我正在尝试将整数移动到EAX中,这样,



mov eax,5000



我需要一种方法来获取输入,'mov eax,val'。



使用十六进制编辑器查看时,它确实'mov eax,val'但是我需要完成的是字面上移动值,而不是包含值的地址。



我有什么试过:



int val;

cout<< 价值;

cin>> val



mov eax,val

The problem I'm having is I'm trying to move an integer into EAX like so,

mov eax,5000

I would need a way to grab the input, and 'mov eax, val'.

When viewing it with a hex editor, it does 'mov eax, val' BUT what I need to accomplish is literally moving the value, not the address containing the value.

What I have tried:

int val;
cout << "value";
cin >> val

mov eax, val

这样做。

This will do it.
int inputValue; // set from data received from user
__asm {  
   mov eax, inputValue
   
   ... remaining assembler code

}