SN8P1600
8-bit micro-controller
The other coding style of loop-up table is to add Y or Z index register by accumulator. Be careful if carry happen. Refer
following example for detailed information:
ꢃ Example: Increase Y and Z register by B0ADD/ADD instruction
B0MOV
B0MOV
Y, #TABLE1$M
Z, #TABLE1$L
; To set lookup table’s middle address.
; To set lookup table’s low address.
B0MOV
B0ADD
A, BUF
Z, A
; Z = Z + BUF.
B0BTS1
JMP
INCMS
NOP
FC
GETDATA
Y
; Check the carry flag.
; FC = 0
; FC = 1. Y+1.
GETDATA:
TABLE1:
;
MOVC
; To lookup data. If BUF = 0, data is 0x0035
; If BUF = 1, data is 0x5105
; If BUF = 2, data is 0x2012
.
.
;
; To define a word (16 bits) data.
; “
; “
.
.
DW
DW
DW
0035H
5105H
2012H
SONiX TECHNOLOGY CO., LTD
Page 21
Revision 1.94