Re: Pushing IP *solved*
Posted: Tue Dec 09, 2008 10:01 am
Sorry everyone, "push $" just doesn't cut it. Why? Not because it isn't the best solution, but because it has absolutely nothing at all whatsoever to do with the question. The question was how to push IP, and while it is a very fine code, "push $" does not have anything to do with IP. It's all in your mind, as they say.
Of course, that was a very silly answer, but it was what the poster asked for.
With an added function to print_ip it even makes sense:No return mispredictions, and the code to print the ip becomes simple as well. Just "call print_ip".
The alternative would be to each time call a function to get the ip, then push it, then call the hex printing function. And definetely more fun than having to invent new label names all the time (or using up anonymous labels, so proper label names have to be invented elsewhere).
Very simple. "CALL address_of_hex_printing_function". The IP is now on top of the stack, ready to be accessed by your hex_printing_function.Troy Martin wrote:Sorry if this has been done to death, but how do you push IP to the stack so I can print it out using my hex printing function? I know you can't just use mov ax,ip.
Thanks,
Troy
Of course, that was a very silly answer, but it was what the poster asked for.
With an added function to print_ip it even makes sense:
Code: Select all
print_ip: ; no arguments
push [sp]
jmp hex_printing_function
The alternative would be to each time call a function to get the ip, then push it, then call the hex printing function. And definetely more fun than having to invent new label names all the time (or using up anonymous labels, so proper label names have to be invented elsewhere).