Re: [Fwd: need assembly code for sinx using look up table]

Started by Keith Larson August 18, 2006
Hello Nupur

The basic principle you need to know is that you can treat address
labels as simple numbers. This means you can add, subtract and (in
theory) even multiply them. The absolute value of a label is however
variable until it has been 'linked' to an absolute location. You can
clearly see this in the TI COFF assembler listing file. Basically the
linkers job is to then add the base or starting address of a section to
labels within a section. The DSK assembler is a little different in
that the base address is predefined so there is no need for a linker.

LABEL1 ; Beginning address
.float 1.234
.float 5.678
LABEL2 ; Ending address
LENGTH .long LABEL2-LABEL1 ; subtract address labels to get length

The DSK assembler is also different from the TI-COFF tools in that it
has math functions built in. And, given that addresses are also
numbers, a table can be easily generated. A lot of people use the DSK
assembler to generate tables. The following example code is from
SIN_SG.ASM. In it you will also notice the variable '$' gets used. The
'$' symbol stands for 'current address' and is therefor helpful in
calculating an offset value.
;================================================; lookup table for DSK_SG.EXE signal generator
;================================================ .start "TABLE",0X809800
.sect "TABLE"
N .set 128
PI .set 3.1415926
PI2N .set 2.0*PI/N
.loop N
offs .sdef ($-TR)
.float 16000.0 * cos(offs*PI2N)

Best regards
Keith Larson

------- Original Message -------- Subject: [c3x] need assembly code
hello everyone,

i just joined this group. i want to know how to create a look up table
in assembly? by using this look up table generate values of sinx.

thanks nupur