How to Jump to a memory address using ASM

Just starting out? Need help? Post your questions and find answers here.
A.I
User
User
Posts: 16
Joined: Wed Jul 27, 2005 2:09 pm
Location: Finland

How to Jump to a memory address using ASM

Post by A.I »

Anybody who have knowledge on ASM?

I'm looking for a method to continue program execution from a label. Basically, I'm trying to do 'Goto' in ASM. I know this is done via !JMP, but it's not that simple. I'd like to Jump to a memory address defined by a variable. Like this:

Code: Select all

address = ?label ; PureBasic variable

!JMP [_address]

    ;This line will never be executed
label:
    ;The execution continues here
I know there's an alternative method by using the 'GotoEIP()' command from the OnError-library. However, I wonder which is faster since 'GotoEIP' has some CALLs in the ASM output.
Specialized in "AI Programming Games".
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

Code: Select all

address = ?label ; PureBasic variable

!JMP [v_address]

MessageRequester("Test", "1")
    ;This line will never be executed
label:
    ;The execution continues here
MessageRequester("Test", "2")
You have forgotten the v at v_adress.
bye,
Daniel
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Notice you dont have to use the [v_value] unless you use the ! before.
A.I
User
User
Posts: 16
Joined: Wed Jul 27, 2005 2:09 pm
Location: Finland

Post by A.I »

What?! The answer was that simple. *put his hand on his forehead*

Thankyou very much.
Specialized in "AI Programming Games".
Post Reply