SAM47 INSTRUCTION SETKS57C2308/P2308/C2316/P2316

ADS — Add And Skip On Overflow

ADS

dst,src

 

 

 

 

 

 

 

 

Operation:

Operand

Operation Summary

Bytes

Cycles

 

 

 

 

 

 

A, #im

Add 4-bit immediate data to A and skip on overflow

1

1 + S

 

 

 

 

 

 

EA,#imm

Add 8-bit immediate data to EA and skip on overflow

2

2 + S

 

 

 

 

 

 

A,@HL

Add indirect data memory to A and skip on overflow

1

1 + S

 

 

 

 

 

 

EA,RR

Add register pair (RR) contents to EA and skip on

2

2 + S

 

 

overflow

 

 

 

 

 

 

 

 

RRb,EA

Add EA to register pair (RRb) and skip on overflow

2

2 + S

 

 

 

 

 

Description: The source operand is added to the destination operand and the sum is stored in the destination. The contents of the source are unaffected. If there is an overflow from the most significant bit of the result, the skip signal is generated and a skip is executed, but the carry flag value is unaffected.

If “ADSA,#im” follows an “ADC A,@HL” instruction in a program, ADC skips the ADS instruction if an overflow occurs. If there is no overflow, the ADS instruction is executed normally. This skip condition is valid only for “ADC A,@HL” instructions, however. If an overflow occurs following an ADS instruction, the next instruction is not skipped.

Operand

 

 

 

Binary Code

 

 

 

Operation Notation

 

 

 

 

 

 

 

 

 

 

 

 

A, #im

1

0

1

 

0

d3

 

d2

d1

d0

A A + im; skip on overflow

 

 

 

 

 

 

 

 

 

 

 

 

EA,#imm

1

1

0

 

0

1

 

0

0

1

EA EA + imm; skip on overflow

 

 

 

 

 

 

 

 

 

 

 

 

 

d7

d6

d5

 

d4

d3

 

d2

d1

d0

 

 

 

 

 

 

 

 

 

 

 

 

 

A,@HL

0

0

1

 

1

1

 

1

1

1

A A + (HL); skip on overflow

 

 

 

 

 

 

 

 

 

 

 

 

EA,RR

1

1

0

 

1

1

 

1

0

0

EA EA + RR; skip on overflow

 

 

 

 

 

 

 

 

 

 

 

 

 

1

0

0

 

1

1

 

r2

r1

0

 

 

 

 

 

 

 

 

 

 

 

 

 

RRb,EA

1

1

0

 

1

1

 

1

0

0

RRb RRb + EA; skip on overflow

 

 

 

 

 

 

 

 

 

 

 

 

 

1

0

0

 

1

0

 

r2

r1

0

 

 

 

 

 

 

 

 

 

 

 

 

 

Examples: 1. The extended accumulator contains the value 0C3H, register pair HL the value 0AAH, and the carry flag = "0":

ADS

EA,HL

;

EA 0C3H + 0AAH = 6DH

 

 

; ADS skips on overflow, but carry flag value is not

 

 

 

affected.

JPS

XXX

; This instruction is skipped since ADS had an overflow.

JPS

YYY

;

Jump to YYY.

5-26

Page 100
Image 100
Samsung KS57C2308 manual ADS Add And Skip On Overflow, Ads Ea,Hl, Jps Yyy