Click here to Skip to main content
15,898,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 20-Oct-18 22:26pm
Comments
Richard MacCutchan 20-Oct-18 4:24am    
The question does not make sense. Why are you mixing C++ with assembler, and what are you trying to achieve?
Member 14004556 20-Oct-18 17:05pm    
hard to explain, i would need to take the input from the user. so like if they typed "1234" id need it to go like 'mov eax,1234'

im not sure if thats possible
Richard MacCutchan 21-Oct-18 3:22am    
You take the input, and store it in a variable which you then mov to EAX. You cannot use a literal value here because you do not know the literal value at compile time. See below.
Having said that it is still not clear what actual problem you are trying to solve.

1 solution

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

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900