what did i miss about ebp?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sancho1980
Member
Member
Posts: 199
Joined: Fri Jul 13, 2007 6:37 am
Location: Stuttgart/Germany
Contact:

what did i miss about ebp?

Post by sancho1980 »

hi

i have a routine with a variable number of parameters
the number of parameters passed to the routine is fetched from within the routine via:

Code: Select all

mov([ebp+8],eax);
i.e., its the last parameter pushed

this still works fine. but then im trying to process the "real" parameters in a loop by loading ebp+12 into ebx and then adding 4 to ebx in each cycle. here i noticed the following strange behaviour:

Code: Select all

mov(ebp,ebx);
putunsint([ebp+12]);
putunsint([ebx+12]);
putunsint displays an unsigned integer as the name suggests...

the first putunsint statement shows me the correct value, i.,e. the value that i want to see
the second putunsint shows me something different! how can this be if ebp and ebx contain the same value (putunsint DOES preserve the ebx register!)

any clues?

thanks

martin
sancho1980
Member
Member
Posts: 199
Joined: Fri Jul 13, 2007 6:37 am
Location: Stuttgart/Germany
Contact:

Post by sancho1980 »

sorry for the stupid question

i had completely forgotten that i had loaded ss with a completely different segment than ds :-)
Post Reply