Motorola HC12 Refrence Manual page 149

Table of Contents

Advertisement

ETBL
(M : M + 1) + [(B) × ((M + 2 : M + 3) – (M : M + 1))] ⇒ D
Operation:
Description:
ETBL linearly interpolates one of 256 result values that fall between
each pair of data entries in a lookup table stored in memory. Data points
in the table represent the endpoints of equally-spaced line segments.
Table entries and the interpolated result are 16-bit values. The result is
stored in the D accumulator.
Before executing ETBL, set up an index register so that it points to the
starting point (X1) of a line segment when the instruction is executed. X1
is the table entry closest to, but less than or equal to, the desired lookup
value. The next table entry after X1 is X2. XL is the distance in X be-
tween X1 and X2. Load accumulator B with a binary fraction (radix point
to left of MSB) representing the ratio (XL–X1)
The 16-bit unrounded result is calculated using the following expression:
Where
The intermediate value [(B) × (Y2 – Y1)] produces a 24-bit result with the
radix point between bits 7 and 8. Any indexed addressing mode, except
indirect modes or 9-bit and 16-bit offset modes, can be used to identify
the first data point (X1,Y1). The second data point is the next table entry.
Condition Codes and Boolean Formulas:
S
N:
Z:
C:
Addressing Modes, Machine Code, and Execution Times:
Source Form
ETBL oprx0_xysp
CPU12
REFERENCE MANUAL
Extended Table Lookup and Interpolate
D = Y1 + [(B) × (Y2 – Y1)]
(B) = (XL – X1) ÷ (X2 – X1)
Y1 = 16-bit data entry pointed to by <effective address>
Y2 = 16-bit data entry pointed to by <effective address> + 2
X
H
I
N
Z
Set if MSB of result is set; cleared otherwise.
Set if result is $0000; cleared otherwise.
Undefined.
Address Mode
IDX
INSTRUCTION GLOSSARY
V
C
?
Object Code
18 3F xb
ETBL
÷
(X2–X1).
Cycles
Access Detail
10
ORRffffffP
MOTOROLA
6-89

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cpu12

Table of Contents