10 cmp compare two words – Texas Instruments MSP50C6xx User Manual

Page 177

Advertising
background image

Individual Instruction Descriptions

4-91

Assembly Language Instructions

4.14.10

CMP

Compare Two Words

[label]

name

src, src1 [, mod]

Clock, clk

Word, w

With RPT, clk

Class

CMP

An, {adrs}

Table 4–46

Table 4–46

1b

CMP

An[~], imm16 [, next A]

2

2

N/R

2b

CMP
CMP

An, An~ [, next A]
An~, An [, next A]

1

1

n

R

+3

3

CMP

Rx, imm16

2

2

N/R

4c

CMP

Rx, R5

1

1

n

R

+3

4d

† Does not modify An status

Execution

[premodify AP if mod specified]
STAT flags set by src – src1 operation
PC = PC + w

Flags Affected

src is An:

OF, SF, ZF, CF are set accordingly

src is Rx:

RCF, RZF are set accordingly

src is {adrs}:

TAG bit is set accordingly

Opcode

Instructions

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

CMP An, {adrs}

0

1

0

1

1

0

0

An

adrs

x

dma16 (for direct) or offset16 (long relative) [see section 4.13]

CMP An[~], imm16 [, next A]

1

1

1

0

0

next A

An

0

1

1

0

0

1

A~

~A

x

imm16

CMP An, An~ [, next A]

1

1

1

0

0

next A

An

1

0

0

0

0

0

0

0

CMP An~, An [, next A]

1

1

1

0

0

next A

An

1

0

0

0

0

0

1

0

CMP Rx, imm16

1

1

1

1

1

1

1

0

0

0

1

1

Rx

0

0

x

imm16

CMP Rx, R5

1

1

1

1

1

1

1

0

0

1

1

1

Rx

0

0

Description

Subtract value of src1 from src (i.e., srcsrc1) and only modify the status flag.
Premodification of accumulator pointer is allowed with some operand types.

See Also

CMPB, CMPS, Jcc, Ccc

Example 4.14.10.1

CMP A0, *R0

Compare value at accumulator A0 and the content of data memory location pointed by R0 and change
the STAT flags accordingly.

Example 4.14.10.2

CMP A0~, 0x1400, – –A

Predecrement accumulator pointer AP0. Compare value at accumulator A0~ to immediate value at
0x1400 and change the STAT flags accordingly.

Advertising