64
ImageCraft Assembly Language Guide, Document # 001-44475 Rev. *B
M8C Instruction Set
4.27
Return
RET
The last two bytes placed on the stack are used to change the PC (CPU_PC register). The lower 8
bits of the PC are popped off the stack first, followed by the SP being decremented by one. Next, the
upper 8 bits of the PC are popped off the stack, followed by a decrement of the SP. Neither Carry or
Zero Flag is affected by this instruction.
For PSoC devices with more than 256 bytes of RAM, the stack is confined to a single designated
stack page defined by the value of the STK_PP Register. The M8C automatically selects the stack
page as the source for the pop during the
RET
instruction. Therefore, a
RET
instruction may be
issued in any RAM page. After the
RET
instruction has completed, user code will be operating from
the same RAM page as before the
RET
instruction was executed.
See the RAM Paging chapter of the
PSoC Technical Reference Manual (TRM)
for details.
Instructions
Operation
Opcode
Cycles Bytes
Mnemonic
Argument
RET
0x7F
8
1
Conditional
Flags:
CF
ZF
Unaffected.
Unaffected.
Example:
0000
_main:
0000
90 02
[11]
call
SubFun
0002
40
[04]
nop
0003
30
[04]
halt
0004
0004
SubFun:
0004
40
[04]
nop
0005
7F
[08]
ret
The
RET
instruction will set the
PC
to
0x0002
, which is the starting address of the
first instruction after the
CALL
.
SP
SP 1
PC 7:0
ram SP
SP
SP 1
PC 15:8
ram SP
–
–
Summary of Contents for PSoC DESIGNER ImageCraft M8C
Page 6: ...6 ImageCraft Assembly Language Guide Document 001 44475 Rev B Contents Feedback ...
Page 10: ...10 ImageCraft Assembly Language Guide Document 001 44475 Rev B Introduction Feedback ...
Page 24: ...24 ImageCraft Assembly Language Guide Document 001 44475 Rev B M8C Microprocessor Feedback ...
Page 95: ...ImageCraft Assembly Language Guide Document 001 44475 Rev B 95 Assembler Directives Feedback ...
Page 96: ...96 ImageCraft Assembly Language Guide Document 001 44475 Rev B Assembler Directives Feedback ...
Page 104: ...104 ImageCraft Assembly Language Guide Document 001 44475 Rev B Feedback ...
Page 108: ...108 ImageCraft Assembly Language Guide Document 001 44475 Rev B Index Feedback ...