PDA

View Full Version : O.T. HEX code disassembly



Charles Linquis
- 8th March 2007, 13:49
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?

Bruce
- 8th March 2007, 16:11
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.