Hello,
I am creating a program that writes a jump to a DMA and goes to a static location. And I was wondering 2 things:

First, if there is a cleaver way to do this in ASM?

or

If anyone know the reverse long jump formula so i can code my program to figure out the jump? I found the short jump formula (JMP_Address + 2 + Second_Byte_value = Next_Instruction_Address) off the Internet but found nothing about regular jumps.

Any help will be greatly appreciated, thanks for your time!
Posted on 2004-11-05 22:47:51 by Reagan Squad
What do you mean by "long" jump and "regular" jump?
Is it near 32-bit or far?
The definite way to find out what you are trying to achieve is to
read Intel manual vol. 2 - both in jmp entry and the appendix on op code.
Posted on 2004-11-06 00:59:13 by Starless
I mean not short, as in 5 bytes, not 2. Im going to be jumping very far away from the address.
Posted on 2004-11-06 01:05:32 by Reagan Squad

I found the short jump formula (JMP_Address + 2 + Second_Byte_value = Next_Instruction_Address) off the Internet but found nothing about regular jumps.

Any help will be greatly appreciated, thanks for your time!


did you actually think that it might be...

JMP_ADDRESS+5+second _DWORD_value = next_instruction_address?

e9 xx xx xx xx xx

va + xx xx xx xx + 5 (opcode length)

sorted
Posted on 2004-11-06 02:00:24 by evlncrn8
it is

e9 q

where q is a dword

q = target address - opcode address - 5

for example, if q is 0, a jmp will jump to the opcode right after it.
Posted on 2004-11-06 07:28:09 by lifewire
    BYTE 0E9h

DWORD DestinationAddress - StartAddress
StartAddress:

.
.
.

DestinationAddress:
    BYTE 0EBh

BYTE DestinationAddress - StartAddress
StartAddress:

.
.
.

DestinationAddress:
Posted on 2004-11-06 09:16:49 by bitRAKE
Thank you very much for the replys, works great, but i have a small problem with this...

Say i want to jump from c0ab6a4 to 10900, the dword should be: 57 52 F6 F3 but using this mothod i get: FFFFFFFFF3F65257. I know i could just - FFFFFFFFF00000000 and poke 3F65257E9 to c0ab6a4 but im having problems converting/storing values larger than &H7FFFFFFF(long) in VB. Any ideas there?

Also, how would i go about using that code you posted, that looks very nice.
Posted on 2004-11-06 13:19:50 by Reagan Squad
Just use the low dword - works for positive and negative. The code was just to show the calculation is relatively the same for byte and dword offsets. Sorry, I don't use VB enough to know the correct code - isn't a LONG 32 bits?
Posted on 2004-11-06 17:50:01 by bitRAKE