Tables for Opcode Documents Version 1.0 - Written by John Baldwin, 1996

1Help

2Tables

Each table will have a number.  Included in the heading of a table
declaration is a short description of the data in the table.  The
next line will describe the size of the data being tabled.  Afterwards
the table will be listed in either a straight table form, i.e. listing
each value on one side and it's meaning on the other, in a bit-wise
fashion, in which bits, or groups of bits are defined, or a combination
of the two.  After the table, any further notes may be appended.

1Tables

2Table 1 - Operand group in 16-bit segments.
Size: 2 bits

00 - 16-bit Memory Reference
01 - 16-bit Memory Reference with a byte displacement
10 - 16-bit Memory Reference with a word displacement
11 - Register

2Table 2 - Memory Reference operand in 16-bit segments.
Size: 3 bits

000 - [bx+si]
001 - [bx+di]
010 - [bp+si]
011 - [bp+di]
100 - [si]
101 - [di]
110 - [word offset]
111 - [bx]

*Note: if there is a word or byte offset added to the memory
 address, then the following code changes to:

110 - [bp+offset]

2Table 3 - 8-bit register operands.
Size: 3 bits

xxx
^^^
 Register:
        00 - al/h
        01 - cl/h
        10 - dl/h
        11 - bl/h
 Byte selector:
         0 - Low byte: E.g. AL
         1 - High byte: E.g. AH

2Table 4 - 16-bit register operands.
Size: 3 bits

000 - ax
001 - cx
010 - dx
011 - bx
100 - sp
101 - bp
110 - si
111 - di

2Table 5 - Two byte operands in 16-bit segments.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Second Operand   - Table 3
 Operand Group    - Table 1
      First Operand:
              Case Operand Group of
                 Memory Reference - Table 2
                 Register         - Table 3

2Table 6 - Two word operands in 16-bit segments.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Second Operand   - Table 4
 Operand Group    - Table 1
      First Operand:
              Case Operand Group of
                 Memory Reference - Table 2
                 Register         - Table 4

2Table 7 - One byte operand in 16-bit segments.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Operand Group    - Table 1
   First Operand:
           Case Operand Group of
              Memory Reference - Table 2
              Register         - Table 3
   Instruction Selector (see Instruction for definition)

2Table 8 - One word operand in 16-bit segments.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Operand Group    - Table 1
   First Operand:
           Case Operand Group of
              Memory Reference - Table 2
              Register         - Table 4
   Instruction Selector (see Instruction for definition)

2Table 9 - Condition bits
Size: 4 bits

0000 - o
0001 - no
0010 - b,nae
0011 - nb,ae
0100 - e,z
0101 - ne,nz
0110 - na,be
0111 - a,nbe
1000 - s
1001 - ns
1010 - p,pe
1011 - np,po
1100 - l,nge
1101 - nl,ge
1110 - ng,le
1111 - g,nle

2Table 10 - 32-bit register operands.
Size: 3 bits

000 - eax
001 - ecx
010 - edx
011 - ebx
100 - esp
101 - ebp
110 - esi
111 - edi

2Table 11 - Operand group in 32-bit segments.
Size: 2 bits

00 - 32-bit Memory Reference
01 - 32-bit Memory Reference with a byte displacement
10 - 32-bit Memory Reference with a dword displacement
11 - Register

2Table 12 - SIB byte Index
Size: 3 bits

000 - [eax]
001 - [ecx]
010 - [edx]
011 - [ebx]
100 - none
101 - [ebp]
110 - [esi]
111 - [edi]

2Table 13 - SIB byte Multiplier
Size: 2 bits

00 - *1
01 - *2
10 - *4
11 - *8

*Note: The index of a SIB is mulitplied by the "Mulitplier"th power of 2.
So a Mulitplier of 00 would multiply the index by 1, and a Multiplier
of 10 would multiply the index by 4.

2Table 14 - SIB byte Base Register
Size: 3 bits

000 - [eax]
001 - [ecx]
010 - [edx]
011 - [ebx]
100 - [esp]
101 - [dword offset]
110 - [esi]
111 - [edi]

*Note: If the Operand Group from the Modr/M byte is a Memory Reference
plus an 8-bit or 32-bit displacement, then the following code changes to:

101 - [ebp+offset]

2Table 15 - Memory Reference operand in SIB byte in 32-bit segments.
Size: 8 bits

xxxxxxxx
^^^^^^^^
 Base Register  - Table 14
 Index Register - Table 12
 Index Mulitiplier - Table 13

2Table 16 - Memory Reference operand in 32-bit segments.
Size: 3 bits

000 - [eax]
001 - [ecx]
010 - [edx]
011 - [ebx]
100 - use SIB - Table 15
101 - [dword offset]
110 - [esi]
111 - [edi]

*Note: If the Operand Group is a Memory Reference with an 8-bit or 32-bit
displacement, then the following code changes to:

101 - [ebp+offset]

2Table 17 - Two dword operands in 32-bit segments.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Second Operand - Table 10
 Operand Group  - Table 11
      First Operand:
              Case Operand Group of
                 Memory Reference - Table 16
                 Register         - Table 10

2Table 18 - One dword operand in 32-bit segments.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Operand Group  - Table 11
   First Operand:
           Case Operand Group of
              Memory Reference - Table 16
              Register         - Table 10
   Instruction Selector (see Instruction for definition)

2Table 19 - Two byte operands in 32-bit segments.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Second Operand   - Table 3
 Operand Group    - Table 11
      First Operand:
              Case Operand Group of
                 Memory Reference - Table 16
                 Register         - Table 3

2Table 20 - One byte operand in 32-bit segments.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Operand Group    - Table 11
   First Operand:
           Case Operand Group of
              Memory Reference - Table 16
              Register         - Table 3
   Instruction Selector (see Instruction for definition)

2Table 21 - Two (d)word operands.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Second Operand:
         Case OperandSize of
            16 - Table 4
            32 - Table 10
 Operand Group:
           Case AddressSize of
              16 - Table 1
              32 - Table 11
      First Operand:
              Case Operand Group of
                 Memory Reference:
                    Case AddressSize of
                       16 - Table 2
                       32 - Table 16
                 Register:
                    Case OperandSize of
                       16 - Table 4
                       32 - Table 10

2Table 22 - Two byte operands.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Second Operand - Table 3
 Operand Group:
           Case AddressSize of
              16 - Table 1
              32 - Table 11
      First Operand:
              Case Operand Group of
                 Memory Reference:
                    Case AddressSize of
                       16 - Table 2
                       32 - Table 16
                 Register - Table 3

2Table 23 - One (d)word operands.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Operand Group:
        Case AddressSize of
           16 - Table 1
           32 - Table 11
   First Operand:
           Case Operand Group of
              Memory Reference:
                 Case AddressSize of
                    16 - Table 2
                    32 - Table 16
              Register:
                 Case OperandSize of
                    16 - Table 4
                    32 - Table 10
   Instruction Selector (see Instruction for definition)

2Table 24 - One byte operand.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Operand Group:
        Case AddressSize of
           16 - Table 1
           32 - Table 11
   First Operand:
           Case Operand Group of
              Memory Reference:
                 Case AddressSize of
                    16 - Table 2
                    32 - Table 16
              Register - Table 3
   Instruction Selector (see Instruction for definition)

2Table 25 - Segment registers
Size: 3 bits

000 - es
001 - cs
010 - ss
011 - ds
100 - fs
101 - gs
11x - reserved for future segment registers (probably)

2Table 26 - One segment register and one word as operands.
Size: 8 bits

xxxxxxxx
^^^^^^^^

 Second Operand - Table 25
 Operand Group:
           Case AddressSize of
              16 - Table 1
              32 - Table 11
      First Operand:
              Case Operand Group of
                 Memory Reference - Table 2
                 Register         - Table 4
