cancel
Showing results for 
Search instead for 
Did you mean: 

AST7 look up table example

y2399
Associate II
Posted on March 14, 2006 at 07:15

AST7 look up table example

3 REPLIES 3
y2399
Associate II
Posted on March 14, 2006 at 04:50

Hi all, and thanks for reading this post,

I'm looking for a syntax example for a 256 value look up table in ST7 assembler. Has someone ever done this ?

Thanks in advance for your help

Akotronic

fggnrc
Associate II
Posted on March 14, 2006 at 06:51

Akotronic,

the ASM lookup table implementation depends on the size of each element.

As an example, here is the code that computes a power of 2.

; This is the lookup table

PowersOf2 BYTE $01,$02,$04,$08,$10,$20,$40,$80

; This is the code to access the lookup table

; NOTICE: X holds the exponent e.g. X=3 means 2^3

LD A,(PowersOf2,X)

If each element needs more bytes (I mean more than one), you have to split the data in more tables - the quickiest way for the ST7 - or do some address computation.

BTW, see the output file of a C assembler that implements a lookup table, you'll find some interesting hints...

Bye

EtaPhi

y2399
Associate II
Posted on March 14, 2006 at 07:15

Hi EtaPhi and others,

In my case, I need only one byte for each element, so your exampe is ok for me.

Thanks very much for your answer.

Akotronic