| | |
Two code snippets that should have the same effect but don't
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2009
Posts: 1
Reputation:
Solved Threads: 0
I think these two code snippets should have the same effect. The current code is
which works. I want to replace it with
but replacing my current code with this code has a different effect. Are these two snippets equivalent?
Assembly Syntax (Toggle Plain Text)
add esp, 36 pop esi sub esp, 40
Assembly Syntax (Toggle Plain Text)
mov esi, [esp + 36]
•
•
Join Date: Apr 2009
Posts: 39
Reputation:
Solved Threads: 5
No the first one is popping whatever is on the stack at that location, the second one is considering whatever is at that position in the stack to be a memory address and you're saying whatever is at that address copy it into esi.
Consider stepping through the code through a debugger.
Consider stepping through the code through a debugger.
Last edited by sysop_fb; Jun 10th, 2009 at 9:06 am.
Are you preserving ebx, esi, edi ? These three registers are to be protected in function calls.
Your two code snippets do load the same value from memory though!
In Win32 The Stack Selector SS:, Data Selector DS: and Extra Selector ES: are typically set the same from the application point of view. In the older 16-bit Operating systems, the 'Segment Registers' as they were called then were almost always different !
Your two code snippets do load the same value from memory though!
In Win32 The Stack Selector SS:, Data Selector DS: and Extra Selector ES: are typically set the same from the application point of view. In the older 16-bit Operating systems, the 'Segment Registers' as they were called then were almost always different !
![]() |
Similar Threads
- Code Snippets for whom? (DaniWeb Community Feedback)
- c code snippets (DaniWeb Community Feedback)
- Why are the Descriptions of Code Snippets in a Fixed Font? (DaniWeb Community Feedback)
- Perl in Code Snippets section? (DaniWeb Community Feedback)
- Blogs and Code Snippets sections :) (DaniWeb Community Feedback)
Other Threads in the Assembly Forum
- Previous Thread: new to assembly
- Next Thread: MIPS: Print array in columns (SPIM)
| Thread Tools | Search this Thread |
Tag cloud for Assembly





