Hello, im a bit confused about ASM,
i just have a code, i want to add inside it some new instruction, but there isnt enough space for it....
how can i jump to the end of the app and execute it and jump back? is it possible?

i got:

000001: START CODE....
000002: free space for JMP instruction
000003: CONTINUE CODE....
000030: END OF CODE....free space for my new function to execute...

can i do it like this?

000001: START CODE....
000002: JMP 000030; END OF CODE
000003: CONTINUE CODE.... 
000030: test ecx, ecx
000030: JMP 000003 ;CONTINUE CODE

thanks

use a CALL instruction, it pushes down the current position into the stack

000001: START CODE....
000002: CALL 000030; END OF CODE
000003: CONTINUE CODE.... 
000030: test ecx, ecx
000030: ret ;Pop position off the stack and return to caller

Thank you! Gonna try it! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.