Скачиваний:
21
Добавлен:
03.06.2014
Размер:
307.73 Кб
Скачать

|

------------------------

|

-------------------------

|

-------------

|

-------------

|------------------------

 

 

|

-------

|---

|---

|

-------

|

|

 

|

 

|

DEST

| SOURCE

|

ASSEMBLY

|HEX

|B

|C

| PSW

|

|

MNEMONIC

|

OPERATION

|

ADDR

|

ADDR

|

LANGUAGE

|OP-

|Y

|Y

|C A O

|

|

 

|

 

|

MODE

|

MODE

|

 

FORM

|CODE

|T

|C

|F C V

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

DEC

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Decrement Operand

| DOper - 1 -> DOper

| Accumulator

|

 

| DEC

A

|

14

| 1

| 1

| - - - |

|

 

|

 

| Direct

|

 

| DEC

Daddr

|

15

| 2

| 1

|

 

|

|

 

|

 

| Indirect

|

 

| DEC

@Ri

| 16,17

| 1

| 1

|

 

|

|

 

|

 

| Register

|

 

| DEC

Rn

| 18-1F | 1

| 1

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

DIV

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Divide Accumulator by

| A / B -> A

|

AB

|

 

| DIV

AB

|

84

| 1

| 4

| 0 - * |

|

B Register

| Remainder -> B

|

 

|

 

|

 

 

|

 

|

|

|

see

|

|

 

|

 

|

 

|

 

|

 

 

|

 

|

|

| note 5|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

DJNZ

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Decrement Operand and

| DOper - 1 -> DOper

| Direct

|

 

| DJNZ

Daddr,Roff

|

D5

| 3

| 2

| - - - |

|

Jump Relative if Not

| If DOper <> 0 then Jump

| Register

|

 

| DJNZ

Rn,Roff

| D8-DF | 2

| 2

|

 

|

|

Zero

|

Relative to PC

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

INC

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Increment Operand

| DOper + 1 -> DOper

| Accumulator

|

 

| INC

A

|

04

| 1

| 1

| - - - |

|

 

|

 

| Direct

|

 

| INC

Daddr

|

05

| 2

| 1

|

 

|

|

 

|

 

| Indirect

|

 

| INC

@Ri

| 06,07

| 1

| 1

|

 

|

|

 

|

 

| Register

|

 

| INC

Rn

| 08-0F | 1

| 1

|

 

|

|

 

|

 

| Data Pointer|

 

| INC

DPTR

|

A3

| 1

| 2

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

| JB

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Jump Relative if Bit

| If DOper = 1 then Jump

| Bit Direct

|

 

| JB

 

Baddr,Roff

|

20

| 3

| 2

| - - - |

|

Operand is Set

|

Relative to PC

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

JBC

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Jump Relative if Bit

| If DOper = 1 then

| Bit Direct

|

 

| JBC

Baddr,Roff

|

10

| 3

| 2

| * * * |

|

Operand is Set and

|

0 - > DOper and Jump

|

 

|

 

|

 

 

|

 

|

|

|

see

|

|

Clear Bit Operand

|

Relative to PC

|

 

|

 

|

 

 

|

 

|

|

| note 6|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

4-6

|

------------------------

|

-------------------------

|

-------------

|

-------------

|------------------------

 

 

|

-------

|---

|---

|

-------

|

|

 

|

 

|

DEST

| SOURCE

|

ASSEMBLY

|HEX

|B

|C

|

PSW

|

|

MNEMONIC

|

OPERATION

|

ADDR

|

ADDR

|

LANGUAGE

|OP-

|Y

|Y

|C A O

|

|

 

|

 

|

MODE

|

MODE

|

 

FORM

|CODE

|T

|C

|F C V

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

| JC

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Jump Relative if

| If CF = 1 then Jump

| Carry Flag

|

 

| JC

 

Roff

|

40

| 2 | 2 |

- - - |

|

Carry Flag is Set

|

Relative to PC

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

JMP

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Jump Indirect

| DPTR<15:0> + A<7:0>

| Prog Indir

|

 

| JMP

@A+DPTR

|

73

| 1 | 2 |

- - - |

|

 

|

- > PC<15:0>

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

JNB

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Jump Relative if Bit

| If DOper = 0 then Jump

| Bit Direct

|

 

| JNB

Baddr,Roff

|

30

| 3 | 2 |

- - - |

|

Operand is Clear

|

Relative to PC

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

JNC

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Jump Relative if

| If CF = 0 then Jump

| Carry Flag

|

 

| JNC

Roff

|

50

| 2 | 2 |

- - - |

|

Carry Flag is Clear

|

Relative to PC

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

JNZ

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Jump Relative if the

| If A<7:0> <> 0 then

| Accumulator

|

 

| JNZ

Roff

|

70

| 2 | 2 |

- - - |

|

Accumulator is Not

|

Jump Relative to PC

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Zero

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

| JZ

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Jump Relative if the

| If A<7:0> = 0 then

| Accumulator

|

 

| JZ

 

Roff

|

60

| 2 | 2 |

- - - |

|

Accumulator is Zero

|

Jump Relative to PC

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

LCALL

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Long (16 bits) Call

| PC + 3 -> STACK

| Prog Direct

|

 

| LCALL Paddr

|

12

| 3 | 2 |

- - - |

|

 

| SP + 2 -> SP

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

 

| Paddr<15:0> -> PC<15:0>

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

LJMP

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Long (16 bits)

| Paddr<15:0> -> PC<15:0>

| Prog Direct

|

 

| LJMP

Paddr

|

02

| 3 | 2 |

- - - |

|

Absolute Jump

|

 

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

4-7

|

------------------------

|

-------------------------

|

-------------

|

-------------

|

------------------------

 

|

-------

|---

|---

|-------

|

|

 

|

 

|

DEST

|

SOURCE

|

ASSEMBLY

|HEX

|B

|C

| PSW

|

|

MNEMONIC

|

OPERATION

|

ADDR

|

ADDR

|

LANGUAGE

|OP-

|Y

|Y

|C A O

|

|

 

|

 

|

MODE

|

MODE

|

 

FORM

|CODE

|T

|C

|F C V

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

MOV

|

 

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Move Source Operand

| SOper -> DOper

| Accumulator

|

Immediate

| MOV

A,#data

|

74

| 2

| 1

| - - - |

|

to Destination

|

 

|

"

|

Direct

| MOV

A,Daddr

|

E5

| 2

| 1

|

|

|

Operand

|

 

|

"

|

Indirect

| MOV

A,@Ri

| E6,E7

| 1

| 1

|

|

|

 

|

 

|

"

|

Register

| MOV

A,Rn

| E8-EF | 1

| 1

|

|

|

 

|

 

| Direct

|

Accumulator

| MOV

Daddr,A

|

F5

| 2

| 1

|

|

|

 

|

 

|

"

|

Immediate

| MOV

Daddr,#data

|

75

| 3

| 2

|

|

|

 

|

 

|

"

|

Direct

| MOV

Daddr,Daddr

|

85

| 3

| 2

|

|

|

 

|

 

|

"

|

Indirect

| MOV

Daddr,@Ri

| 86,87

| 2

| 2

|

|

|

 

|

 

|

"

|

Register

| MOV

Daddr,Rn

| 88-8F | 2

| 2

|

|

|

 

|

 

| Indirect

|

Accumulator

| MOV

@Ri,A

| F6,F7

| 1

| 1

|

|

|

 

| SOper -> DOper

|

"

|

Immediate

| MOV

@Ri,#data

| 76,77

| 2

| 1

|

|

|

 

|

 

|

"

|

Direct

| MOV

@Ri,Daddr

| A6,A7

| 2

| 2

|

|

|

 

|

 

| Register

|

Accumulator

| MOV

Rn,A

| F8-FF | 1

| 1

|

|

|

 

|

 

|

"

|

Immediate

| MOV

Rn,#data

| 78-7F | 2

| 1

|

|

|

 

|

 

|

"

|

Direct

| MOV

Rn,Daddr

| A8-AF | 2

| 2

|

|

|

 

|

 

| Data Pointer|

Immediate

| MOV

DPTR,#data16

|

90

| 3

| 2

|

|

|

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

Move Carry Flag to Bit| CF -> DOper

| Bit Direct

|

Carry Flag

| MOV

Baddr,C

|

92

| 2

| 2

| - - - |

|

Destination Operand

|

 

|

 

|

 

|

 

 

|

 

|

|

|

|

|

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

Move Bit Destination

| DOper -> CF

| Carry Flag

|

Bit Direct

| MOV

C,Baddr

|

A2

| 2

| 1

| * - - |

|

Operand to Carry Flag |

 

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

MOVC

|

 

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Move byte from

| PM(DPTR<15:0> + A<7:0>)

| Accumulator

|

Prog Ind

| MOVC

A,@A+DPTR

|

93

| 1

| 2

| - - - |

|

Program Memory to

|

- > A<7:0>

|

 

|

 

|

 

 

|

 

|

|

|

|

|

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

 

| PM(PC<15:0> + A<7:0>)

| Accumulator

|

Prog Ind

| MOVC

A,@A+PC

|

83

| 1

| 2

| - - - |

|

 

|

- > A<7:0>

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

 

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

4-8

|

------------------------

|-------------------------

|

-------------

|

-------------

|

------------------------

 

|

-------

|---

|---

|-------

|

|

 

|

|

DEST

| SOURCE

|

ASSEMBLY

|HEX

|B

|C

| PSW

|

|

MNEMONIC

| OPERATION

|

ADDR

|

ADDR

|

LANGUAGE

|OP-

|Y

|Y

|C A O

|

|

 

|

|

MODE

|

MODE

|

 

FORM

|CODE

|T

|C

|F C V

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

MOVX

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Move byte from

| SOper -> A

| Accumulator

| Indirect

| MOVX

A,@Ri

| E2,E3

| 1

| 2

| - - - |

|

External Data Memory

|

|

"

|

"

| MOVX

A,@DPTR

|

E0

| 1

| 2

|

|

|

to the Accumulator

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

Move byte in the

| A -> DOper

| Indirect

| Accumulator

| MOVX

@Ri,A

| F2,F3

| 1

| 2

| - - - |

|

Accumulator to

|

|

"

|

"

| MOVX

@DPTR,A

|

F0

| 1

| 2

|

|

|

External Data Memory

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

MUL

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Multiply Accumulator

| A X B -> B,A

| AB

|

 

| MUL

AB

|

A4

| 1

| 4

| 0 - * |

|

by B Register

| (see note 7)

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

NOP

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

No Operation

|

|

 

|

 

| NOP

 

|

00

| 1

| 1

| - - - |

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

ORL

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Logical Inclusive OR

| SOper v DOper -> DOper

| Direct

| Accumulator

| ORL

Daddr,A

|

42

| 2

| 1

| - - - |

|

of Source Operand

|

|

"

| Immediate

| ORL

Daddr,#data

|

43

| 3

| 2

|

|

|

with Destination

|

| Accumulator

| Immediate

| ORL

A,#data

|

44

| 2

| 1

|

|

|

Operand

|

|

"

| Direct

| ORL

A,Daddr

|

45

| 2

| 1

|

|

|

 

|

|

"

| Indirect

| ORL

A,@Ri

| 46,47

| 1

| 1

|

|

|

 

|

|

"

| Register

| ORL

A,Rn

| 48-4F | 1

| 1

|

|

|

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

Logical Inclusive OR

| SOper v CF -> CF

| Carry Flag

| Bit Direct

| ORL

C,Baddr

|

72

| 2

| 2

| * - - |

|

of Source Operand

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

with Carry Flag

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

(continued)

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

4-9

|

------------------------

|-------------------------

|

-------------

|

-------------

|------------------------

 

 

|

-------

|---

|---

|

-------

|

|

 

|

|

DEST

| SOURCE

|

ASSEMBLY

|HEX

|B

|C

|

PSW

|

|

MNEMONIC

| OPERATION

|

ADDR

|

ADDR

|

LANGUAGE

|OP-

|Y

|Y

|C A O

|

|

 

|

|

MODE

|

MODE

|

 

FORM

|CODE

|T

|C

|F C V

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

ORL(continued)

|

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Logical Inclusive OR

| ~SOper v CF -> CF

| Carry Flag

| Bit Direct

| ORL

C,/Baddr

|

A0

| 2 | 2 |

* - - |

|

of Source Operand

|

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Complemented with

|

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Carry Flag

|

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

POP

|

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Pop Stack and Place

| STACK -> DOper

| Direct

| Stack

| POP

Daddr

|

D0

| 2 | 2 |

- - - |

|

in Destination Operand| SP - 1 -> SP

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

PUSH

|

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Push Source Operand

| SP + 1 -> SP

| Stack

| Direct

| PUSH

Daddr

|

C0

| 2 | 2 |

- - - |

|

onto Stack

| SOper -> STACK

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

RET

|

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Return from

| STACK -> PC<15:8>

|

 

|

 

| RET

 

|

22

| 1 | 2 |

- - - |

|

Subroutine

| SP - 1 -> SP

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

 

| STACK -> PC<7:0>

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

 

| SP - 1 -> SP

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

|

RETI

|

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Return from

| STACK -> PC<15:8>

|

 

|

 

| RETI

 

|

32

| 1 | 2 |

- - - |

|

Interrupt Routine

| SP - 1 -> SP

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

 

| STACK -> PC<7:0>

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

 

| SP - 1 -> SP

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

 

| 0 -> Intrupt Active Flag|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

| RL

|

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|

Rotate Accumulator

| A<6:0> -> A<7:1>

| Accumulator

|

 

| RL

 

A

|

23

| 1 | 1 |

- - - |

|

Left One Bit

| A<7> -> A<0>

|

 

|

 

|

 

 

|

 

|

|

|

 

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

 

|

4-10

|

------------------------

|-------------------------

|

-------------

|

-------------

|------------------------

 

 

|

-------

|---

|---

|-------

|

|

 

|

|

DEST

| SOURCE

|

ASSEMBLY

|HEX

|B

|C

| PSW

|

|

MNEMONIC

| OPERATION

|

ADDR

|

ADDR

|

LANGUAGE

|OP-

|Y

|Y

|C A O

|

|

 

|

|

MODE

|

MODE

|

 

FORM

|CODE

|T

|C

|F C V

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

RLC

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Rotate Accumulator

| A<6:0> -> A<7:1>

| Accumulator

|

 

| RLC

A

|

33

| 1

| 1

| * - - |

|

Left One Bit Thru

| CF -> A<0>

|

 

|

 

|

 

 

|

 

|

|

|

|

|

the Carry Flag

| A<7> -> CF

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

| RR

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Rotate Accumulator

| A<7:1> -> A<6:0>

| Accumulator

|

 

| RR

 

A

|

03

| 1

| 1

| - - - |

|

Right One Bit

| A<0> -> A<7>

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

RRC

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Rotate Accumulator

| A<7:1> -> A<6:0>

| Accumulator

|

 

| RRC

A

|

13

| 1

| 1

| * - - |

|

Right One Bit Thru

| CF -> A<7>

|

 

|

 

|

 

 

|

 

|

|

|

|

|

the Carry Flag

| A<0> -> CF

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

SETB

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Set Bit Operand

| 1 -> CF

| Carry Flag

|

 

| SETB

C

|

D3

| 1

| 1

| 1 - - |

|

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

 

| 1 -> DOper

| Bit Direct

|

 

| SETB

Baddr

|

D2

| 2

| 1

| - - - |

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

SJMP

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Short (8 bits)

| Jump Relative to PC

|

 

|

 

| SJMP

Roff

|

80

| 2

| 2

| - - - |

|

Relative Jump

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

SUBB

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Subtract Operand with

| A - SOper - CF -> A

| Accumulator

| Immediate

| SUBB

A,#data

|

94

| 2

| 1

| * * * |

|

Borrow from the

|

|

"

| Direct

| SUBB

A,Daddr

|

95

| 2

| 1

|

|

|

Accumulator

|

|

"

| Indirect

| SUBB

A,@Ri

| 96,97

| 1

| 1

|

|

|

 

|

|

"

| Register

| SUBB

A,Rn

| 98-9F | 1

| 1

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

SWAP

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Swap Nibbles within

| A<7:4> -> A<3:0>

| Accumulator

|

 

| SWAP

A

|

C4

| 1

| 1

| - - - |

|

the Accumulator

| A<3:0> -> A<7:4>

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

4-11

|

------------------------

|-------------------------

|

-------------

|

-------------

|

------------------------

 

|

-------

|---

|---

|-------

|

|

 

|

|

DEST

| SOURCE

|

ASSEMBLY

|HEX

|B

|C

| PSW

|

|

MNEMONIC

| OPERATION

|

ADDR

|

ADDR

|

LANGUAGE

|OP-

|Y

|Y

|C A O

|

|

 

|

|

MODE

|

MODE

|

 

FORM

|CODE

|T

|C

|F C V

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

XCH

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Exchange bytes of the

| SOper<7:0> -> A<7:0>

| Accumulator

| Direct

| XCH

A,Daddr

|

C5

| 2

| 1

| - - - |

|

Accumulator and the

| A<7:0> -> SOper<7:0>

|

"

| Indirect

| XCH

A,@Ri

| C6,C7

| 1

| 1

|

|

|

Source Operand

|

|

"

| Register

| XCH

A,Rn

| C8-CF | 1

| 1

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

XCHD

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Exchange the Least

| SOper<3:0> -> A<3:0>

| Accumulator

| Indirect

| XCHD

A,@Ri

| D6,D7

| 1

| 1

| - - - |

|

Significant Nibble of

| A<3:0> -> SOper<3:0>

|

 

|

 

|

 

 

|

 

|

|

|

|

|

the Accumulator and

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

the Source Operand

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

|

XRL

|

|

 

|

 

|

 

 

|

 

|

|

|

|

|

Logical Exclusive OR

| SOper v DOper -> DOper

| Direct

| Accumulator

| XRL

Daddr,A

|

62

| 2

| 1

| - - - |

|

of Source Operand

|

|

"

| Immediate

| XRL

Daddr,#data

|

63

| 3

| 2

|

|

|

with Destination

|

| Accumulator

| Immediate

| XRL

A,#data

|

64

| 2

| 1

|

|

|

Operand

|

|

"

| Direct

| XRL

A,Daddr

|

65

| 2

| 1

|

|

|

 

|

|

"

| Indirect

| XRL

A,@Ri

| 66,67

| 1

| 1

|

|

|

 

|

|

"

| Register

| XRL

A,Rn

| 68-6F | 1

| 1

|

|

|------------------------

 

|-------------------------

|-------------

 

|-------------

 

|------------------------

 

 

|-------

 

|---

|---

|-------

|

4-12

4.3. Notes

1There are 8 possible opcodes. Starting with 11H as the opcode base, the final opcode is formed by placing bits 8, 9 and 10 of the target address in bits 5, 6 and 7 of the opcode. The 8 possible opcodes in hexadecimal are then: 11, 31, 51, 71, 91, B1, D1, F1.

2There are 8 possible opcodes. Starting with 01H as the opcode base, the final opcode is formed by placing bits 8, 9 and 10 of the target address in bits 5, 6 and 7 of the opcode. The 8 possible opcodes in hexadecimal are then: 01, 21, 41, 61, 81, A1, C1, E1.

3The Carry Flag is set if the Destination Operand is less than the Source Operand. Otherwise the Carry Flag is cleared.

4The Carry Flag is set if the BCD result in the Accumulator is greater than decimal 99.

5The Overflow Flag is set if the B Register contains zero (flags a divide by zero operation). Otherwise the Overflow Flag is cleared.

6If any of the condition code flags are specified as the operand of this instruction, they will be reset by the instruction if they were originally set.

7The high byte of the 16-bit product is placed in the B Register, the low byte in Accumulator.

4.4. References

1. Intel Corp., Microcontroller Handbook, 1984.

4-13

CHAPTER 5

8051 CROSS ASSEMBLER DIRECTIVES

5.1. Introduction

The 8051 Cross Assembler Directives are used to define symbols, reserve memory space, store values in program memory, select various memory spaces, set the current segment's location counter and identify the end of the source file.

Only one directive per line is allowed, however comments may be included. The remaining part of this chapter details the function of each directive.

5.2. Symbol Definition Directives

EQU Directive

The EQUate directive is used to assign a value to a symbol. It can also be used to specify user defined names for the implicit operand symbols predefined for the Accumulator (i.e., A) and the eight General Purpose Registers (i.e., R0 thru R7).

The format for the EQU directive is: symbol, followed by one or more spaces or tabs, followed by EQU, followed by one or more spaces or tabs, followed by a number, arithmetic expression, previously defined symbol (no forward references allowed) or one of the allowed implicit operand symbols (e.g., A, R0, R1, R2, R3, R4, R5, R6, R7), followed by an optional comment.

Below are examples of using the EQU Directive:

TEN

EQU

10

;Symbol

equated

to a

number

COUNTER

EQU

R7

;User defined symbol

for the implicit

 

 

 

;operand symbol

R7.

COUNTER can now

 

 

 

;be used wherever it

is legal to use

 

 

 

;R7. For example the instruction

 

 

 

;INC R7

could now be

written INC COUNTER.

ALSO_TEN

EQU

TEN

;Symbol

equated

to a

previously defined

 

 

 

;symbol.

 

 

 

FIVE

EQU

TEN/2

;Symbol

equated

to an arithmetic exp.

A_REG

EQU

A

;User defined symbol

for the implicit

 

 

 

;operand symbol

A.

 

ASCII_D

EQU

'D'

;Symbol

equated

to an ASCII literal

SET Directive

Similar to the EQU directive, the SET directive is used to assign a value or implicit operand to a user defined symbol. The difference however, is that with the EQU directive, a symbol can

5-1

only be defined once. Any attempt to define the symbol again will cause the Cross Assembler to flag it as an error. On the other hand, with the SET directive, symbols are redefineable. There is no limit to the number of times a symbol can be redefined with the SET directive.

The format for the SET directive is: symbol, followed by one or more spaces or tabs, followed by SET, followed by one or more spaces or tabs, followed by a number, arithmetic expression, previously defined symbol (no forward references allowed) or one of the allowed implicit operand symbols (e.g., A, R0, R1, R2, R3, R4, R5, R6, R7), followed by an optional comment.

Below are examples of using the SET Directive:

POINTER

SET

R0

;Symbol

equated to

register 0

POINTER

SET

R1

;POINTER redefined

to register 1

COUNTER

SET

1

;Symbol

initialized to 1

COUNTER

SET

COUNTER+1

;An incrementing symbol

BIT Directive

The BIT Directive assigns an internal bit memory direct address to the symbol. If the numeric value of the address is between 0 and 127 decimal, it is a bit address mapped in the Internal Memory Space. If the numeric value of the address is between 128 and 255, it is an address of a bit located in one of the Special Function Registers. Addresses greater than 255 are illegal and will be flagged as an error.

The format for the BIT Directive is: symbol, followed by one or more spaces or tabs, followed by BIT, followed by one or more spaces or tabs, followed by a number, arithmetic expression, or previously defined symbol (no forward references allowed), followed by an optional comment.

Below are examples of using the BIT Directive:

CF

BIT

0D7H

;The single bit

Carry Flag in

PSW

OFF_FLAG

BIT

6

;Memory address

of single

bit

flag

ON_FLAG

BIT

OFF_FLAG+1

;Next bit is another flag

 

 

CODE Directive

The CODE Directive assigns an address located in the Program Memory Space to the symbol. The numeric value of the address cannot exceed 65535.

The format for the CODE Directive is: symbol, followed by one or more spaces or tabs, followed by CODE, followed by one or more spaces or tabs, followed by a number, arithmetic expression, or previously defined symbol (no forward references allowed), followed by an optional comment.

5-2

Соседние файлы в папке DOC