WOW

Shannen Durphey shannen at grolen.com
Wed Aug 1 05:09:30 GMT 2001


Bruce wrote:

> 
> I still have a hard time understanding why reassembling code is that much
> better then just using a binary editor. Bueller?, Bueller?......
> Cheers
> Bruce
> 

Ya, ok.
So you want to insert a jmp instruction.  You know where you want to place the
"jump to" in the code, so you search through the binary in your hex editor and
locate the place you want it.  Then you search through the binary some more and
find the location you want to jump to.  Then you count the number of bytes the
processor needs to skip in order to jump to the right location.  Then you need
to look at what type of jmp instruction you need to use, based on the number of
bytes you just counted and the way you're using the instruction.  Is the jmp an
extended or an indexed instruction?  After you determine what type of
instruction you're using you need to get the right number machine instruction. 
Once you get the right machine instruction you need to see how many bytes the
instruction takes up.  Now you've inserted the jump so you've "moved" all the
code after the newly placed jmp by 2 or 3 bytes.  So now you need to start
searching through the code to find every reference to an "exact" memory
location.  Since you've moved the code by 2 or 3 bytes to insert the jmp, all
the references to exact code addresses are now off by 2 or three bytes.  So you
need to go through the entire code and correct every one of those references,
since the processor will not do what you want it to do if it suddenly starts
executing the wrong bits of code.  After you go through and correct all the code
(and it can be a lot of code) you'll need to start the process all over again
when you need to insert another instruction.

Sometimes it's no big deal to remove a couple of instructions which you won't be
using and replace them with a new instruction, like a jmp.  In that case you
don't usually need to do as much checking.  Maybe you'll need to change a couple
of instructions close to where you inserted the new instruction.  Sometimes you
can jump to an area outside the code which is not used and insert some code
there along with a return instruction.  But often it's easier to do the work in
your assembly text file and let the compiler do all the tedious work of building
a binary for ya.

'Course this is just how I understand things as a newbie.  For real information,
visit a code Jedi near you.

Shannen

"Luke.  The Dark Side calls to you.  Listen!"
"The Dark Side?? All I hear is the sound of a Bosch K-jet."
----------------------------------------------------------------------------
To unsubscribe from gmecm, send "unsubscribe gmecm" (without the quotes)
in the body of a message (not the subject) to majordomo at lists.diy-efi.org




More information about the Gmecm mailing list