I created a program in C to generate a char* processedData.
I send to my assembly program and put it in a register:
mov edx, [ebp+12]
mov edi, edx
How can i write a char into it.
I know i need to
Write a char and inc edi… that in a loop.
But how can i write a char, i already have the value into another register.
But if i do mov edx, 49; char code i’ll lose the pointer.
I want to do something like
for(p=malloc(100*sizeof(char*)); p!=NULL;p++){
*p=//my char code
}
Assembly for linux (DEBIAN) x86
edxis the address of the destination of the char. That is,edxis a pointer to the location you want to write to. Therefore, do this:This might even work:
You say your character is already in some register. I assume it is an 8 bit register (
ah/al/bh/bl/ch/cl/dh/dl), in which case you can just do:The assembler can infer the size of the data
[edx]is pointing to in this case.I’m on Windows right now so this code is for VC++. It demonstrates copying a string:
If your assembler uses AT&T syntax, you’ll need to do some minor translation, but hopefully this points you in the right direction.