56
ImageCraft Assembly Language Guide, Document # 001-44475 Rev. *B
M8C Instruction Set
4.19
Long Call
LCALL
Replaces the PC value with the
LCALL
instruction’s argument. The new PC value determines the
address of the first byte of the next instruction.
Two pushes are used to store the Program Counter (current
PC+3
) on the stack. The current PC
value is defined as the PC value that corresponds to the ROM address of the first byte of the instruc-
tion.
First, the upper 8 bits of the
PC+3
are placed on the stack followed by the lower 8 bits. The Stack
Pointer is post-incremented for each push. For PSoC microcontrollers with more than 256 bytes of
RAM, the stack is confined to a single designated stack page defined in the device data sheet. The
M8C automatically selects the stack page as the destination for the push during the
LCALL
instruc-
tion. Therefore, a
LCALL
instruction may be issued in any RAM page. After the
LCALL
instruction
has completed, user code will be operating from the same RAM page as before the
LCALL
instruc-
tion was executed.
This instruction has a 16-bit unsigned address. A three-byte instruction format is used where the first
byte is a full 8-bit opcode.
Instructions
Operation
Opcode
Cycles Bytes
Mnemonic
Argument
LCALL
expr
0x7C
13
3
Conditional
Flags:
CF
ZF
Unaffected.
Unaffected.
Example:
0000
_main:
0000
7C 00 05
[13]
lcall SubFun
0003
8F FC
[05]
jmp _main
Although in this example a full 16-bit address is not needed for the call to
SubFun
,
the listing above shows that the
lcall
instruction is using a three byte format
which accommodates the 16-bit absolute jump address of
0x0005
.
0005
0005
SubFun:
0005
7F
[08]
ret
ram SP
PC 3
+
15:8
SP
SP 1
ram SP
PC 3
+
7:0
SP
SP 1
PC
k, 0 k 65535
+
+
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 ...