SAM47 INSTRUCTION SET
KS57C2308/P2308/C2316/P2316
5-2
Instruction Reference Area
Using the 1-byte REF (Reference) instruction, you can reference instructions stored in the addresses
0020H–007FH of program memory (the REF instruction look-up table). The location referenced by REF may
contain either two 1-byte instructions or a single 2-byte instruction. The starting address of the instruction being
referenced must always be an even number.
3-byte instructions such as JP or CALL may also be referenced using REF. To reference these 3-byte
instructions, the 2-byte pseudo commands, TJP and TCALL, must be written in the reference.
The PC is not incremented when an REF instruction is executed. After it executes, the program's instruction
execution sequence resumes at the address immediately following the REF instruction. By using REF instructions
to execute instructions larger than one byte, as well as branches and subroutines, you can reduce the program
size. To summarize, the REF instruction can be used in three ways:
— Using the 1-byte REF instruction to execute one 2-byte or two 1-byte instructions;
— Branching to any location by referencing a branch address that is stored in the look-up table;
— Calling subroutines at any location by referencing a call address that is stored in the look-up table.
If necessary, an REF instruction can be circumvented by means of a skip operation prior to the REF in the
execution sequence. In addition, the instruction immediately following an REF can also be skipped by using an
appropriate reference instruction or instructions.
Two-byte instructions can be referenced by using an REF instruction. (An exception is XCH A,DA
(note)
)
If the MSB value of the first 1-byte instruction in the reference area is “0”, the instruction cannot be referenced by
a REF instruction. Therefore, if you use REF to reference two 1-byte instructions stored in the reference area,
specific combinations must be used for the first and second 1-byte instruction. These combinations are described
in Table5-1.
Table 5-1. Valid 1-Byte Instruction Combinations for REF Look-Ups
First 1-Byte Instruction
Second 1-Byte Instruction
Instruction
Operand
Instruction
Operand
LD
A,#im
INCS
(note)
R
INCS
RRb
DECS
(note)
R
LD
A,@Rra
INCS
(note)
R
INCS
RRb
DECS
(note)
R
LD
@HL,A
INCS
(note)
R
INCS
RRb
DECS
(note)
R
NOTE
: The MSB value of the instruction is “0”.
Summary of Contents for KS57C2308
Page 30: ...ADDRESS SPACES KS57C2308 P2308 C2316 P2316 2 22 NOTES ...
Page 168: ...SAM47 INSTRUCTION SET KS57C2308 P2308 C2316 P2316 5 94 NOTES ...
Page 170: ......
Page 206: ...POWER DOWN KS57C2308 P2308 C2316 P2316 8 8 NOTES ...
Page 210: ...RESET KS57C2308 P2308 C2316 P2316 9 4 NOTES ...
Page 222: ...I O PORTS KS57C2308 P2308 C2316 P2316 10 12 NOTES ...
Page 272: ...LCD CONTROLLER DRIVER KS57C2308 P2308 C2316 P2316 12 24 NOTES ...
Page 280: ...SERIAL I O INTERFACE KS57C2308 P2308 C2316 P2316 13 8 NOTES ...
Page 294: ...MECHANICAL DATA KS57C2308 P2308 C2316 P2316 15 2 NOTES ...
Page 310: ...KS57P2308 P2316 OTP KS57C2308 P2308 C2316 P2316 16 16 NOTES ...
Page 318: ......
Page 320: ......
Page 322: ......
Page 325: ......
Page 327: ......