SUM

SUM, SUMP, DSUM, DSUMP

 

SUM instruction counts 1(bit=1) in 16bit data source and saves the result in Destination.

  • DSUM and DSUMP are double words.

 

 

S

Source

D

Destination

 

 

Instruction

Device address

No. of Steps

Flag

M

X

Y

K

L

F

T

C

S

Z

D

@D

Int.

 

Error

Zero

Carry

SUM(P)

DSUM(P)

S

o

o

o

o

o

o

o

o

-

o

o

o

o

3

o

-

-

D

o

-

o

o

o

-

o

o

-

o

o

o

-

 

SUM

  • When enabled, the SUM instruction counts 1 in 16bit data source and places the result in the Destination.

 

Example)

If X01 is ON, SUM instruction counts 1 in M00 and save the result 9 in D0.

 

 

 

 

DSUM

  • When enabled, the DSUM instruction counts 1 in 32bit data source and places the result in the Destination.

 

Example)

If X01 is ON, DSUM instruction counts 1 in D0 (double words) and saves the result 20 in D10.