C ++ visual studio内联汇编抓取整数 [英] C++ visual studio inline assembly grabbing integer

查看:120
本文介绍了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

}


这篇关于C ++ visual studio内联汇编抓取整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆