O.T. HEX code disassembly


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107

    Default O.T. HEX code disassembly

    I'm trying to understand a little machine code.

    I have a HEX file that reads

    80EFFEF0...

    The disassembly shows that is equivalent to

    GOTO 0x1fd00 - opcode EF80
    (next line) F0FE

    I understand a little about the reversed order of the bytes, so if I can
    see how "80EF" is actually 0xEF80, but I get stuck when I get to how
    the 0x1fd00 gets encoded into the HEX equivalent.

    Can someone tell me how to figure this out?
    Charles Linquist

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    GOTO is a two word instruction with the address embedded.

    With 80 EF FE F0 read from the .hex file you swap these around for
    EF 80 F0 FE.

    1st word 1110 1111 kkkk kkkk ' E F = instruction / 8 0 would be where the k's are
    2nd word 1111 kkkk kkkk kkkk ' F = instruction / 0 F E would be where the k's are

    kkkk in the above = the 20-bit address used by GOTO. The 2nd word
    address = the high 12-bits. The 1st word address = the lower 8-bits.

    0FE80 * 2 = 1FD00 which is the address to GOTO.

    Addresses in .hex files are normally 1/2 the actual value expected. To get the
    real address, multiply whatever you see in the .hex file * 2.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. Bootloader + Mainline code in single HEX file
    By dman776 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th May 2006, 22:59
  5. need hex code to make 12c509 a flip flop,
    By bruce3mn in forum General
    Replies: 1
    Last Post: - 15th November 2004, 03:23

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts