Motorola HC12 Refrence Manual page 261

Table of Contents

Advertisement

TBL
(M) + [(B) × ((M+1) – (M))] ⇒ A
Operation:
Description:
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 8-bit values. The result is stored
in accumulator A.
Before executing TBL, set up an index register so that it will point 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 X position of the de-
sired lookup point. Load accumulator B with a binary fraction (radix point
to left of MSB), representing the ratio (XL–X1)
The 8-bit unrounded result is calculated using the following expression:
Where
The intermediate value [(B) × (Y2 – Y1)] produces a 16-bit result with the
radix point between bits 7 and 8. The result in A is the upper 8-bits (inte-
ger part) of this intermediate 16-bit value, plus the 8-bit value Y1.
Any indexed addressing mode referenced to X, Y, SP, or PC, except in-
direct 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
TBL oprx0_xysp
CPU12
REFERENCE MANUAL
Table Lookup and Interpolate
A = Y1 + [(B) × (Y2 – Y1)]
(B) = (XL – X1) ÷ (X2 – X1)
Y1 = 8-bit data entry pointed to by <effective address>
Y2 = 8-bit data entry pointed to by <effective address> + 1
X
H
I
N
Z
Set if MSB of result is set; cleared otherwise.
Set if result is $00; cleared otherwise.
Undefined.
Address Mode
IDX
INSTRUCTION GLOSSARY
V
C
?
Object Code
18 3D xb
TBL
÷
(X2–X1).
Cycles
Access Detail
8
OrrffffP
MOTOROLA
6-201

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cpu12

Table of Contents