Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
9,560
6,059
I need to pick out 4 x86 instructions and explain the encoding that is used with each one. It's suggested that I find "Intel's Programmer's Reference Manual" to do this with.

I had another similar problem for Sun SPARC where I found this was helpful:
http://www.sparc.com/standards/V8.pdf

Pages 90 and 91 gave a very concise explanation of various commands like ldsb, ld, ldd, and so on.

I found this for Intel,
http://download.intel.com/products/processor/manual/325462.pdf

I'm not sure if it's for the correct chip, and it seems to be anything but concise... I can't find anything in that manual that explains the encoding used for any instructions. Does anyone have a more helpful manual to look at (something that resembles the Sun SPARC manual I found, but for X86?)

Edit: Volume 1, Chapter 5 gives a list of instructions and brief explanations of what the instructions do, but then fails to explain the syntax that the person writing assembly code should use or the binary encoding that'll be used.
 
Last edited:

chown33

Moderator
Staff member
Aug 9, 2009
10,750
8,422
A sea of green
In that Intel doc, see Vol. 2, Ch. 2, Heading 2.1. The instruction-set encoding is insanely complex, with various prefixes and such, because it was gradually extended over a long period of time, from the original 8086. If you want something easier to decode, find a manual for the 8086.

I don't see a typical encoding table in the doc, probably because the instruction-set is too complex for that to be effective. Instead, I think you'll have to reverse-engineer a few instructions. The above Vol. 2, Sec 2.1 may be of use for understanding where things like addressing-mode field, operation field, operand size, etc. are placed. And some things are modal (an opcode may have different results in different modes).

Start by picking some of the basic operations, like ADC, ADD, AND. Look at the opcode byte. Figure out which bits change for each different operation, each addressing mode, etc. Once you have a basic pattern, look at other basic opcodes, like OR, SBB, SUB, XOR.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.