Lookup Table in assembly
I'm looking for a simple example in assembly to do a lookup table.
DAT org
'--------- How do I access the table below?
mov ptr, #2 'Get second item in table
call look
look
????
mov data, ????
and data, $FFFF
look_ret ret
data res 1
ptr res 1
table word $0000
word $C0C1
word $C181
word $0140
word $C301
word $03C0
word $0280
' Many more values

Comments
look mov temp,ptr add temp,#table ' input value in ptr (0 to n-1) movs :inline,temp ' have to use instruction modification nop ' need pause here for future pipelining :inline mov data,0-0 ' get long value from table test ptr,#1 wz ' do we want odd or even half if_z and data,mask ' if even, take lower 16 bits if_nz shr data,#16 ' if odd, take upper 16 bits look_ret ret mask long $FFFFYou can do the same kind of thing if you need byte values.
Post Edited (Mike Green) : 8/21/2006 10:54:54 PM GMT
I, for one, would appreciate seeing the answer to Kevin's question of The answer not being posted isn't very helpful to others who may also learn from this message string.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko
h.a.s. designn