conjunto de instrucciones
DESCRIPTION
ensambladorTRANSCRIPT
-
Data Transfer Instructions
MOV
Movebyteor wordXCHG
Exchangebyteor wordXLAT
TranslatebyteLEA
LoadeffectiveaddressLOS
LoadpointerusingOSLES
LoadpointerusingES
Addition Arithmetic InstructionsAOD
Addbyteor wordADC
Add byteor word withcarryINC
Incrementbyteor word by1AAA
ASCII adjustfor additionDAA
Decimaladjustfor addition
Subtraction Arithmetic InstructionsSUB
Subtractbyteor wordSBB
Subtractbyteor word with borrowDEC
Decrementbyteor word by1NEG
Negatebyteor wordDAS
Decimaladjustfor subtractionAAS
ASCII adjustfor subtractionCMP
Compareoperands
Mult. And Div. Arithmetic InstructionsMUL
Multiplybyteor word, unsignedDIV
Integerdividebyteor word, unsignedIMUL
Multiplybyteor word, signedIDlV
Integerdividebyteor word, signedAAM
ASCII adjustfor multiplyAAD
ASCII adjustfor divisionCBW
Convertbyteto wordCWD
Convertwordto doubleword
Logic InstructionsANO
"AND" byteor wordOR
Inclusive"OR" byteor wordXOR
Exclusive"OR" byteor wordNOT
Complementationor negationof byteor wordCMP
Compareword or byte
Shift and Rotate InstructionsSAL/SHL Shiftarithmetic/logicalleftbyteor wordSHR
Shift logicalrightbyteor wordSAR
Shiftarithmeticrightbyteor wordROL
Rotateleftbyteor wordROR
Rotaterightbyteor wordRCL
Rotateleftthroughcarry,byteor wordRCR
Rotaterightthroughcarry,byteor word
Flag ControllnstructionsLAHF
LoadAH registerfromflagsSAHF
StoreAH registerin flagsCLC
Clearcarryflag (CF)STC
Setcarryflag (CF)CMC
Complementcarryflag (CF)CL!
Clearinterruptenableflag (IF)STI
Set interruptenableflag (IF)
Figure A4.1 8088/8086 instruction set groupings.
170
Jump InstructionsJMP
Jump to short, nearor far addressJCC
Jump conditional(cc) to shortaddress
Subroutine-Handling/Stack instructionsCALL
Cal!procedureRET
Returnfrom procedurePUSH
Pop word ontostackPOP
Pop word off of stackPUSHF
Push flags ontostackPOPF
Pop flags off of stack
String InstructionsMOVS
Move byteor word stringMOVSB
Move bytestringMOVWS
Moveword stringCMPS
Comparebyteor word stringSCAS
Scan byteor word stringLOOS
Load byteor word stringSTOS
Store byteor word string
Pretixes and Auto-Indexing Instr. tor String OperationsREP
RepeatREPE/REPZ
Repeatwhilenot equal/zeroREPNE/REPNZ Repeatwhile notequal/notzeroCLD
Cleardirectionflag (DF)STO
Set directionflag (DF)
Loop InstructionsLOOP
LoopLOOPE/LOOPZ
Loop if equal/zeroLOOPE/LOOPZ
Loop if not equal/notzero
Input/Output InstructionsIN
Inputbyteor word from l/O spaceOUT
Outputbyteor word to l/O space
Interrupt InstructionsCL!
Clearinterruptenableflag (El)STI
Set interruptenableflag (El)INTn
SoftwareinterruptIRET
InterruptreturnINTO
Interrupt if overflowHLT
Haltuntil interruptor resetWAIT
Wait for TEST pin active
External Synchronization/No operationESC
Escapeto externalprocessorLOCK
Lock bus duringnextinstructionNOP
No operation
-
MnemonicMeaningFormatOperation Flags Affected
AOO
Addition AOO O, S(S) + (O) ->(O)OF. SF, ZF,AF, PF, CFCarry ->(CF)AOC
Add with carryAOC O, S(S) + (O) +(CF) ->(O)OF. SF. ZF,AF, PF, CF, Carry ->(CF)INC
Inerement by 1INC O(O) + 1 -> (O) OF. SF. ZF,AF, PF
AAA
ASCII adjust forAAA AF. CFaddition
OF. SF, ZF, PF undefined
OAA
Decimal adjust forOAA SF. ZF,AF, PF, CF,addition
OF, undefined
(a)
DestinationSource
Register
RegisterRegister
MemoryMemory
RegisterRegister
Immediate
Memory
ImmediateAeeumulator
Immediate
Destination
Reg16Reg8Memory
(b) (e)
Figure A4.2 (a) Addition instructions. (b) Allowed operands for ADD and ADC instructions. (e) Allowedoperands for INC instruction.
MnemonicMeaningFormatOperation Flags Affected
SUB
SubtraetSUB O,S(O) - (S) ->(O)OF, SF, ZF.AF. PF, CFBorrow -> (CF)SBB
Subtraet with borrowSBB O,S(O) - (S) - (CF) ->(O)OF. SF. ZF,AF, PF, CF
OEC
Oeerementby 1OEC O(O) - 1 -> (O) OF. SF. ZF,AF. PF
NEG
Negate NEG OO- (O) ->(O) OF, SF, ZF,AF, PF, CF1 -> (CF)DAS
Decimal adjust forDAS SF, ZF,AF, PF, CF,subtraetion
OF undefined
AAS
ASCII adjust forAAS AF, CFsubtraetion
OF, SF, ZF.PF undefined
(a)
DestinationSource
Register
RegisterRegister
MemoryMemory
RegisterAeeumulator
Immediate
Register
Immediate
Memory
Immediate
Destination
Reg16Reg8Memory
Destination
RegisterMemory
(b) (e) (d)
Figure A4.3 (a) Subtraction instructions. (b) Allowed operands for SUB and SBB instructions. (e) Allowedoperands for NEG instruction.
171
-
Mnemonic MeaningFormal
.
Operalion Flags Affecled
MUL
Multiply MULS(AL) . (S8) -->(AX)OF, CF(unsigned)
(AX) . (S16) -->(DX),(AX)SF, ZF,AF, PF undefinedDIV
Division DIV S(1) Q((AX)/(S8)) -->(AL)OF, SF, ZF,AF, PF, CF(unsigned)
R((AX)/(S8)) -->(AH)undefined
(2) Q((DX,AX)/(S16))--> (AX) R((DX,AX)/(S16)) -->(DX)If Q is FF16in case (1) orFFFF16in case (2), thenIype O interrupl occursIMULInteger multiplyIMULS(AL) . (S8) -. (AX)OF, CF
(signed)(AX) . (S16) -->(DX),(AX)SF, ZF,AF, PF undefined
IDIVInteger divideIDIV S(1) Q((AX)/(S8)) -->(AL)OF, SF, ZF,AF, PF, CF
(signed)R((AX)/(S8)) -->(AH)undefined
(2) Q((DX,AX)/(S16)) -->(AX) R((DX,AX)/(S16)) -->(DX)If Q is positive and exceeds7FFF16or if Q is negativeand becomes less than800116,then type O interruptoccursAAM
Adjust AL forAAMQ((AL)/10) -->(AH)SF, ZF, PFmultiplication
R((AU10) -->(AL)OF, AF, CF undefinedAAD
Adjust AX forAAD(AH) . 10 + (AL) -->(AL)SF, ZF, PFdivision
00 -->(AH)OF, AF, CF undefinedCBW
Convert bytetoCBW(MSB of AL) -->(Al! bits of AH)Noneword CWD
Convert word toCWD(MSB of AX) -->(Al! bits of DX)Nonedouble word
(a)
Source
Reg8Reg16Mem8Mem16
(b)
Figure A4.4 (a) Multiplication and division arithmetic instructions. (b) Allowed operands.
-
Mnemonic MeaningFormat "1Operation Flags Affected
ANO
logieal ANOANO O,S(S) (O) ----.(O)OF, SF, ZF, PF, CFAF undefinedOR
logieallnelusive-OROR O,S(S) + (O) ----.(O)OF, SF, ZF, PF, CFAF undefinedXOR
logieal Exelusive-ORXOR O,S(S) EB (O) ----.(O)OF, SF, ZF,PF, CFAF undefinedNOT
logieal NOTNOTO(O) ----.(O) None
(a)
DestinationSource
Register
RegisterRegister
MemoryMemory
RegisterRegister
Immediate
Memory
ImmediateAeeumulator
Immediate
(b)
Destination
RegisterMemory
(e)
Figure A4.5 (a) Logic instructions. (b) Allowed operands for the AND, OR, and XOR instructions. (e) Allowedoperands for NOT instruction.
Mnemonic MeaningFormatOperation Flags Affected
SAUSHl
Shift arithmetieSAUSHl O,CountShift the (O) left by the numberCF, PF, SF, ZFleft/shift
of bit positions equal to CountAF undefinedlogiealleft
and fill the vaeatedbits positionsOF undefined if eount ~ 1on the right with zerosSHR
Shift logiealSHR O,CountShift the (O) right by the numberCF, PF, SF, ZFright
of bit positions equal to CountAF undefined
and fill the vaeated bit positionsOF undefined if eount ~ 1
on the left with zerosSAR
Shift arithmetieSAR O, CountShift the (O) right by the numberSF, ZF, PF, CFright
of bit positions equal to CountAF undefinedand fill the vaeated bit positions
OF undefined if eount ~ 1on the left with the original most signifieant bit
(a)
DestinationCount
Register
1Register
Cl
Memory
1Memory
Cl
(b)
Figure A4.6 (a) Shift instructions. (b) Allowed operands.
-
MnemonicMeaningFormal
!Operalion Flags Affecled
ROL
Rolate leftROL O,CountRolale the (O) left by Ihe number of bitCF
positions equal to Count. Each bit
OF undefined
shifted out from the leftmost bit goes
if count of. 1
back into the rightmost bit position.RORRotate rightROR O,CountRotate the (O) right by the number of bitCF
positions equal to Count. Each bit shifted
OF undefined
out from the rightmost bit goes into
if count of. 1
the leftmost bit position.RCl
Rotate leftRClO,CountSame as ROL except carry is attachedtoCF
through carry
(O) for rotation.OF undefined
if count of. 1RCRRotate rightRCR O,CountSame as ROR except carry is attachedtoCF
through carry
(O) for rotation.OF undefined
if count of. 1
(a)
DeslinalionCounl
Register
1
Register
Cl
Memory
1
Memory
Cl
(b)
Figure A4.7 (a) Rotate instructions. (b) Allowed operands.
MnemonicMeaning OperalionFlags Affecled
lAHF
load AH from flags(AH) +- (Flags)None
SAHF
Store AH into flags(Flags)+-(AH)SF, ZF,AF, PF, CF
ClC
Clear carry flag(CF) +- OCF
STC
Set carry flag(CF) +-1CF
CMC
Complement carry flag(CF)+- (CF)CF
CL!
Clear interrupt flag(IF)+- OIF
STI
Set interruptflag(IF) +-1IF
AH
7
(a)
SF =SignflagZF =ZeroflagAF =AuxiliaryPF =ParityflagCF =Carry flag- =Undefined(donotuse)
(b)
o
Figure A4.8 (a) Flag-control instructions. (b) Format o, the AH register lor the lAHF and SAHF instructions.
174
-
Mnemonic Meaning
FormatOperation Flags Affected
CMP
CompareCMP D,S(O) - (S) is used in settingCF, AF, OF, PF, SF, ZFor resetting the flags
(a)
DestinationSource
Register
RegisterRegister
MemoryMemory
RegisterRegister
Immediate
Memory
ImmediateAccumulator
Immediate
(b)
Figure A4.9 (a) Compare instruction. (b) Allowed operands.
MnemonicMeaningFormatOperation Flags Affected
JMP
UnconditionalJMP OperandJump is initiatedto theNonejump
address specified by theoperand
(a)
Operands
Short-labelNear-IabelFar-Iabel
Memptr16Regptr16Memptr32
(b)
Figure A4.10 (a) Unconditional jump instruction. (b) Allowed operands.
-
Mnemonic
MeaningFormatOperation Flags Affected
Jcc
ConditionalJcc OperandIf the specified condition ccNone
jump
is true the jump to theaddress specified by theoperand is initiated;otherwise the nextinstruction is executed.
(a)
MnemonicMeaning Condition
JA
Above CF = Oand ZF = O
JAE
Above or equalCF = O
JB
Below CF = 1
JBE
Below or equalCF = 1 or ZF = 1
JC
Carry CF = 1
JCXZ
CX register is zero(CF or ZF) = O
JE
Equal ZF = 1
JG
Greater ZF = O and SF = OF
JGE
Greateror equalSF = OF
JL
Less (SF xor OF) = 1
JLE
Less or equal((SF xor OF) or ZF) = 1
JNA
Not above CF= 1 or ZF = 1
JNAE
Not above nor equalCF= 1
JNB
Not below CF = O
JNBE
Not below nor equalCF = Oand ZF = O
JNC
Not carry CF = O
JNE
Not equal ZF = O
JNG
Not greater ((SF xor OF) or ZF) = 1
JNGE
Not greater nor equal(SF xor OF) = 1
JNL
Not less SF = OF
JNLE
Not less nor equalZF = O and SF = OF
JNO
Not overflowOF = O
JNP
Not parity PF = O
JNS
Not sign SF = O
JNZ
Not zero ZF=O
JO
Overflow OF = 1
JP
Parity PF= 1
JPE
Parity even PF = 1
JPO
Parity odd PF = O
JS
Sign SF = 1
JZ
Zero ZF = 1
(b)
Figure A4.11 (a) Conditional jump instruction. (b) Types 01conditional jump instructions.
176
-
,Mnemonic Meaning
FormatOperation Flags Affected
CALL
Subroutine cal!CALL operandExecution continues fromNone
the address of the subroutine specified by the operandoInformation required to returnback to the main programsuch as IP and CS are savedon the stack.
(a)
Operand
Near-procFar-procMemptr16Regptr16Memptr32
(b)
Figure A4.12 (a) Subroutine call instruclion. (b) Allowed operands.
MnemonicMeaningFormal Operation Flags Affected
RET
ReturnRET or RET OperandReturn lo the main programNone
by restoring IP (and CS for far-proc). If Operand is present,it is added to the contents of SP.
(a)
Operand--None
Disp16
(b)
Figure A4.13 (a) Return instruction. (b) Allowed operands.
-
Mnemonic Meaning FormatOperation Flags Affected
PUSH
Push word onto stackPUSH S((SP))
-
MnemonicMeaningFormatOpilration Flags Affected
MOVS
Move stringMOVSB/MOVSW((ES)O + (01));-((OS)O +(SI))None(SI);- (SI) 1 or 2 (DI) ;- (DI) 1 or 2CMPS
Compare stringCMPSB/CMPSWSet flags as per CF, PF, AF, ZF,SF, OF
((OS)O + (St)) - ((ES)O +(DI)) (SI);- (SI) 1 or 2(DI) ;- (DI) 1 or 2SCAS
Sean stringSCASB/SCASWSet flags as per CF, PF, AF, ZF,SF, OF
(AL or AX) - ((ES)O + (DI)) (01);-(DI) 1 or 2LOOS
Load stringLOOSB/LOOSW(AL or AX);- ((OS)O +(SI))None
(SI);- (SI) 1 or 2STOS
Store stringSTOSB/STOSW((ES)O + (01));-(AL or AX) 1 or 2None(01);-(DI) 1 or 2
Figure A4.17 Basic string instructions
PrefixUsed withMeaning
REP
MOVSRepeatwhile not end of stringSTOS
CX*O
REPE/REPZ
CMPSRepeatwhile not end of stringSCAS
and strings are equalCX * O and ZF = 1
REPNE/REPNZ
CMPSRepeat while not end of stringSCAS
and strings are not equalCX * O and ZF = O
Figure A4.18 Prefixes for use with the basic string operations.
MnemonicMeaningFormatOperationFlags Affected
CLO
Clear OFCLO(OF);-OOF
STO
Set DFSTO(OF);-1OF
Figure A4.19 Instructions for selecting autoincrementing and
autodecrementingin string instructions.
-
MnemonicMeaning Format"Operation
IN
Input direct IN Acc,Port(Acc) +-(Port)ACC =AL or AX
Input indirect (variable)
IN Acc,DX(Acc) +- ((DX))
OUT
Output direct OUT Port,Acc(Port) +-(Acc)
Output indirect (variable)
OUT DX,Acc((DX)) +-(Acc)
Figure A4.20 Input/output instructions.
MnemonicMeaning FormatOperation Flags Affected
CL!
Clear interrupt flagCL!0-+ (IF) IF
STI
Set interruptflagSTI1 -+ (IF) IF
INT n
Type n software interruptINT n(Flags) -+ ((SP) - 2)TF,IF0-+ TF,IF (CS) -+ ((SP) - 4)(2 +4 . n) -+ (CS)(IP) -+ ((SP) - 6)(4 . n) -+ (IP)IRET
Interrupt return IRET((SP)) -+ (IP) Al!
((SP) +2) -+ (CS) ((SP) +4) -+ (Flags)(SP) +6 -+ (SP)INTO
Interrupt on overflowINTOINT 4 steps TF,IF
HLT
Halt HLTWait for an externalNone
interrupt or reset to occurWAIT
Wait WAITWait for TEST input toNone
go active
Figure A4.21 Interrupt instructions.