Lets say I have a PROC in My assembly code like so:
.CODE
PROC myProc
MOV EAX, 00000001
MOV EBX, 00001101
RET
ENDP myProc
I want to MOV 1, into the EAX register, and move 13 into the EBX register in my procedure, however I want to create two variables local to my PROC, assigning var a the value of 1, and var b the value of 13, and from there MOVing [a] into EAX, and [b] into EBX. I have had many ideas about this before, perhaps creating space on the stack for the variables, or something like:
.CODE
PROC myProc
PUSH ESP
PUSH EBP
MOV ESP, 00000001
MOV EBP, 00001101
MOV EAX, [ESP]
MOV EBX, [EBP]
ENDP myProc
But this still really isn't dynamic variable creation, I am just writing and reading data back and forth between registers. So in essence I am trying to figure out how to create variable in assembly at run-time. I would appreciate any help.
mov eax, [001]is just going to fault on a bad address. I also don't see any register-to-register moves in your second example, so IDK what you think it does, but it's not "writing and reading data back and forth between registers." - Peter Cordessub esp,<size_of_temporary_space>, and beforeretyou restore theesp(releasing that space). In between you can address it through[esp+<0 .. size-1 offset>], although usually theebpis used for this. If you want huge (kiB -> MiB/GiB) dynamic memory space, check your API for heap allocation. "Variables" => call it whatever you wish, not important. - Ped7g