AnsweredAssumed Answered

How to? Indexed addressing of 16-bit values.

Question asked by Graham Pratt on Apr 27, 2011
Latest reply on Apr 30, 2011 by Graham Pratt

What I want to know is probably easy-peasy once you already know how...

 

I want to read a value of 0-255 from the outside world and depending on this value, look down a list of 255 16-bit values and select a corresponding value.

 

Down the bottom somewhere I suppose I would have a list:

 

ORG $whatever

FDB      #12345

FDB      #65535

FDB      #35

 

and to read one of these values I would have

 

LDX       POSITION_ON_LIST (outside-world value)

LDHX    $whatever,X

 

and then hopefully HX gets loaded with the value on the list corresponding to the value that was placed in X. Seeing that my list of values are 16 bit they take up pairs of memory locations, so does X really know to point to only every even value address, not even and odd like if it were addressing a list of 8 bit values?

Outcomes