Skip to main content
Knowledgebase
Home
Renesas Electronics America - Knowledgebase

Obtaining the value of the program counter (PC) in assembler (CC-RL)

Last Updated:04/17/2017

Question:

I am using the CC-RL compiler for RL78 devices. How do I obtain the value of the PC with an assembler instruction?

Answer:

Since the RL78 family does not have an instruction to transfer the value of the PC, define a label at the position where you want to obtain the value and then obtain the value of the label. 
(Example)
label:
    MOVW AX, #LOWW(label)
    MOVW BC, #HIGHW(label)
Suitable Products
e² studio
CS+ (formerly CubeSuite+)
C Compiler Package for RL78 Family