ADDRESS SPACES

KS57C2308/P2308/C2316/P2316

 

 

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)

 

 

 

 

 

 

 

 

 

 

 

 

2-4

Page 12
Image 12
Samsung KS57C2308 manual Instruction Reference Area, + Programming TIP Using the REF Look-Up Table