Escolar Documentos
Profissional Documentos
Cultura Documentos
8086
8051
2. PUSH Reg
M
6.LHLD 16-bit
copies the contents of the
Address memory location pointed
1.MOV A,<scr>
copy the contents of
<dest>,A
source to destination.
<dest>,<scr>
( <scr>/<dest>:
DPTR,#data16 direct,@Ri,#data,Rn )
Example: MOV A,R3
MOV @R0,A
MOV R5,#32
MOV DPTR,#1234
2. MOVC A,@A+DPTR Moves the code byte
Relative to the DPTR
to the accumulator
(address=A+DPTR)
Example: MOVC A,@A+DPTR
DB 66h
DB 77h
DB 88h
DB 99h
Before execution
After execution
DPTR=1000
A=0
A=66h
A=1
A=77h
A=2
A=88h
A=3
A=99h
Note: DB (Define Byte) is a directive in
assembly language used to define constant.
3.MOVC A,@A+PC Moves the code byte
relative to the PC to the
accumulator
(address=A+PC)
7.STA 16-bit
Addr
Example: INC A
MOVC A,@A+PC
RET
DB 66h
DB 77h
DB 88h
DB 99h
After the subroutine "Table" has been
executed, one of four values is stored in the
accumulator:
Before execution
After execution
A=0
A=66h
A=1
A=77h
A=2
A=88h
A=3
A=99h
4.MOVX A,@Ri
Move the contents in the
A,@DPTR external RAM to the
@Ri,A
specified location or
@DPTR,A vice-versa.
Example: MOVX A,@R0
Register Address: SUM=12h
Before execution: SUM=58h R0=12h
After execution: A=58h
Note: SUM Register is stored in external RAM
which is 256 bytes in size.
5.PUSH direct Pushes the direct byte onto
the stack
Example: PUSH DPL
PUSH DPH
Before execution: Address Value
SP==> 030h 20h
register.
H: higher-order address
L: lower-order address
12.XTHL none contents of L register are
exchanged with the stack
location pointed out by SP.
Contents of H register are
exchanged with the next stack
location.
13.PCHL none contents of H-L pair are copied
into the program counter.
H: higher-order byte
L: lower-order byte
14.PUSH reg. contents of reg. pair
Pair designated are copied into
the stack.
15.POP reg.
pair
16.IN 8-bit
port
addr
ARITHMETIC INSTRUCTIONS:
1.ADD Reg Add the contents of register/
M memory to accumulator.
2.ADC Reg Add the contents of register/
M
memory & the Carry flag to
the contents of accumulator.
3.ADI 8-bit Add the 8-bit data to the
data contents of accumulator.
4.ACI 8-bit Add the 8-bit data and the Carry
data flag to accumulator.
5.DAD Reg. Add the 16-bit contents of the
pair specified register pair to the
contents of HL register.
6.SUB Reg Subtract the contents of register/
M memory from accumulator.
7.SBB Reg Subtract the contents of register/
M
memory & the Carry flag from
the contents of accumulator.
8.SUI 8-bit Subtract the 8-bit data from the
data contents of accumulator.
9.SBI 8-bit Subtract the 8-bit data and the
data Carry flag from accumulator.
10.INR Reg Increment the contents of
M register/memory by 1.
1. ADD A,Rn
A,direct
A,@Ri
A,#data
2. ADDC A,Rn
A,direct
A,@Ri
A,#data
3. SUBB A,Rn
A,direct
A,@Ri
A,#data
4.INC A
Rx
Rn
@Ri
DPTR
5.DEC A
Rx
Rn
@Ri
6.MUL AB
Multiply A and B.
7.DIV
Divide A by B.
AB
DAA
Before: AL=AEH,BL=35H
After : AL=14H,BL=35H
6.SUB Reg,Reg Subtract the contents of
Reg,M source with the contents of
M,Reg destination.
Reg,Imm
M,Imm
7.SBB Reg,Reg Subtract the contents of
Reg,M source from the contents of
M,Reg destination with borrow.
Reg,Imm
M,Imm
8.DEC Reg Decrement the contents of
M
register/memory by 1.
9.NEG Reg Change the sign of the specified
M byte or word by taking 2's
complement.
Example: AX = 2CBh
NEG AX ;after executing NEG result
AX =FD35h.
10.CMP Reg,Reg Compare specified bytes
Reg,M
or words.
M,Reg
Reg,Imm
M,Imm
11.AAS none ASCII(unpacked BCD) adjust
after subtraction.
Example: MOV AX,0901H ;BCD 91
SUB AL, 9 ;Minus 9
LOGICAL INSTRUCTIONS:
1.CMP Reg contents of register/memory are
M compared with that of
accumulator.
If (A)<(Reg/M):carry flag is set and zero flag
is reset.
If (A)=(Reg/M):Zero flag is set and carry flag
is reset.
If (A)>(Reg/M):carry & zero flags are reset.
LOGICAL INSTRUCTIONS:
1. ANL A,Rn
AND source with
A,direct
destination.
A,@Ri
A,#data
direct,A
direct,#data
Example: ANL MASK,C3H
Before execution: X = C3H (11000011)
MASK = 55H (01010101)
After execution: MASK = 41H (01000001)
2.AND Reg,Reg
Reg,M
M,Reg
Reg,Imm
M,Imm
2.CPI 8-bit
Data
3.ANA Reg
M
3.OR
Reg,Reg
Reg,M
M,Reg
Reg,Imm
M,Imm
4.XOR Reg,Reg
Reg,M
M,Reg
Reg,Imm
M,Imm
2. ORL A,Rn
OR source with
A,direct
destination.
A,@Ri
A,#data
direct,A
direct,#data
Example: ORL A,@R1
Register address: TEMP = FAH
Before execution: R1 = FAH
TEMP = C2H (11000010)
A = 54H (01010100)
After execution: A = D6H (11010110)
7.RLC A
BRANCHING INSTRUCTIONS:
1.JMP 16-bit Jump unconditionally. The
addr program sequence is transferred
to the memory location
specified by the 16-bit address.
2.Jx 16-bit address Jump unconditionally.
JC :Jump on Carry
CY=1
JNC:Jump on No Carry
CY=0
JP :Jump on Positive
S=0
JM :Jump on Minus
S=1
JPE:Jump on Parity Even
P=1
JPO:Jump on Parity Odd. P=0
JZ :Jump on Zero.
Z=1
JNZ:Jump on No Zero.
Z=0
3.CALL 16-bit Unconditional Subroutine Call.
addr The program sequence is
transferred to the memory
location specified by the 16-bit
1.JMP Disp16
Jump to the specified
Disp8
address to get the next
Reg
instruction for execution.
Mem
Offset 16,seg16
address.
4.Cx 16-bit address Conditional Call to
Subroutine.
CC : Call on Carry
CY=1
CNC: Call on No Carry
CY=0
CP : Call on Positive
S=0
CM : Call on Minus
S=1
CPE : Call on Parity Even P=1
CPO: Call on Parity Odd. P=0
CZ : Call on Zero.
Z=1
CNZ: Call on No Zero.
Z=0
5.RET none The program sequence is
transferred from the subroutine
to the calling program .
6.Rx none Return conditionally.
RC : Return on Carry
CY=1
RNC: Return on No Carry
CY=0
RP : Return on Positive
S=0
RM : Return on Minus
S=1
RPE : Return on Parity Even P=1
RPO: Return on Parity Odd. P=0
RZ : Return on Zero.
Z=1
RNZ: Return on No Zero.
Z=0
7.RST 0-7 Restart.Used to transfer program
execution to one of the 8 locations.
RST 0 0000H
RST 1 0008H
RST 2 0010H
RST 3 0018H
RST 4 0020H
RST 5 0028H
addr
RST 6
RST 7
0030H
0038H
CONTROL INSTRUCTIONS:
1.NOP none No operation.Used to fill in time
delays or to delete and insert
instructions while
troubleshooting.
2.HLT none Halt and enter wait state.
An interrupt or reset is necessary
to exit from the Halt state.
3.DI none Disable Interrupts.
STRING INSTRUCTIONS:
1.MOVSB/ none Move the byte or word
MOVSW
string from the data
segment to the extra
segment.
2.COMPS/ none Compare two string bytes
COMPW
or two string words.
3.SCASB/
SCASW
6.REP(prefix)
7.REPE/ REPZ
(prefix)
A - accumulator;
Rn - is one of working registers (R0-R7) in the currently active RAM memory bank;
Direct - is any 8-bit address register of RAM. It can be any general-purpose register or a SFR (I/O port, control register etc.);
@Ri - is indirect internal or external RAM location addressed by register R0 or R1;
#data - is an 8-bit constant included in instruction (0-255);
#data16 - is a 16-bit constant included as bytes 2 and 3 in instruction (0-65535);
addr16 - is a 16-bit address. May be anywhere within 64KB of program memory;
addr11 - is an 11-bit address. May be within the same 2KB page of program memory as the first byte of the following instruction;
rel - is the address of a close memory location (from -128 to +127 relative to the first byte of the following instruction). On the basis of it,
assembler computes the value to add or subtract from the number currently stored in the program counter;
bit - is any bit-addressable I/O pin, control or status bit; and
C - is carry flag of the status register (register PSW).