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).