ADDRESS SPACES
KS57C2308/P2308/C2316/P2316
2-4
INSTRUCTION REFERENCE AREA
Using 1-byte REF instructions, you can easily reference instructions with larger byte sizes that are stored in
addresses 0020H–007FH of program memory. This 96-byte area is called the REF instruction reference area, or
look-up table. Locations in the REF look-up table may contain two 1-byte instructions, one 2-byte instruction, or
one 3-byte instruction such as a JP (jump) or CALL. The starting address of the instruction you are referencing
must always be an even number. To reference a JP or CALL instruction, it must be written to the reference area
in a two-byte format: for JP, this format is TJP; for CALL, it is TCALL.
By using REF instructions you can execute instructions larger than one byte, In summary, there are three ways
you can use the REF instruction:
— Using the 1-byte REF instruction to execute one 2-byte or two 1-byte instructions,
— Branching to any location by referencing a branch instruction stored in the look-up table,
— Calling subroutines at any location by referencing a call instruction stored in the look-up table.
+
+
PROGRAMMING TIP — Using the REF Look-Up Table
Here is one example of how to use the REF instruction look-up table:
ORG
0020H
JMAIN
TJP
MAIN
; 0, MAIN
KEYCK
BTSF
KEYFG
; 1, KEYFG CHECK
WATCH
TCALL
CLOCK
; 2, CALL CLOCK
INCHL
LD
@HL,A
; 3, (HL)
←
A
INCS
HL
•
•
•
ABC
LD
EA,#00H
; 47, EA
←
#00H
ORG
0080H
MAIN
NOP
NOP
•
•
•
REF
KEYCK
; BTSF KEYFG (1-byte instruction)
REF
JMAIN
; KEYFG = 1, jump to MAIN (1-byte instruction)
REF
WATCH
; KEYFG = 0, CALL CLOCK (1-byte instruction)
REF
INCHL
; LD @HL,A
; INCS HL
REF
ABC
; LD EA,#00H (1-byte instruction)
•
•
•
Summary of Contents for C2316
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: ......