Intel x86 Programmer's Reference Manual? (HW)

Discussion in 'Mac Programming' started by ArtOfWarfare, Feb 3, 2013.

  1. ArtOfWarfare, Feb 3, 2013
    Last edited: Feb 3, 2013

    macrumors 604


    Nov 26, 2007
    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:

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

    I found this for Intel,

    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.
  2. macrumors 604

    Aug 9, 2009
    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.

Share This Page