KS57C2308/P2308/C2316/P2316

SAM47 INSTRUCTION SET

 

 

JR — Jump Relative (Very Short)

JR(Continued)

Examples: 1. A short form for a relative jump to label “KK” is the instruction

JR KK

where “KK” must be within the allowed range of current PC–15 to current PC+16. The JR instruction has in this case the effect of an unconditional JP instruction.

2.In the following instruction sequence, if the instruction “LD WX, #02H” were to be executed in place of “LD WX,#00H”, the program would jump to 1004H andJPS“ CCC” would be executed. If “LD EA,#03H” were to be executed, the jump would be to1006H andJPS“ DDD” would be executed.

ORG

1000H

 

JPS

AAA

 

JPS

BBB

 

JPS

CCC

 

JPS

DDD

 

LD

WX,#00H

; WX 00H

LD

EA,WX

 

ADS

WX,EA

; WX (WX) + (WX)

JR

@WX

; Current PC13–8 (10H) + WX (00H) = 1000H

 

 

; Jump to address 1000H and execute JPS AAA

3. Here is another example:

 

ORG

1100H

 

LD

A,#0H

 

LD

A,#1H

 

LD

A,#2H

 

LD

A,#3H

 

LD

30H,A

; Address 30H A

JPS

YYY

 

XXX LD

EA,#00H

; EA 00H

JR

@EA

; Jump to address 1100H

 

 

; Address 30H 00H

If “LD EA,#01H” were to be executed in place of “LD EA,#00H”, the program would jump to 1001H and address 30H would contain the value 1H. If “LD EA,#02H” were to be executed, the jump would be to 1002H and address 30H would contain the value 2H.

5-59

Page 133
Image 133
Samsung KS57C2308 manual Jr Kk, Jps Aaa Bbb Ccc Ddd, Ea,Wx Ads Wx,Ea, Jps Yyy Xxx Ld