I am trying to access a table using ix as follows
ld ix , b ;where b has the offset (0 to whatever)
ld a,(ix+sseg) ; sseg is the label at the start of the table. this is where I get the error. It says the offset is too big

I got this from a textbook, except sseg was an actual address rather than a label
Anybody have an answer?
You have it backwards.

IX is used as a location to a data structure. IY is commonly used for OS flags.

Code:
ld ix, dataStructure
ld a, (ix + offset)
If I load sseg in the ix register, how do I use the offset? can it be a register? or is it only immediate data. If so what use is the ix register since you can't index it except for immediate data?
The offset can only be immediate data. To put it in C terms, it's most useful for accessing members of a structure (which are at fixed offsets) rather than indexing an array.

For array indexing, you typically still want to use HL along with 16-bit addition, or if your array is 256 bytes or smaller and aligned in memory, doing arithmetic on the low 8 bits of a pointer can be an effective optimization.
Indeed for TI-calcs IY is used for OS flags however it can be used the same was as the IS example above if you disable interrupts and/or preserve it.

For general z80 you would need to know if there are any requirements to preserve it etc which would be system dependent.
thanks to all.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement