AngoLinux

80386 Programmer's Reference Manual -- Opcode ADD


ADD -- Add

OpcodeInstructionClocks DescriptionExample
04 ibaddb imm8,al 2 Add immediate byte to ALaddb $0x7f,%al
05 iwaddw imm16,ax 2 Add immediate word to AXaddw $0x7fff,%ax
05 idaddl imm32,eax 2 Add immediate dword to EAXaddl $0x7fffffff,%eax
80 /0 ibaddb imm8,r/m8 2/7 Add immediate byte to r/m byteaddb $0x7f,%dl
addb $0x7f,(%ebx,1)
addb $0x7f,m8(%ebx,1)
addb $0x7f,m8(%ebx,%ebp,1)
81 /0 iwaddw imm16,r/m16 2/7 Add immediate word to r/m wordaddw $0x7fff,%cx
addw $0x7fff,(%ebx,1)
addw $0x7fff,(%ebx,2)
addw $0x7fff,(%ebx,%ebp,1)
81 /0 idaddl imm32,r/m32 2/7 Add immediate dword to r/m dwordaddl $0x7fffffff,%ecx
addl $0x7fffffff,(%ebx,2)
addl $0x7fffffff,(%ebx,4)
addl $0x7fffffff,(%ebx,%ebp,1)
83 /0 ibaddw imm8,r/m16 2/7 Add sign-extended immediate byte to r/m wordaddw $0x7f,%cx
addw $0x7f,(%ebx,1)
addw $0x7f,(%ebx,2)
addw $0x7f,(%ebx,%ebp,1)
83 /0 ibaddl imm8,r/m32 2/7 Add sign-extended immediate byte to r/m dwordaddl $0x7f,%ecx
addl $0x7f,(%ebx,2)
addl $0x7f,(%ebx,4)
addl $0x7f,(%ebx,%ebp,1)
00 /raddb r8,r/m8 2/7 Add byte register to r/m byteaddb %bh,%dl
addb %bh,(%ebx,1)
addb %bh,m8(%ebx,1)
addb %bh,m8(%ebx,%ebp,1)
01 /raddw r16,r/m16 2/7 Add word register to r/m wordaddw %bx,%cx
addw %bx,(%ebx,1)
addw %bx,(%ebx,2)
addw %bx,(%ebx,%ebp,1)
01 /raddl r32,r/m32 2/7 Add dword register to r/m dwordaddl %ebx,%ecx
addl %ebx,(%ebx,2)
addl %ebx,(%ebx,4)
addl %ebx,(%ebx,%ebp,1)
02 /raddb r/m8,r8 2/6 Add r/m byte to byte registeraddb %dl,%bh
addb (%ebx,1),%bh
addb m8(%ebx,1),%bh
addb m8(%ebx,%ebp,1),%bh
03 /raddw r/m16,r16 2/6 Add r/m word to word registeraddw %cx,%bx
addw (%ebx,1),%bx
addw (%ebx,2),%bx
addw (%ebx,%ebp,1),%bx
03 /raddl r/m32,r32 2/6 Add r/m dword to dword registeraddl %ecx,%ebx
addl (%ebx,2),%ebx
addl (%ebx,4),%ebx
addl (%ebx,%ebp,1),%ebx

Operation




DEST := DEST + SRC;

Description

ADD performs an integer addition of the two operands (DEST and SRC). The result of the addition is assigned to the first operand (DEST), and the flags are set accordingly.

When an immediate byte is added to a word or doubleword operand, the immediate value is sign-extended to the size of the word or doubleword operand.

Flags Affected

OF, SF, ZF, AF, CF, and PF as described in Appendix C

Protected Mode Exceptions

#GP(0) if the result is in a nonwritable segment; #GP(0) for an illegal memory operand effective address in the CS, DS, ES, FS, or GS segments; #SS(0) for an illegal address in the SS segment; #PF(fault-code) for a page fault

Real Address Mode Exceptions

Interrupt 13 if any part of the operand would lie outside of the effective address space from 0 to 0FFFFH

Virtual 8086 Mode Exceptions

Same exceptions as in Real Address Mode; #PF(fault-code) for a page fault


[Home Page dell'ITIS "Fermi"] [80386 Programmer's Reference Manual Index] [Previous] [Next]