basic asm question

Programming, for all ages and all languages.
Post Reply
kemu

basic asm question

Post by kemu »

What is the difference between call and jmp they both execute a function ?
Also what does the push command do ?
Whatever5k

Re:basic asm question

Post by Whatever5k »

The instruction "jmp" just jumps to the specified address. "call" only calls it, that means it jumpts to it's address, and returns to the old address when a "ret" instruction is issued. This is managed by saving the EIP on the stack and loading EIP with the address to jump to. When the "ret" is issued, EIP is loaded with the value on the stack.
The "push" instruction copies a value on the stack, that is on the memory location of SS:ESP.
kemu

Re:basic asm question

Post by kemu »

You often use the word stack I'm not familair with that word
Whatever5k

Re:basic asm question

Post by Whatever5k »

Well, you'll really need to get familiar with it as a programmer. Have a google search.
Simply said, the stack is just a memory region where programs can store and retrieve variables for a short time. When calling a procedure, for example, you push() the parameters to the function on the stack and the function gets them by pop()ing them.
However, do a google search, that's really necessary.
Post Reply