Показаны сообщения с ярлыком ассемблер. Показать все сообщения
Показаны сообщения с ярлыком ассемблер. Показать все сообщения

Sang Cho. The Complete Pentium Instruction Set Table. 32 Bit Addressing Mode Only

               The Complete Pentium Instruction Set Table
                    (32 Bit Addressing Mode Only)
                            by Sang Cho

**********************************************
Explanation of the Notation used in this Table
**********************************************


 /digit -- A digit between 0 and 7 indicates that the ModR/M byte of the instruction uses
           only the r/m (register or memory) operand. The reg field contains the digit 
     that provides an extension to the instruction's opcode.
 /r     -- Indicates that the ModR/M byte of the instruction contains both a register operand 
           and an r/m operand.
 cb     -- A relative byte offset from the next instruction for JMP, CALL etc.
 cw     -- A relative word offset from the next instruciton for JMP, CALL etc.
 cd     -- A relative doubleword offset from the next instruction for JMP, CALL etc.
 cp     -- An absolute far pointer for JMP, CALL etc.                              
 ib, iw, id    
        -- 1-byte (ib), 2-byte (iw), or 4-byte (id) immediate operand 
 +rb, +rw, +rd     
        -- register code, from 0 through 7, added to  an  opcode byte.  
 
             rb     rw     rd
          ----------------------
           AL = 0 AX = 0 EAX = 0
           CL = 1 CX = 1 ECX = 1
           DL = 2 DX = 2 EDX = 2
           BL = 3 BX = 3 EBX = 3
           AH = 4 SP = 4 ESP = 4
           CH = 5 BP = 5 EBP = 5
           DH = 6 SI = 6 ESI = 6
           BH = 7 DI = 7 EDI = 7

 +i     -- A number used in floating-point instructions when one of the operands is ST(i) from
           the FPU register stack. 
 rel8   -- A relative address in the range from -128 to 127 bytes from the end of the instruction.
 rel16 and rel32    
        -- A relative address within the same code segment as the instruction assembled. 
 ptr16:16 and ptr16:32    
        -- A far pointer, typically in a code segment different from that of the instruction. 
 r8     -- One of the byte general-purpose registers.
 r16    -- One of the word general-purpose registers.
 r32    -- One of the doubleword general-purpose registers.
 imm8   -- An immediate byte value. 
 imm16  -- An immediate word value.  
 imm32  -- An immediate doubleword value. 
 r/m8   -- A byte general-purpose register, or a byte from memory.
 r/m16  -- A word general-purpose register, or a word memory operand. 
 r/m32  -- A doubleword general-purpose register, or a doubleword memory operand. 
 m      -- A 16- or 32-bit operand in memory.
 m8     -- A byte operand in memory,  pointed to by the DS:(E)SI or ES:(E)DI registers.  
           Used  with the string instructions and the XLAT instruction.
 m16    -- A word operand in memory, pointed to by the DS:(E)SI or ES:(E)DI registers. 
           Used  only with the string instructions.
 m32    -- A doubleword operand in memory, pointed to by the DS:(E)SI or ES:(E)DI registers. 
           Used only with the string instructions.
 m64    -- A memory quadword operand in memory. Used only with the CMPXCHG8B instruction.
 m16:16, m16:32    
        -- A memory operand containing a far pointer composed of two numbers.
           The number to the left of the colon corresponds to the pointer's segment selector. 
     The number to the right corresponds to its offset.
 m16&32, m16&16, m32&32    
        -- A memory operand consisting of data item pairs whose
           sizes are indicated on the left and the right side of the ampersand. 
     All memory addressing modes are allowed. The m16&16 and m32&32 operands are used 
     by the BOUND instruction to provide an operand containing an upper and lower bounds 
     for array indices. The m16&32 operand is used by LIDT and LGDT to provide 
     a word with which to load the limit field, and a doubleword with which to load 
     the base field of the corresponding GDTR and IDTR registers.
 moffs8, moffs16, moffs32    
        -- A simple memory variable (memory offset) of type byte,
           word, or doubleword used by some variants of the MOV instruction. 
     The actual address is given by a simple offset relative to the segment base. 
     No ModR/M byte is used in the instruction. The number shown with moffs indicates 
     its size, which is determined by the address-size attribute of the instruction.
 Sreg   -- A segment register. The segment register bit assignments are ES=0, CS=1, SS=2,
           DS=3, FS=4, and GS=5.
 m32real, m64real, m80real    
        -- A single-, double-, and extended-real floating-point operand in memory.
 m16int, m32int, m64int    
        -- A word-, short-, and long-integer floating-point operand in memory.
 ST or ST(0)    
        -- The top element of the FPU register stack.
 ST(i)  -- The i th element from the top of the FPU register stack. (i = 0 through 7)
 mm     -- An MMX register. The 64-bit MMX registers are: MM0 through MM7.
 mm/m32 -- The low order 32 bits of an MMX register or a 32-bit memory operand. 
 mm/m64 -- An MMX register or a 64-bit memory operand. 



Ассемблер. Инструкция lea

Команда lea используется для загрузки эффективного адреса. 

Например, если нам надо поместить в eax смещение массива Massiv для последующей работы с ним, то нужно написать так: lea eax, Massiv. Данная команда будет аналогична команде mov eax, offset Massiv. 

Также, если, например, необходимо получить адрес строки MsgText (предварительно объявленной так: "MsgText db "lalala",0", то можно написать: lea edx, MsgText. После этого в регистре edx окажется адрес, по которому хранится строка "lalala". 

Команду lea еще иногда используют для получения адреса какой-либо процедуры (например lea eax, ProcedureName). Иногда можно встретить, например, такое сочетание: lea ecx, dword ptr [edx+eax+01]. Для простоты скажу лишь, что эта команда приравняет ecx к edx+eax+1, т.е. после выполнения этой команды, ecx станет равным edx+eax+1. 

Аналогично, после выполнения команды "lea eax, dword ptr [ebx+ecx]", регистр eax станет равным ebx+ecx (eax = ebx + ecx). Ну вот вроде и все, что вам необходимо знать о команде lea для начала.

Отличие lea от mov состоит в том, что используется механизм блока адресации процессора, а не арифметико-логического блока.